diff --git a/DEPS b/DEPS index 0616034..ad81cc7 100644 --- a/DEPS +++ b/DEPS
@@ -129,11 +129,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': 'b3fd67ac36cf24d4be813067ff8b28f708dee21b', + 'skia_revision': '215da624d11340b254b5d17116bf20262f4ed69f', # 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': '51a4744b12dc0fae0d5577634e73133dc87158a9', + 'v8_revision': '84f2a33af26543d966c69574fd3c376a433537f9', # 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. @@ -141,7 +141,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': '6cb0cff573768d72d06aef02926d0d92ffb02635', + 'angle_revision': '7a6e421e16c6110e0892fe1d4bdf11fe9f43e0e5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -196,7 +196,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': '83131f4f49335945ea647db8f35fbe286a185152', + 'catapult_revision': 'e0703df92e4d46220bbee0ab2e3673e390f6200b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -252,7 +252,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'spv_tools_revision': '0300a464a4ccdfac0052fcc0524a67592e9b19e8', + 'spv_tools_revision': 'e2ddb9371edb03c43b0fe386ef340db2697eede1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -805,7 +805,7 @@ # Build tools for Chrome OS. Note: This depends on third_party/pyelftools. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'eac9bbc95090ba5ec7ef2dfce84ffb5b59416af5', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '162db334faa91daf9f0aff43e31a39d52ff56196', 'condition': 'checkout_linux', }, @@ -1022,7 +1022,7 @@ Var('chromium_git') + '/chromium/llvm-project/compiler-rt/lib/fuzzer.git' + '@' + Var('libfuzzer_revision'), 'src/third_party/libaddressinput/src': - Var('chromium_git') + '/external/libaddressinput.git' + '@' + '81e7ead903f5b71a326e0584f4325f106c804df1', + Var('chromium_git') + '/external/libaddressinput.git' + '@' + '56c60affb5de83c10ebf5f11d9adcdd70648ab71', 'src/third_party/libaom/source/libaom': Var('aomedia_git') + '/aom.git' + '@' + '625cded0550bb79efd10d98a9809a7ccd72a8f60', @@ -1343,7 +1343,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '688fbfe33779392aa210d67d4aa12cb012f112c2', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '4f5975c99024fe253a342da06532b0ddf7de687a', + Var('webrtc_git') + '/src.git' + '@' + 'cb755b001c42051a6b41c68754033810d9f9f0a5', 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d', @@ -1384,7 +1384,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@bed354efaacc62d7f5a7eaaf895fc67b3b1ee1d0', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@1044ce07764daa2f196d1d2dd669cb1583ea24c2', 'condition': 'checkout_src_internal', }, @@ -1392,7 +1392,7 @@ 'packages': [ { 'package': 'chromium/third_party/android_deps/libs/com_google_android_play_core_verification', - 'version': '8G9OLUMhXcZ3EtWR234C86_a9afooucYik62UE_FjrsC', + 'version': 'sPjmEe18bOaRHsFxIEohCPLEibGhrlFv-_ZcpEywt7YC', }, ], 'condition': 'checkout_android',
diff --git a/android_webview/browser/aw_contents.cc b/android_webview/browser/aw_contents.cc index e4478620..1268f7f 100644 --- a/android_webview/browser/aw_contents.cc +++ b/android_webview/browser/aw_contents.cc
@@ -1205,6 +1205,8 @@ float scale = browser_view_renderer_.page_scale_factor(); if (!content::IsUseZoomForDSFEnabled()) scale *= browser_view_renderer_.dip_scale(); + + DCHECK_GE(duration_ms, 0); render_view_host_ext_->SmoothScroll(target_x / scale, target_y / scale, duration_ms); }
diff --git a/android_webview/browser/aw_contents_statics.cc b/android_webview/browser/aw_contents_statics.cc index 8574d70..2d9e5de 100644 --- a/android_webview/browser/aw_contents_statics.cc +++ b/android_webview/browser/aw_contents_statics.cc
@@ -19,6 +19,7 @@ #include "components/version_info/version_info.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/storage_partition.h" #include "content/public/common/url_constants.h" #include "jni/AwContentsStatics_jni.h" @@ -132,4 +133,9 @@ AwURLRequestContextGetter::set_check_cleartext_permitted(permitted); } +// static +jboolean JNI_AwContentsStatics_IsMultiProcessEnabled(JNIEnv* env) { + return !content::RenderProcessHost::run_renderer_in_process(); +} + } // namespace android_webview
diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc index 8a74a76..bf6ff44 100644 --- a/android_webview/browser/renderer_host/aw_render_view_host_ext.cc +++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.cc
@@ -135,10 +135,10 @@ void AwRenderViewHostExt::SmoothScroll(int target_x, int target_y, - long duration_ms) { - web_contents()->GetMainFrame()->Send(new AwViewMsg_SmoothScroll( - web_contents()->GetMainFrame()->GetRoutingID(), target_x, target_y, - static_cast<int>(duration_ms))); + uint64_t duration_ms) { + web_contents()->GetMainFrame()->Send( + new AwViewMsg_SmoothScroll(web_contents()->GetMainFrame()->GetRoutingID(), + target_x, target_y, duration_ms)); } void AwRenderViewHostExt::RenderViewHostChanged(
diff --git a/android_webview/browser/renderer_host/aw_render_view_host_ext.h b/android_webview/browser/renderer_host/aw_render_view_host_ext.h index 0591d58..fe2d3a2 100644 --- a/android_webview/browser/renderer_host/aw_render_view_host_ext.h +++ b/android_webview/browser/renderer_host/aw_render_view_host_ext.h
@@ -78,7 +78,7 @@ void SetWillSuppressErrorPage(bool suppress); void SetJsOnlineProperty(bool network_up); - void SmoothScroll(int target_x, int target_y, long duration_ms); + void SmoothScroll(int target_x, int target_y, uint64_t duration_ms); private: // content::WebContentsObserver implementation.
diff --git a/android_webview/common/render_view_messages.h b/android_webview/common/render_view_messages.h index b148fdc..10a4f4b 100644 --- a/android_webview/common/render_view_messages.h +++ b/android_webview/common/render_view_messages.h
@@ -85,7 +85,7 @@ IPC_MESSAGE_ROUTED3(AwViewMsg_SmoothScroll, int /* target_x */, int /* target_y */, - int /* duration_ms */) + uint64_t /* duration_ms */) // Sent to inform renderers whether the internal error page should be shown or // not.
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/SharedStatics.java b/android_webview/glue/java/src/com/android/webview/chromium/SharedStatics.java index a12ab636..cf7dc15 100644 --- a/android_webview/glue/java/src/com/android/webview/chromium/SharedStatics.java +++ b/android_webview/glue/java/src/com/android/webview/chromium/SharedStatics.java
@@ -118,4 +118,8 @@ return PostTask.runSynchronously(UiThreadTaskTraits.DEFAULT, () -> AwContentsStatics.getSafeBrowsingPrivacyPolicyUrl()); } + + public boolean isMultiProcessEnabled() { + return AwContentsStatics.isMultiProcessEnabled(); + } }
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java index 9d019b2c..e808a82 100644 --- a/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java +++ b/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
@@ -462,6 +462,10 @@ public Uri getSafeBrowsingPrivacyPolicyUrl() { return sharedStatics.getSafeBrowsingPrivacyPolicyUrl(); } + + public boolean isMultiProcessEnabled() { + return sharedStatics.isMultiProcessEnabled(); + } }; } }
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java b/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java index 591a07d..111a693 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java
@@ -137,6 +137,13 @@ return FindAddress.findAddress(addr); } + /** + * Returns true if WebView is running in multi process mode. + */ + public static boolean isMultiProcessEnabled() { + return nativeIsMultiProcessEnabled(); + } + //-------------------------------------------------------------------------------------------- // Native methods //-------------------------------------------------------------------------------------------- @@ -149,4 +156,5 @@ private static native void nativeSetSafeBrowsingWhitelist( String[] urls, Callback<Boolean> callback); private static native void nativeSetCheckClearTextPermitted(boolean permitted); + private static native boolean nativeIsMultiProcessEnabled(); }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java index 401995f9..b53043b 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java
@@ -7,6 +7,8 @@ import static org.chromium.android_webview.test.OnlyRunIn.ProcessMode.SINGLE_PROCESS; import android.content.Intent; +import android.os.Handler; +import android.os.Looper; import android.support.test.InstrumentationRegistry; import android.support.test.filters.MediumTest; @@ -23,9 +25,7 @@ import org.chromium.android_webview.test.util.VariationsTestUtils; import org.chromium.base.ContextUtils; import org.chromium.base.metrics.RecordHistogram; -import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CallbackHelper; -import org.chromium.content_public.browser.UiThreadTaskTraits; import java.io.File; import java.io.IOException; @@ -81,6 +81,8 @@ } } + private Handler mMainHandler; + // Create a TestLoader, run it on the UI thread, and block until it's finished. The return value // indicates whether the loader decided to request a new seed. private boolean runTestLoaderBlocking() throws InterruptedException, TimeoutException { @@ -93,7 +95,7 @@ CallbackHelper onRequestReceived = MockVariationsSeedServer.getRequestHelper(); int requestsReceived = onRequestReceived.getCallCount(); - PostTask.postTask(UiThreadTaskTraits.DEFAULT, run); + Assert.assertTrue("Failed to post seed loader Runnable", mMainHandler.post(run)); result.waitForCallback("Timed out waiting for loader to finish background work.", 0); if (result.wasSeedRequested()) { onRequestReceived.waitForCallback("Seed requested, but timed out waiting for request" + @@ -105,6 +107,7 @@ @Before public void setUp() throws IOException { + mMainHandler = new Handler(Looper.getMainLooper()); ContextUtils.initApplicationContextForTests( InstrumentationRegistry.getInstrumentation() .getTargetContext().getApplicationContext());
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java index 32c5e4c1..4435192 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/WebKitHitTestTest.java
@@ -24,6 +24,7 @@ import org.chromium.android_webview.AwContents; import org.chromium.android_webview.test.util.AwTestTouchUtils; import org.chromium.android_webview.test.util.CommonResources; +import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.Feature; import org.chromium.content_public.browser.test.util.TestCallbackHelperContainer.OnPageCommitVisibleHelper; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -398,6 +399,7 @@ @Test @SmallTest + @DisableIf.Build(hardware_is = "flo", message = "crbug.com/948622") @Feature({"AndroidWebView", "WebKitHitTest"}) public void testUnknownTypeUnrecognizedNode() throws Throwable { // Since UNKNOWN_TYPE is the default, hit test another type first for
diff --git a/android_webview/lib/aw_main_delegate.cc b/android_webview/lib/aw_main_delegate.cc index bae2f58..d8085448 100644 --- a/android_webview/lib/aw_main_delegate.cc +++ b/android_webview/lib/aw_main_delegate.cc
@@ -190,7 +190,7 @@ // WebView doesn't support embedding CompositorFrameSinks which is needed // for UseSurfaceLayerForVideo feature. https://crbug.com/853832 - features.DisableIfNotSet(media::kUseSurfaceLayerForVideo); + features.EnableIfNotSet(media::kDisableSurfaceLayerForVideo); // WebView does not support EME persistent license yet, because it's not // clear on how user can remove persistent media licenses from UI.
diff --git a/android_webview/renderer/aw_render_frame_ext.cc b/android_webview/renderer/aw_render_frame_ext.cc index afd3a5b5..10be1b3 100644 --- a/android_webview/renderer/aw_render_frame_ext.cc +++ b/android_webview/renderer/aw_render_frame_ext.cc
@@ -343,12 +343,12 @@ void AwRenderFrameExt::OnSmoothScroll(int target_x, int target_y, - int duration_ms) { + uint64_t duration_ms) { blink::WebView* webview = GetWebView(); if (!webview) return; - webview->SmoothScroll(target_x, target_y, static_cast<long>(duration_ms)); + webview->SmoothScroll(target_x, target_y, duration_ms); } void AwRenderFrameExt::OnSetWillSuppressErrorPage(bool suppress) {
diff --git a/android_webview/renderer/aw_render_frame_ext.h b/android_webview/renderer/aw_render_frame_ext.h index 8a9fff3e..23f95e61 100644 --- a/android_webview/renderer/aw_render_frame_ext.h +++ b/android_webview/renderer/aw_render_frame_ext.h
@@ -59,7 +59,7 @@ void OnSetBackgroundColor(SkColor c); - void OnSmoothScroll(int target_x, int target_y, int duration_ms); + void OnSmoothScroll(int target_x, int target_y, uint64_t duration_ms); void OnSetWillSuppressErrorPage(bool suppress);
diff --git a/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java b/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java index d60a60dd..648d416 100644 --- a/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java +++ b/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/StaticsBoundaryInterface.java
@@ -17,4 +17,5 @@ void initSafeBrowsing(Context context, ValueCallback<Boolean> callback); void setSafeBrowsingWhitelist(List<String> hosts, ValueCallback<Boolean> callback); Uri getSafeBrowsingPrivacyPolicyUrl(); + boolean isMultiProcessEnabled(); }
diff --git a/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/Features.java b/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/Features.java index fbf0625..02e6413e 100644 --- a/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/Features.java +++ b/android_webview/support_library/boundary_interfaces/src/org/chromium/support_lib_boundary/util/Features.java
@@ -156,4 +156,7 @@ // WebViewRendererClient.onRendererResponsive() public static final String WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE = "WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE"; + + // WebViewCompat.isMultiProcessEnabled + public static final String MULTI_PROCESS_QUERY = "MULTI_PROCESS_QUERY"; }
diff --git a/android_webview/support_library/java/src/org/chromium/support_lib_glue/SupportLibWebViewChromiumFactory.java b/android_webview/support_library/java/src/org/chromium/support_lib_glue/SupportLibWebViewChromiumFactory.java index d35e8bde..3c076071 100644 --- a/android_webview/support_library/java/src/org/chromium/support_lib_glue/SupportLibWebViewChromiumFactory.java +++ b/android_webview/support_library/java/src/org/chromium/support_lib_glue/SupportLibWebViewChromiumFactory.java
@@ -70,6 +70,7 @@ Features.WEB_VIEW_RENDERER_TERMINATE, Features.TRACING_CONTROLLER_BASIC_USAGE, Features.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE, + Features.MULTI_PROCESS_QUERY + Features.DEV_SUFFIX, }; // clang-format on @@ -119,6 +120,11 @@ public Uri getSafeBrowsingPrivacyPolicyUrl() { return mSharedStatics.getSafeBrowsingPrivacyPolicyUrl(); } + + @Override + public boolean isMultiProcessEnabled() { + return mSharedStatics.isMultiProcessEnabled(); + } } @Override
diff --git a/android_webview/system_webview_apk_tmpl.gni b/android_webview/system_webview_apk_tmpl.gni index 3645054..ee076eb 100644 --- a/android_webview/system_webview_apk_tmpl.gni +++ b/android_webview/system_webview_apk_tmpl.gni
@@ -104,9 +104,7 @@ # Used as an additional apk in test scripts. never_incremental = true - if (is_java_debug) { - enable_multidex = true - } else { + if (!is_java_debug) { proguard_enabled = true if (!defined(proguard_configs)) { proguard_configs = []
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index 014c03b..d3b52d2 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn
@@ -81,8 +81,6 @@ rebase_path("$root_gen_dir/CHROME_VERSION.json", root_build_dir) native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)" - enable_multidex = true - command_line_flags_file = "android-webview-command-line" } @@ -310,9 +308,6 @@ } test("android_webview_unittests") { - # Dependencies (e.g. Play services) make the binary reach the dex limit. - enable_multidex = true - deps = [ ":android_webview_unittests_assets", ":android_webview_unittests_java",
diff --git a/android_webview/tools/system_webview_shell/BUILD.gn b/android_webview/tools/system_webview_shell/BUILD.gn index 586e3cd1..593a35e 100644 --- a/android_webview/tools/system_webview_shell/BUILD.gn +++ b/android_webview/tools/system_webview_shell/BUILD.gn
@@ -62,7 +62,6 @@ "//third_party/android_support_test_runner:runner_java", "//third_party/junit", ] - enable_multidex = true } instrumentation_test_apk("system_webview_shell_layout_test_apk") {
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 7b2d605..488123e 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -1118,6 +1118,8 @@ "wm/overview/overview_utils.h", "wm/overview/overview_window_drag_controller.cc", "wm/overview/overview_window_drag_controller.h", + "wm/overview/rounded_label_widget.cc", + "wm/overview/rounded_label_widget.h", "wm/overview/rounded_rect_view.cc", "wm/overview/rounded_rect_view.h", "wm/overview/scoped_overview_animation_settings.cc",
diff --git a/ash/app_list/views/app_list_view.cc b/ash/app_list/views/app_list_view.cc index bdc19ba..d3d8a1a7 100644 --- a/ash/app_list/views/app_list_view.cc +++ b/ash/app_list/views/app_list_view.cc
@@ -45,7 +45,6 @@ #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/image/image_skia.h" -#include "ui/gfx/interpolated_transform.h" #include "ui/gfx/skia_util.h" #include "ui/keyboard/keyboard_controller.h" #include "ui/strings/grit/ui_strings.h" @@ -321,49 +320,6 @@ DISALLOW_COPY_AND_ASSIGN(AppListBackgroundShieldView); }; -// Animation used to translate AppListView as well as its child views. -class AppListAnimation : public ui::LayerAnimationElement { - public: - AppListAnimation(gfx::PointF start_pos, - gfx::PointF end_pos, - base::TimeDelta duration, - gfx::Tween::Type tween_type, - AppListView* view) - : ui::LayerAnimationElement(ui::LayerAnimationElement::TRANSFORM, - duration), - transform_( - std::make_unique<ui::InterpolatedTranslation>(start_pos, end_pos)), - view_(view), - tween_type_(tween_type) {} - - ~AppListAnimation() override = default; - - // ui::LayerAnimationElement: - void OnStart(ui::LayerAnimationDelegate* delegate) override {} - bool OnProgress(double current, - ui::LayerAnimationDelegate* delegate) override { - const double progress = gfx::Tween::CalculateValue(tween_type_, current); - delegate->SetTransformFromAnimation( - transform_->Interpolate(progress), - ui::PropertyChangeReason::FROM_ANIMATION); - - // Update child views' layout at each animation frame because child views' - // padding changes along with the app list view's bounds. - view_->app_list_main_view()->contents_view()->UpdateYPositionAndOpacity(); - - return true; - } - void OnGetTarget(TargetValue* target) const override {} - void OnAbort(ui::LayerAnimationDelegate* delegate) override {} - - private: - std::unique_ptr<ui::InterpolatedTransform> transform_; - AppListView* view_; - gfx::Tween::Type tween_type_; - - DISALLOW_COPY_AND_ASSIGN(AppListAnimation); -}; - //////////////////////////////////////////////////////////////////////////////// // AppListView::TestApi @@ -1382,8 +1338,7 @@ ui::Layer* layer = fullscreen_widget_->GetLayer(); layer->SetBounds(target_bounds); gfx::Transform transform; - const int y_offset = original_state_y - target_state_y; - transform.Translate(0, y_offset); + transform.Translate(0, original_state_y - target_state_y); layer->SetTransform(transform); ui::LayerAnimator* animator = layer->GetAnimator(); @@ -1397,11 +1352,12 @@ settings.SetAnimationMetricsReporter(state_animation_metrics_reporter_.get()); settings.AddObserver(transition_animation_observer_.get()); - animator->StartAnimation( - new ui::LayerAnimationSequence(std::make_unique<AppListAnimation>( - gfx::PointF(0, y_offset), gfx::PointF(), - base::TimeDelta::FromMilliseconds(animation_duration), - gfx::Tween::EASE_OUT, this))); + layer->SetTransform(gfx::Transform()); + + // In transition animation, layout is only performed after it is complete, + // which makes the child views jump. So update y positions in advance here to + // avoid that. + app_list_main_view_->contents_view()->UpdateYPositionAndOpacity(); } void AppListView::StartCloseAnimation(base::TimeDelta animation_duration) {
diff --git a/ash/display/display_prefs.cc b/ash/display/display_prefs.cc index 9f7d61f..8d1c3d6 100644 --- a/ash/display/display_prefs.cc +++ b/ash/display/display_prefs.cc
@@ -929,6 +929,14 @@ LoadDisplayRotationState(local_state); LoadDisplayTouchAssociations(local_state); + // Now that the display prefs have been loaded, request to reconfigure the + // displays, but signal the display manager to restore the mirror state of + // external displays from the loaded prefs (if any). + Shell::Get() + ->display_manager() + ->set_should_restore_mirror_mode_from_display_prefs(true); + Shell::Get()->display_configurator()->OnConfigurationChanged(); + // Ensure that we have a reasonable initial display power state if // powerd fails to send us one over D-Bus. Otherwise, we won't restore // displays correctly after retaking control when changing virtual terminals.
diff --git a/ash/display/display_prefs_unittest.cc b/ash/display/display_prefs_unittest.cc index fcb4eb6..523c551 100644 --- a/ash/display/display_prefs_unittest.cc +++ b/ash/display/display_prefs_unittest.cc
@@ -1368,6 +1368,44 @@ EXPECT_EQ(0U, pref_external_display_mirror_info->GetSize()); } +TEST_F(DisplayPrefsTest, ExternalDisplayConnectedBeforeLoadingPrefs) { + LoggedInAsUser(); + + base::CommandLine::ForCurrentProcess()->AppendSwitch( + chromeos::switches::kFirstExecAfterBoot); + + const int64_t internal_display_id = + display::test::DisplayManagerTestApi(display_manager()) + .SetFirstDisplayAsInternalDisplay(); + constexpr int64_t external_display_id = 210000001; + display::ManagedDisplayInfo external_display_info = + display::CreateDisplayInfo(external_display_id, + gfx::Rect(1, 1, 500, 500)); + + // Both internal and external displays connect before the prefs are loaded. + std::vector<display::ManagedDisplayInfo> display_info_list; + display_info_list.push_back(display::CreateDisplayInfo( + internal_display_id, gfx::Rect(0, 0, 100, 100))); + display_info_list.push_back(external_display_info); + display_manager()->OnNativeDisplaysChanged(display_info_list); + + EXPECT_FALSE(display_manager()->IsInMirrorMode()); + EXPECT_EQ(2u, display_manager()->num_connected_displays()); + + // Add external display id to the external display mirror info. + std::set<int64_t> external_display_mirror_info; + const int64_t external_display_masked_id = + display::GetDisplayIdWithoutOutputIndex(external_display_id); + external_display_mirror_info.emplace(external_display_masked_id); + StoreExternalDisplayMirrorInfo(external_display_mirror_info); + + // Load the preferences and simulate a native display reconfiguration. Expect + // that we are mirroring now. + LoadDisplayPreferences(); + display_manager()->OnNativeDisplaysChanged(display_info_list); + EXPECT_TRUE(display_manager()->IsInMirrorMode()); +} + TEST_F(DisplayPrefsTest, DisplayMixedMirrorMode) { LoggedInAsUser();
diff --git a/ash/media/media_notification_background.cc b/ash/media/media_notification_background.cc index 57eb40d..cc5ce7b 100644 --- a/ash/media/media_notification_background.cc +++ b/ash/media/media_notification_background.cc
@@ -145,8 +145,8 @@ const SkColor colors[2] = { background_color, SkColorSetA(background_color, SK_AlphaTRANSPARENT)}; - const SkPoint points[2] = {gfx::PointToSkPoint(draw_bounds.left_center()), - gfx::PointToSkPoint(draw_bounds.right_center())}; + const SkPoint points[2] = {GetGradientStartPoint(draw_bounds), + GetGradientEndPoint(draw_bounds)}; cc::PaintFlags flags; flags.setAntiAlias(true); @@ -211,7 +211,8 @@ // The artwork should be positioned on the far right hand side of the // notification and be the same height. - return gfx::Rect(view_bounds.right() - width, 0, width, view_bounds.height()); + return owner_->GetMirroredRect( + gfx::Rect(view_bounds.right() - width, 0, width, view_bounds.height())); } gfx::Rect MediaNotificationBackground::GetFilledBackgroundBounds( @@ -220,7 +221,7 @@ // taken up by the artwork. gfx::Rect bounds = gfx::Rect(view_bounds); bounds.Inset(0, 0, GetArtworkVisibleWidth(view_bounds.size()), 0); - return bounds; + return owner_->GetMirroredRect(bounds); } gfx::Rect MediaNotificationBackground::GetGradientBounds( @@ -229,9 +230,21 @@ return gfx::Rect(0, 0, 0, 0); // The gradient should appear above the artwork on the left. - gfx::Rect filled_bounds = GetFilledBackgroundBounds(view_bounds); - return gfx::Rect(filled_bounds.right(), view_bounds.y(), - kMediaImageGradientWidth, view_bounds.height()); + return owner_->GetMirroredRect(gfx::Rect( + view_bounds.width() - GetArtworkVisibleWidth(view_bounds.size()), + view_bounds.y(), kMediaImageGradientWidth, view_bounds.height())); +} + +SkPoint MediaNotificationBackground::GetGradientStartPoint( + const gfx::Rect& draw_bounds) const { + return gfx::PointToSkPoint(base::i18n::IsRTL() ? draw_bounds.right_center() + : draw_bounds.left_center()); +} + +SkPoint MediaNotificationBackground::GetGradientEndPoint( + const gfx::Rect& draw_bounds) const { + return gfx::PointToSkPoint(base::i18n::IsRTL() ? draw_bounds.left_center() + : draw_bounds.right_center()); } } // namespace ash
diff --git a/ash/media/media_notification_background.h b/ash/media/media_notification_background.h index 60858e5e..2be74b4 100644 --- a/ash/media/media_notification_background.h +++ b/ash/media/media_notification_background.h
@@ -42,13 +42,16 @@ private: friend class MediaNotificationBackgroundTest; friend class MediaNotificationViewTest; - FRIEND_TEST_ALL_PREFIXES(MediaNotificationBackgroundTest, BoundsSanityCheck); + FRIEND_TEST_ALL_PREFIXES(MediaNotificationBackgroundRTLTest, + BoundsSanityCheck); int GetArtworkWidth(const gfx::Size& view_size) const; int GetArtworkVisibleWidth(const gfx::Size& view_size) const; gfx::Rect GetArtworkBounds(const gfx::Rect& view_bounds) const; gfx::Rect GetFilledBackgroundBounds(const gfx::Rect& view_bounds) const; gfx::Rect GetGradientBounds(const gfx::Rect& view_bounds) const; + SkPoint GetGradientStartPoint(const gfx::Rect& draw_bounds) const; + SkPoint GetGradientEndPoint(const gfx::Rect& draw_bounds) const; // Reference to the owning view that this is a background for. views::View* owner_;
diff --git a/ash/media/media_notification_background_unittest.cc b/ash/media/media_notification_background_unittest.cc index 4025ab4..d811344 100644 --- a/ash/media/media_notification_background_unittest.cc +++ b/ash/media/media_notification_background_unittest.cc
@@ -7,6 +7,9 @@ #include <memory> #include "ash/test/ash_test_base.h" +#include "base/i18n/base_i18n_switches.h" +#include "base/test/icu_test_util.h" +#include "base/test/scoped_command_line.h" #include "ui/views/test/test_views.h" namespace ash { @@ -83,44 +86,6 @@ DISALLOW_COPY_AND_ASSIGN(MediaNotificationBackgroundTest); }; -TEST_F(MediaNotificationBackgroundTest, BoundsSanityCheck) { - // The test notification will have a width of 200 and a height of 50. - gfx::Rect bounds(0, 0, 200, 50); - - // Check the artwork is not visible by default. - EXPECT_EQ(0, background()->GetArtworkWidth(bounds.size())); - EXPECT_EQ(0, background()->GetArtworkVisibleWidth(bounds.size())); - EXPECT_EQ(gfx::Rect(200, 0, 0, 50), background()->GetArtworkBounds(bounds)); - EXPECT_EQ(gfx::Rect(0, 0, 200, 50), - background()->GetFilledBackgroundBounds(bounds)); - EXPECT_EQ(gfx::Rect(0, 0, 0, 0), background()->GetGradientBounds(bounds)); - - // The background artwork image will have an aspect ratio of 2:1. - SkBitmap bitmap; - bitmap.allocN32Pixels(20, 10); - bitmap.eraseColor(SK_ColorWHITE); - background()->UpdateArtwork(gfx::ImageSkia::CreateFrom1xBitmap(bitmap)); - - // The artwork width will be 2x the height of the notification and the visible - // width will be limited to 10% the width of the notification. - EXPECT_EQ(100, background()->GetArtworkWidth(bounds.size())); - EXPECT_EQ(20, background()->GetArtworkVisibleWidth(bounds.size())); - - // Update the visible width % to be greater than the width of the image. - background()->UpdateArtworkMaxWidthPct(0.6); - EXPECT_EQ(100, background()->GetArtworkVisibleWidth(bounds.size())); - - // Check the artwork is positioned to the right. - EXPECT_EQ(gfx::Rect(100, 0, 100, 50), background()->GetArtworkBounds(bounds)); - - // Check the filled background is to the left of the image. - EXPECT_EQ(gfx::Rect(0, 0, 100, 50), - background()->GetFilledBackgroundBounds(bounds)); - - // Check the gradient is positioned above the artwork. - EXPECT_EQ(gfx::Rect(100, 0, 40, 50), background()->GetGradientBounds(bounds)); -} - // If we have no artwork then we should use the default background color. TEST_F(MediaNotificationBackgroundTest, DeriveBackgroundColor_NoArtwork) { background()->UpdateArtwork(gfx::ImageSkia()); @@ -180,4 +145,79 @@ EXPECT_EQ(kTestColor, GetBackgroundColor()); } +// MediaNotificationBackgroundRTLTest will repeat these tests with RTL disabled +// and enabled. +class MediaNotificationBackgroundRTLTest + : public MediaNotificationBackgroundTest, + public testing::WithParamInterface<bool> { + public: + void SetUp() override { + command_line_.GetProcessCommandLine()->AppendSwitchASCII( + switches::kForceUIDirection, GetParam() ? switches::kForceDirectionRTL + : switches::kForceDirectionLTR); + + MediaNotificationBackgroundTest::SetUp(); + } + + bool IsRTL() const { return GetParam(); } + + private: + base::test::ScopedRestoreICUDefaultLocale scoped_locale_; + base::test::ScopedCommandLine command_line_; +}; + +INSTANTIATE_TEST_SUITE_P(, MediaNotificationBackgroundRTLTest, testing::Bool()); + +TEST_P(MediaNotificationBackgroundRTLTest, BoundsSanityCheck) { + // The test notification will have a width of 200 and a height of 50. + gfx::Rect bounds(0, 0, 200, 50); + + // Check the artwork is not visible by default. + EXPECT_EQ(0, background()->GetArtworkWidth(bounds.size())); + EXPECT_EQ(0, background()->GetArtworkVisibleWidth(bounds.size())); + EXPECT_EQ(gfx::Rect(IsRTL() ? -200 : 200, 0, 0, 50), + background()->GetArtworkBounds(bounds)); + EXPECT_EQ(gfx::Rect(IsRTL() ? -200 : 0, 0, 200, 50), + background()->GetFilledBackgroundBounds(bounds)); + EXPECT_EQ(gfx::Rect(0, 0, 0, 0), background()->GetGradientBounds(bounds)); + + // The background artwork image will have an aspect ratio of 2:1. + SkBitmap bitmap; + bitmap.allocN32Pixels(20, 10); + bitmap.eraseColor(SK_ColorWHITE); + background()->UpdateArtwork(gfx::ImageSkia::CreateFrom1xBitmap(bitmap)); + + // The artwork width will be 2x the height of the notification and the visible + // width will be limited to 10% the width of the notification. + EXPECT_EQ(100, background()->GetArtworkWidth(bounds.size())); + EXPECT_EQ(20, background()->GetArtworkVisibleWidth(bounds.size())); + + // Update the visible width % to be greater than the width of the image. + background()->UpdateArtworkMaxWidthPct(0.6); + EXPECT_EQ(100, background()->GetArtworkVisibleWidth(bounds.size())); + + // Check the artwork is positioned to the right. + EXPECT_EQ(gfx::Rect(IsRTL() ? -200 : 100, 0, 100, 50), + background()->GetArtworkBounds(bounds)); + + // Check the filled background is to the left of the image. + EXPECT_EQ(gfx::Rect(IsRTL() ? -100 : 0, 0, 100, 50), + background()->GetFilledBackgroundBounds(bounds)); + + // Check the gradient is positioned above the artwork. + const gfx::Rect gradient_bounds = background()->GetGradientBounds(bounds); + EXPECT_EQ(gfx::Rect(IsRTL() ? -140 : 100, 0, 40, 50), gradient_bounds); + + // Check the gradient point X-values are the start and end of + // |gradient_bounds|. + EXPECT_EQ(IsRTL() ? -100 : 100, + background()->GetGradientStartPoint(gradient_bounds).x()); + EXPECT_EQ(IsRTL() ? -140 : 140, + background()->GetGradientEndPoint(gradient_bounds).x()); + + // Check both of the gradient point Y-values are half the height. + EXPECT_EQ(25, background()->GetGradientStartPoint(gradient_bounds).y()); + EXPECT_EQ(25, background()->GetGradientEndPoint(gradient_bounds).y()); +} + } // namespace ash
diff --git a/ash/wm/overview/caption_container_view.cc b/ash/wm/overview/caption_container_view.cc index 2c0964a..427f531 100644 --- a/ash/wm/overview/caption_container_view.cc +++ b/ash/wm/overview/caption_container_view.cc
@@ -5,12 +5,9 @@ #include "ash/wm/overview/caption_container_view.h" #include "ash/resources/vector_icons/vector_icons.h" -#include "ash/strings/grit/ash_strings.h" #include "ash/wm/overview/overview_constants.h" #include "ash/wm/overview/rounded_rect_view.h" #include "ash/wm/overview/scoped_overview_animation_settings.h" -#include "ash/wm/splitview/split_view_constants.h" -#include "ash/wm/splitview/split_view_utils.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" @@ -180,30 +177,6 @@ CaptionContainerView::~CaptionContainerView() = default; -RoundedRectView* CaptionContainerView::GetCannotSnapContainer() { - if (!cannot_snap_container_) { - cannot_snap_label_ = new views::Label( - l10n_util::GetStringUTF16(IDS_ASH_SPLIT_VIEW_CANNOT_SNAP)); - cannot_snap_label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); - cannot_snap_label_->SetAutoColorReadabilityEnabled(false); - cannot_snap_label_->SetEnabledColor(kSplitviewLabelEnabledColor); - cannot_snap_label_->SetBackgroundColor(kSplitviewLabelBackgroundColor); - - cannot_snap_container_ = new RoundedRectView( - kSplitviewLabelRoundRectRadiusDp, kSplitviewLabelBackgroundColor); - cannot_snap_container_->SetLayoutManager(std::make_unique<views::BoxLayout>( - views::BoxLayout::kVertical, - gfx::Insets(kSplitviewLabelVerticalInsetDp, - kSplitviewLabelHorizontalInsetDp))); - cannot_snap_container_->AddChildView(cannot_snap_label_); - cannot_snap_container_->set_can_process_events_within_subtree(false); - AddChildWithLayer(this, cannot_snap_container_); - cannot_snap_container_->layer()->SetOpacity(0.f); - Layout(); - } - return cannot_snap_container_; -} - void CaptionContainerView::SetHeaderVisibility(HeaderVisibility visibility) { DCHECK(close_button_->layer()); DCHECK(header_view_->layer()); @@ -232,16 +205,6 @@ backdrop_view_->SetVisible(visible); } -void CaptionContainerView::SetCannotSnapLabelVisibility(bool visible) { - if (!cannot_snap_container_ && !visible) - return; - - DoSplitviewOpacityAnimation(GetCannotSnapContainer()->layer(), - visible - ? SPLITVIEW_ANIMATION_OVERVIEW_ITEM_FADE_IN - : SPLITVIEW_ANIMATION_OVERVIEW_ITEM_FADE_OUT); -} - void CaptionContainerView::ResetEventDelegate() { event_delegate_ = nullptr; close_button_->ResetEventDelegate(); @@ -267,22 +230,6 @@ backdrop_view_->SetBoundsRect(backdrop_bounds); } - if (cannot_snap_container_) { - gfx::Size label_size = cannot_snap_label_->CalculatePreferredSize(); - label_size.set_width( - std::min(label_size.width() + 2 * kSplitviewLabelHorizontalInsetDp, - bounds.width() - 2 * kSplitviewLabelHorizontalInsetDp)); - label_size.set_height( - std::max(label_size.height(), kSplitviewLabelPreferredHeightDp)); - - // Position the cannot snap label in the middle of the item, minus the - // title. - gfx::Rect cannot_snap_bounds = GetLocalBounds(); - cannot_snap_bounds.Inset(0, visible_height, 0, 0); - cannot_snap_bounds.ClampToCenteredSize(label_size); - cannot_snap_container_->SetBoundsRect(cannot_snap_bounds); - } - // Position the header at the top. const gfx::Rect header_bounds(kOverviewMargin, kOverviewMargin, GetLocalBounds().width() - kOverviewMargin,
diff --git a/ash/wm/overview/caption_container_view.h b/ash/wm/overview/caption_container_view.h index 582e68bd..2fc984c 100644 --- a/ash/wm/overview/caption_container_view.h +++ b/ash/wm/overview/caption_container_view.h
@@ -65,18 +65,11 @@ CaptionContainerView(EventDelegate* event_delegate, aura::Window* window); ~CaptionContainerView() override; - // Returns |cannot_snap_container_|. This will create it if it has not been - // already created. - RoundedRectView* GetCannotSnapContainer(); - void SetHeaderVisibility(HeaderVisibility visibility); // Sets the visiblity of |backdrop_view_|. Creates it if it is null. void SetBackdropVisibility(bool visible); - // Animates |cannot_snap_container_| to its visibility state. - void SetCannotSnapLabelVisibility(bool visible); - void ResetEventDelegate(); // Set the title of the view, and also updates the accessiblity name. @@ -86,7 +79,6 @@ views::View* header_view() { return header_view_; } views::Label* title_label() { return title_label_; } - views::Label* cannot_snap_label() { return cannot_snap_label_; } RoundedRectView* backdrop_view() { return backdrop_view_; } protected: @@ -117,13 +109,6 @@ views::ImageView* image_view_ = nullptr; OverviewCloseButton* close_button_ = nullptr; - // A text label in the center of the window warning users that - // this window cannot be snapped for splitview. - views::Label* cannot_snap_label_ = nullptr; - // Use |cannot_snap_container_| to specify the padding surrounding - // |cannot_snap_label_| and to give the label rounded corners. - RoundedRectView* cannot_snap_container_ = nullptr; - // A view that covers the area except the header. It is null when the window // associated is not pillar or letter boxed. RoundedRectView* backdrop_view_ = nullptr;
diff --git a/ash/wm/overview/drop_target_view.cc b/ash/wm/overview/drop_target_view.cc index a07aae2..20c5397 100644 --- a/ash/wm/overview/drop_target_view.cc +++ b/ash/wm/overview/drop_target_view.cc
@@ -50,6 +50,11 @@ background_view_->SetPaintToLayer(ui::LAYER_SOLID_COLOR); background_view_->layer()->SetColor(kDropTargetBackgroundColor); background_view_->layer()->SetOpacity(kDropTargetBackgroundOpacity); + const std::array<uint32_t, 4> kRadii = { + kOverviewWindowRoundingDp, kOverviewWindowRoundingDp, + kOverviewWindowRoundingDp, kOverviewWindowRoundingDp}; + background_view_->layer()->SetRoundedCornerRadius(kRadii); + background_view_->layer()->SetIsFastRoundedCorner(true); AddChildView(background_view_); if (has_plus_icon) {
diff --git a/ash/wm/overview/overview_item.cc b/ash/wm/overview/overview_item.cc index 8f4e90b9..5b5cdb3 100644 --- a/ash/wm/overview/overview_item.cc +++ b/ash/wm/overview/overview_item.cc
@@ -8,18 +8,22 @@ #include <vector> #include "ash/public/cpp/ash_features.h" +#include "ash/public/cpp/shell_window_ids.h" #include "ash/public/cpp/window_properties.h" #include "ash/scoped_animation_disabler.h" #include "ash/shell.h" +#include "ash/strings/grit/ash_strings.h" #include "ash/wm/overview/overview_animation_type.h" #include "ash/wm/overview/overview_constants.h" #include "ash/wm/overview/overview_controller.h" #include "ash/wm/overview/overview_grid.h" #include "ash/wm/overview/overview_utils.h" #include "ash/wm/overview/overview_window_drag_controller.h" +#include "ash/wm/overview/rounded_label_widget.h" #include "ash/wm/overview/scoped_overview_animation_settings.h" #include "ash/wm/overview/scoped_overview_transform_window.h" #include "ash/wm/overview/start_animation_observer.h" +#include "ash/wm/splitview/split_view_constants.h" #include "ash/wm/splitview/split_view_utils.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/window_state.h" @@ -287,6 +291,13 @@ // and UpdateHeaderLayout. Do not apply the shadow for drop target. if (new_animation_type == OVERVIEW_ANIMATION_NONE) UpdateMaskAndShadow(); + + if (cannot_snap_widget_) { + ScopedOverviewAnimationSettings settings( + new_animation_type, cannot_snap_widget_->GetNativeWindow()); + cannot_snap_widget_->SetBoundsCenteredIn( + gfx::ToEnclosingRect(inset_bounds)); + } } void OverviewItem::SendAccessibleSelectionEvent() { @@ -345,17 +356,43 @@ void OverviewItem::UpdateCannotSnapWarningVisibility() { // Windows which can snap will never show this warning. Or if the window is // the drop target window, also do not show this warning. + bool visible = true; if (CanSnapInSplitview(GetWindow()) || overview_grid_->IsDropTargetWindow(GetWindow())) { - caption_container_view_->SetCannotSnapLabelVisibility(false); - return; + visible = false; + } else { + const SplitViewController::State state = + Shell::Get()->split_view_controller()->state(); + visible = state == SplitViewController::LEFT_SNAPPED || + state == SplitViewController::RIGHT_SNAPPED; } - const SplitViewController::State state = - Shell::Get()->split_view_controller()->state(); - const bool visible = state == SplitViewController::LEFT_SNAPPED || - state == SplitViewController::RIGHT_SNAPPED; - caption_container_view_->SetCannotSnapLabelVisibility(visible); + if (!visible && !cannot_snap_widget_) + return; + + if (!cannot_snap_widget_) { + RoundedLabelWidget::InitParams params; + params.horizontal_padding = kSplitviewLabelHorizontalInsetDp; + params.vertical_padding = kSplitviewLabelVerticalInsetDp; + params.background_color = kSplitviewLabelBackgroundColor; + params.foreground_color = kSplitviewLabelEnabledColor; + params.rounding_dp = kSplitviewLabelRoundRectRadiusDp; + params.preferred_height = kSplitviewLabelPreferredHeightDp; + params.message_id = IDS_ASH_SPLIT_VIEW_CANNOT_SNAP; + params.parent = + root_window()->GetChildById(kShellWindowId_AlwaysOnTopContainer); + cannot_snap_widget_ = std::make_unique<RoundedLabelWidget>(); + cannot_snap_widget_->Init(params); + } + + DoSplitviewOpacityAnimation(cannot_snap_widget_->GetNativeWindow()->layer(), + visible + ? SPLITVIEW_ANIMATION_OVERVIEW_ITEM_FADE_IN + : SPLITVIEW_ANIMATION_OVERVIEW_ITEM_FADE_OUT); + gfx::Rect bounds = gfx::ToEnclosingRect(target_bounds()); + bounds.Inset(kWindowMargin, kWindowMargin); + bounds.Inset(gfx::Insets(0, kHeaderHeightDp, 0, 0)); + cannot_snap_widget_->SetBoundsCenteredIn(bounds); } void OverviewItem::OnSelectorItemDragStarted(OverviewItem* item) { @@ -537,6 +574,7 @@ GetWindowDimensionsType() != ScopedOverviewTransformWindow::GridWindowFillMode::kNormal; caption_container_view_->SetBackdropVisibility(show_backdrop); + UpdateCannotSnapWarningVisibility(); } void OverviewItem::SetOpacity(float opacity) { @@ -757,7 +795,6 @@ item_widget_->GetLayer()->Add(shadow_->layer()); caption_container_view_ = new CaptionContainerView(this, GetWindow()); - UpdateCannotSnapWarningVisibility(); item_widget_->SetContentsView(caption_container_view_); item_widget_->Show(); item_widget_->SetOpacity(0);
diff --git a/ash/wm/overview/overview_item.h b/ash/wm/overview/overview_item.h index 5a5bd73..ef1539f 100644 --- a/ash/wm/overview/overview_item.h +++ b/ash/wm/overview/overview_item.h
@@ -28,6 +28,7 @@ namespace ash { class OverviewGrid; +class RoundedLabelWidget; // This class represents an item in overview mode. class ASH_EXPORT OverviewItem : public CaptionContainerView::EventDelegate, @@ -234,6 +235,9 @@ float GetCloseButtonVisibilityForTesting() const; float GetTitlebarOpacityForTesting() const; gfx::Rect GetShadowBoundsForTesting(); + RoundedLabelWidget* cannot_snap_widget_for_testing() { + return cannot_snap_widget_.get(); + } private: friend class OverviewSessionTest; @@ -283,18 +287,19 @@ // when the item is selected. bool selected_ = false; - // A widget that covers the |transform_window_|. The widget has + // A widget stacked under the |transform_window_|. The widget has // |caption_container_view_| as its contents view. The widget is backed by a // NOT_DRAWN layer since most of its surface is transparent. std::unique_ptr<views::Widget> item_widget_; - // Container view that owns a Button view covering the |transform_window_|. - // That button serves as an event shield to receive all events such as clicks - // targeting the |transform_window_| or the overview header above the window. - // The shield button owns a header view which shows an icon, close button and - // title. + // The view associated with |item_widget_|. Contains a title, close button and + // maybe a backdrop. Forwards certain events to |this|. CaptionContainerView* caption_container_view_ = nullptr; + // A widget with text that may show up on top of |transform_window_| to notify + // users this window cannot be snapped. + std::unique_ptr<RoundedLabelWidget> cannot_snap_widget_; + // Pointer to the Overview that owns the OverviewGrid containing |this|. // Guaranteed to be non-null for the lifetime of |this|. OverviewSession* overview_session_;
diff --git a/ash/wm/overview/overview_session.cc b/ash/wm/overview/overview_session.cc index d015bd5..34949b42 100644 --- a/ash/wm/overview/overview_session.cc +++ b/ash/wm/overview/overview_session.cc
@@ -23,6 +23,7 @@ #include "ash/wm/overview/overview_item.h" #include "ash/wm/overview/overview_utils.h" #include "ash/wm/overview/overview_window_drag_controller.h" +#include "ash/wm/overview/rounded_label_widget.h" #include "ash/wm/overview/scoped_overview_animation_settings.h" #include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/splitview/split_view_drag_indicators.h" @@ -36,13 +37,9 @@ #include "base/threading/thread_task_runner_handle.h" #include "ui/accessibility/ax_enums.mojom.h" #include "ui/base/hit_test.h" -#include "ui/base/l10n/l10n_util.h" #include "ui/compositor/layer.h" -#include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/display/screen.h" #include "ui/events/event.h" -#include "ui/views/controls/label.h" -#include "ui/views/layout/box_layout.h" #include "ui/views/widget/widget.h" #include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/window_util.h" @@ -162,49 +159,6 @@ } // namespace -// A label with rounded corners that is displayed when we enter overview with no -// windows. -class OverviewSession::NoWindowsView : public views::View { - public: - NoWindowsView() { - SetLayoutManager(std::make_unique<views::BoxLayout>( - views::BoxLayout::kVertical, - gfx::Insets(kNoItemsIndicatorVerticalPaddingDp, - kNoItemsIndicatorHorizontalPaddingDp))); - SetPaintToLayer(ui::LAYER_SOLID_COLOR); - layer()->SetColor(kNoItemsIndicatorBackgroundColor); - layer()->SetFillsBoundsOpaquely(false); - - const std::array<uint32_t, 4> kRadii = { - kNoItemsIndicatorRoundingDp, kNoItemsIndicatorRoundingDp, - kNoItemsIndicatorRoundingDp, kNoItemsIndicatorRoundingDp}; - layer()->SetRoundedCornerRadius(kRadii); - layer()->SetIsFastRoundedCorner(true); - - label_ = new views::Label( - l10n_util::GetStringUTF16(IDS_ASH_OVERVIEW_NO_RECENT_ITEMS), - views::style::CONTEXT_LABEL); - label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); - label_->SetEnabledColor(kNoItemsIndicatorTextColor); - label_->SetBackgroundColor(kNoItemsIndicatorBackgroundColor); - label_->SetPaintToLayer(); - label_->layer()->SetFillsBoundsOpaquely(false); - AddChildView(label_); - } - ~NoWindowsView() override = default; - - // views::View: - gfx::Size GetPreferredSize() { - int width = label_->GetPreferredSize().width() + - 2 * kNoItemsIndicatorHorizontalPaddingDp; - return gfx::Size(width, kNoItemsIndicatorHeightDp); - } - - private: - views::Label* label_ = nullptr; // Owned by views hierarchy. - DISALLOW_COPY_AND_ASSIGN(NoWindowsView); -}; - OverviewSession::OverviewSession(OverviewDelegate* delegate) : delegate_(delegate), restore_focus_window_(wm::GetFocusedWindow()), @@ -982,14 +936,23 @@ if (!no_windows_widget_) { // Create and fade in the widget. - no_windows_widget_ = CreateBackgroundWidget( - Shell::GetPrimaryRootWindow(), ui::LAYER_NOT_DRAWN, SK_ColorTRANSPARENT, - 0, 0, SK_ColorTRANSPARENT, 0.f, nullptr, true, false); + RoundedLabelWidget::InitParams params; + params.horizontal_padding = kNoItemsIndicatorHorizontalPaddingDp; + params.vertical_padding = kNoItemsIndicatorVerticalPaddingDp; + params.background_color = kNoItemsIndicatorBackgroundColor; + params.foreground_color = kNoItemsIndicatorTextColor; + params.rounding_dp = kNoItemsIndicatorRoundingDp; + params.preferred_height = kNoItemsIndicatorHeightDp; + params.message_id = IDS_ASH_OVERVIEW_NO_RECENT_ITEMS; + params.parent = Shell::GetPrimaryRootWindow()->GetChildById( + kShellWindowId_AlwaysOnTopContainer); + no_windows_widget_ = std::make_unique<RoundedLabelWidget>(); + no_windows_widget_->Init(params); + aura::Window* widget_window = no_windows_widget_->GetNativeWindow(); - widget_window->SetName("OverviewNoWindowsLabel"); - no_windows_widget_->SetContentsView(new NoWindowsView()); ScopedOverviewAnimationSettings settings(OVERVIEW_ANIMATION_NO_RECENTS_FADE, widget_window); + widget_window->SetName("OverviewNoWindowsLabel"); no_windows_widget_->SetOpacity(1.f); } @@ -1008,11 +971,7 @@ window, SplitViewController::LEFT); } - NoWindowsView* content_view = - static_cast<NoWindowsView*>(no_windows_widget_->GetContentsView()); - DCHECK(content_view); - bounds.ClampToCenteredSize(content_view->GetPreferredSize()); - window->SetBounds(bounds); + no_windows_widget_->SetBoundsCenteredIn(bounds); } } // namespace ash
diff --git a/ash/wm/overview/overview_session.h b/ash/wm/overview/overview_session.h index c299fa4..7eb9cf5d 100644 --- a/ash/wm/overview/overview_session.h +++ b/ash/wm/overview/overview_session.h
@@ -36,11 +36,11 @@ } // namespace views namespace ash { - class OverviewDelegate; class OverviewGrid; class OverviewItem; class OverviewWindowDragController; +class RoundedLabelWidget; class SplitViewDragIndicators; enum class IndicatorState; @@ -252,7 +252,7 @@ size_t num_items_for_testing() const { return num_items_; } - views::Widget* no_windows_widget_for_testing() { + RoundedLabelWidget* no_windows_widget_for_testing() { return no_windows_widget_.get(); } @@ -274,7 +274,6 @@ void OnSplitViewDividerPositionChanged() override; private: - class NoWindowsView; friend class OverviewSessionTest; // |focus|, restores focus to the stored window. @@ -316,7 +315,7 @@ std::unique_ptr<views::Widget> overview_focus_widget_; // A widget that is shown if we entered overview without any windows opened. - std::unique_ptr<views::Widget> no_windows_widget_; + std::unique_ptr<RoundedLabelWidget> no_windows_widget_; // True when performing operations that may cause window activations. This is // used to prevent handling the resulting expected activation. This is
diff --git a/ash/wm/overview/overview_session_unittest.cc b/ash/wm/overview/overview_session_unittest.cc index 3c1967e..a47af5a 100644 --- a/ash/wm/overview/overview_session_unittest.cc +++ b/ash/wm/overview/overview_session_unittest.cc
@@ -32,6 +32,7 @@ #include "ash/wm/overview/overview_session.h" #include "ash/wm/overview/overview_utils.h" #include "ash/wm/overview/overview_window_drag_controller.h" +#include "ash/wm/overview/rounded_label_widget.h" #include "ash/wm/overview/rounded_rect_view.h" #include "ash/wm/splitview/split_view_controller.h" #include "ash/wm/splitview/split_view_divider.h" @@ -293,10 +294,6 @@ return item->caption_container_view_->title_label(); } - views::Label* GetCannotSnapLabelView(OverviewItem* item) { - return item->caption_container_view_->cannot_snap_label(); - } - RoundedRectView* GetBackdropView(OverviewItem* item) { return item->caption_container_view_->backdrop_view(); } @@ -1651,7 +1648,7 @@ ToggleOverview(); ASSERT_TRUE(overview_session()); - views::Widget* no_windows_widget = + RoundedLabelWidget* no_windows_widget = overview_session()->no_windows_widget_for_testing(); ASSERT_TRUE(no_windows_widget); @@ -1679,7 +1676,7 @@ ToggleOverview(); ASSERT_TRUE(overview_session()); - views::Widget* no_windows_widget = + RoundedLabelWidget* no_windows_widget = overview_session()->no_windows_widget_for_testing(); EXPECT_FALSE(no_windows_widget); @@ -1715,7 +1712,7 @@ // primary display. ToggleOverview(); ASSERT_TRUE(overview_session()); - views::Widget* no_windows_widget = + RoundedLabelWidget* no_windows_widget = overview_session()->no_windows_widget_for_testing(); const int expected_y = (400 - ShelfConstants::shelf_size()) / 2; EXPECT_EQ(gfx::Point(200, expected_y), @@ -3734,17 +3731,18 @@ GetWindowItemForWindow(grid_index, unsnappable_window.get()); // Note: |cannot_snap_label_view_| and its parent will be created on demand. - EXPECT_FALSE(GetCannotSnapLabelView(snappable_overview_item)); - ASSERT_FALSE(GetCannotSnapLabelView(unsnappable_overview_item)); + EXPECT_FALSE(snappable_overview_item->cannot_snap_widget_for_testing()); + ASSERT_FALSE(unsnappable_overview_item->cannot_snap_widget_for_testing()); // Snap the extra snappable window to enter split view mode. split_view_controller()->SnapWindow(window1.get(), SplitViewController::LEFT); ASSERT_TRUE(split_view_controller()->IsSplitViewModeActive()); - EXPECT_FALSE(GetCannotSnapLabelView(snappable_overview_item)); - ASSERT_TRUE(GetCannotSnapLabelView(unsnappable_overview_item)); - ASSERT_TRUE(GetCannotSnapLabelView(unsnappable_overview_item)->parent()); + EXPECT_FALSE(snappable_overview_item->cannot_snap_widget_for_testing()); + ASSERT_TRUE(unsnappable_overview_item->cannot_snap_widget_for_testing()); ui::Layer* unsnappable_layer = - GetCannotSnapLabelView(unsnappable_overview_item)->parent()->layer(); + unsnappable_overview_item->cannot_snap_widget_for_testing() + ->GetNativeWindow() + ->layer(); EXPECT_EQ(1.f, unsnappable_layer->opacity()); // Exiting the splitview will hide the unsnappable label.
diff --git a/ash/wm/overview/rounded_label_widget.cc b/ash/wm/overview/rounded_label_widget.cc new file mode 100644 index 0000000..26fd0fa --- /dev/null +++ b/ash/wm/overview/rounded_label_widget.cc
@@ -0,0 +1,103 @@ +// 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/wm/overview/rounded_label_widget.h" + +#include "ui/aura/window.h" +#include "ui/base/l10n/l10n_util.h" +#include "ui/compositor/layer.h" +#include "ui/views/controls/label.h" +#include "ui/views/layout/box_layout.h" + +namespace ash { + +namespace { + +// The contents of RoundedLabelWidget. It is a rounded background with a label +// containing text we want to display. +class RoundedLabelView : public views::View { + public: + RoundedLabelView(int horizontal_padding, + int vertical_padding, + SkColor background_color, + SkColor foreground_color, + int rounding_dp, + int preferred_height, + int message_id) + : horizontal_padding_(horizontal_padding), + preferred_height_(preferred_height) { + SetLayoutManager(std::make_unique<views::BoxLayout>( + views::BoxLayout::kVertical, + gfx::Insets(vertical_padding, horizontal_padding))); + SetPaintToLayer(ui::LAYER_SOLID_COLOR); + layer()->SetColor(background_color); + layer()->SetFillsBoundsOpaquely(false); + + const std::array<uint32_t, 4> kRadii = {rounding_dp, rounding_dp, + rounding_dp, rounding_dp}; + layer()->SetRoundedCornerRadius(kRadii); + layer()->SetIsFastRoundedCorner(true); + + label_ = new views::Label(l10n_util::GetStringUTF16(message_id), + views::style::CONTEXT_LABEL); + label_->SetHorizontalAlignment(gfx::ALIGN_CENTER); + label_->SetEnabledColor(foreground_color); + label_->SetBackgroundColor(background_color); + label_->SetPaintToLayer(); + label_->layer()->SetFillsBoundsOpaquely(false); + AddChildView(label_); + } + ~RoundedLabelView() override = default; + + // views::View: + gfx::Size GetPreferredSize() { + int width = label_->GetPreferredSize().width() + 2 * horizontal_padding_; + return gfx::Size(width, preferred_height_); + } + + private: + views::Label* label_ = nullptr; // Owned by views hierarchy. + + int horizontal_padding_; + int preferred_height_; + + DISALLOW_COPY_AND_ASSIGN(RoundedLabelView); +}; + +} // namespace + +RoundedLabelWidget::RoundedLabelWidget() = default; + +RoundedLabelWidget::~RoundedLabelWidget() = default; + +void RoundedLabelWidget::Init(const InitParams& params) { + views::Widget::InitParams widget_params; + widget_params.type = views::Widget::InitParams::TYPE_POPUP; + widget_params.keep_on_top = false; + widget_params.ownership = + views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; + widget_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; + widget_params.layer_type = ui::LAYER_NOT_DRAWN; + widget_params.accept_events = false; + widget_params.parent = params.parent; + set_focus_on_creation(false); + views::Widget::Init(widget_params); + + SetContentsView(new RoundedLabelView( + params.horizontal_padding, params.vertical_padding, + params.background_color, params.foreground_color, params.rounding_dp, + params.preferred_height, params.message_id)); + Show(); +} + +void RoundedLabelWidget::SetBoundsCenteredIn(const gfx::Rect& bounds) { + DCHECK(GetContentsView()); + RoundedLabelView* contents_view = + static_cast<RoundedLabelView*>(GetContentsView()); + gfx::Rect widget_bounds = bounds; + widget_bounds.ClampToCenteredSize(contents_view->GetPreferredSize()); + GetNativeWindow()->SetBounds(widget_bounds); +} + +} // namespace ash
diff --git a/ash/wm/overview/rounded_label_widget.h b/ash/wm/overview/rounded_label_widget.h new file mode 100644 index 0000000..cea7ab28 --- /dev/null +++ b/ash/wm/overview/rounded_label_widget.h
@@ -0,0 +1,45 @@ +// 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_WM_OVERVIEW_ROUNDED_LABEL_WIDGET_H_ +#define ASH_WM_OVERVIEW_ROUNDED_LABEL_WIDGET_H_ + +#include "base/macros.h" +#include "third_party/skia/include/core/SkColor.h" +#include "ui/gfx/geometry/rect.h" +#include "ui/views/widget/widget.h" + +namespace ash { + +// RoundedLabelWidget is a subclass of widget which always contains a single +// label view as its child. +class RoundedLabelWidget : public views::Widget { + public: + // Params to modify the look of the label. + struct InitParams { + int horizontal_padding; + int vertical_padding; + SkColor background_color; + SkColor foreground_color; + int rounding_dp; + int preferred_height; + int message_id; + aura::Window* parent; + }; + + RoundedLabelWidget(); + ~RoundedLabelWidget() override; + + void Init(const InitParams& params); + // Places the widget in the middle of |bounds|. The size will be the preferred + // size of the label. + void SetBoundsCenteredIn(const gfx::Rect& bounds); + + private: + DISALLOW_COPY_AND_ASSIGN(RoundedLabelWidget); +}; + +} // namespace ash + +#endif // ASH_WM_OVERVIEW_ROUNDED_LABEL_WIDGET_H_
diff --git a/ash/wm/splitview/split_view_drag_indicators.cc b/ash/wm/splitview/split_view_drag_indicators.cc index 841e9b7..9b58a96b 100644 --- a/ash/wm/splitview/split_view_drag_indicators.cc +++ b/ash/wm/splitview/split_view_drag_indicators.cc
@@ -403,6 +403,13 @@ const IndicatorState preview_state = nix_preview_inset ? previous_indicator_state_ : indicator_state_; const bool preview_left = preview_state == IndicatorState::kPreviewAreaLeft; + // |preview_left_or_top| indicates a preview area on the physical left or + // top of the screen (corresponding to kPreviewAreaLeft in primary screen + // orientations, and kPreviewAreaRight in nonprimary screen orientations). + const bool preview_left_or_top = + IsPreviewAreaOnLeftTopOfScreen(preview_state); + base::Optional<SplitviewAnimationType> left_highlight_animation_type; + base::Optional<SplitviewAnimationType> right_highlight_animation_type; if (IsPreviewAreaState(indicator_state_) || nix_preview_inset) { // Get the preview area bounds from the split view controller. gfx::Rect preview_area_bounds = @@ -435,20 +442,54 @@ if (!landscape) other_bounds.Transpose(); - if (IsPreviewAreaOnLeftTopOfScreen(preview_state)) { + if (preview_left_or_top) { left_highlight_bounds = preview_area_bounds; right_highlight_bounds = other_bounds; + if (animate) { + if (nix_preview_inset) { + left_highlight_animation_type = + SPLITVIEW_ANIMATION_PREVIEW_AREA_NIX_INSET; + } else { + left_highlight_animation_type = + SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN; + right_highlight_animation_type = + SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_OUT; + } + } } else { other_bounds.set_origin(highlight_padding_point); left_highlight_bounds = other_bounds; right_highlight_bounds = preview_area_bounds; + if (animate) { + if (nix_preview_inset) { + right_highlight_animation_type = + SPLITVIEW_ANIMATION_PREVIEW_AREA_NIX_INSET; + } else { + left_highlight_animation_type = + SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_OUT; + right_highlight_animation_type = + SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN; + } + } + } + } else if (IsPreviewAreaState(previous_indicator_state_) && animate) { + if (preview_left_or_top) { + left_highlight_animation_type = + SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_OUT; + right_highlight_animation_type = + SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_IN; + } else { + left_highlight_animation_type = + SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_IN; + right_highlight_animation_type = + SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_OUT; } } left_highlight_view_->SetBounds(GetMirroredRect(left_highlight_bounds), - landscape, animate, nix_preview_inset); + landscape, left_highlight_animation_type); right_highlight_view_->SetBounds(GetMirroredRect(right_highlight_bounds), - landscape, animate, nix_preview_inset); + landscape, right_highlight_animation_type); // Calculate the bounds of the views which contain the guidance text and // icon. Rotate the two views in landscape mode.
diff --git a/ash/wm/splitview/split_view_highlight_view.cc b/ash/wm/splitview/split_view_highlight_view.cc index c54ea5f..b7b2a2a 100644 --- a/ash/wm/splitview/split_view_highlight_view.cc +++ b/ash/wm/splitview/split_view_highlight_view.cc
@@ -78,10 +78,10 @@ SplitViewHighlightView::~SplitViewHighlightView() = default; -void SplitViewHighlightView::SetBounds(const gfx::Rect& bounds, - bool landscape, - bool animate, - bool nixing_preview_inset) { +void SplitViewHighlightView::SetBounds( + const gfx::Rect& bounds, + bool landscape, + const base::Optional<SplitviewAnimationType>& animation_type) { if (bounds == this->bounds() && landscape == landscape_) return; @@ -95,8 +95,9 @@ const bool slides_from_right = base::i18n::IsRTL() && landscape ? !is_right_or_bottom_ : is_right_or_bottom_; - if ((slides_from_right || nixing_preview_inset) && animate && - !offset.IsZero()) { + if (!offset.IsZero() && animation_type && + (slides_from_right || + *animation_type == SPLITVIEW_ANIMATION_PREVIEW_AREA_NIX_INSET)) { gfx::Rect old_left_top_bounds = left_top_->bounds(); gfx::Rect old_right_middle_bounds = right_bottom_->bounds(); gfx::Rect old_middle_bounds = middle_->bounds(); @@ -139,23 +140,20 @@ right_bottom_bounds = GetMirroredRect(right_bottom_bounds); middle_bounds = GetMirroredRect(middle_bounds); - // If |animate|, calculate the needed transform from old bounds to new bounds - // and apply it. Otherwise set the new bounds and reset the transforms on all - // items. - if (animate) { - const SplitviewAnimationType animation_type = - nixing_preview_inset ? SPLITVIEW_ANIMATION_PREVIEW_AREA_NIX_INSET - : SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN_OUT; + // If |animation_type| has a value, calculate the needed transform from old + // bounds to new bounds and apply it. Otherwise set the new bounds and reset + // the transforms on all items. + if (animation_type) { DoSplitviewTransformAnimation( - middle_->layer(), animation_type, + middle_->layer(), *animation_type, CalculateTransformFromRects(middle_->bounds(), middle_bounds, landscape)); DoSplitviewTransformAnimation( - left_top_->layer(), animation_type, + left_top_->layer(), *animation_type, CalculateTransformFromRects(left_top_->bounds(), left_top_bounds, landscape)); DoSplitviewTransformAnimation( - right_bottom_->layer(), animation_type, + right_bottom_->layer(), *animation_type, CalculateTransformFromRects(right_bottom_->bounds(), right_bottom_bounds, landscape)); } else { @@ -219,6 +217,21 @@ return; } + if (SplitViewDragIndicators::IsPreviewAreaState(previous_indicator_state)) { + const bool was_this_the_preview = + is_right_or_bottom_ != + SplitViewDragIndicators::IsPreviewAreaOnLeftTopOfScreen( + previous_indicator_state); + DoSplitviewOpacityAnimation( + layer(), Shell::Get()->split_view_controller()->state() == + SplitViewController::NO_SNAP + ? (was_this_the_preview + ? SPLITVIEW_ANIMATION_HIGHLIGHT_FADE_IN + : SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_FADE_IN) + : SPLITVIEW_ANIMATION_HIGHLIGHT_FADE_OUT); + return; + } + // No need to update left/top highlight view for right indicator state and // also no need to update right/bottom highlight view for left indicator // state.
diff --git a/ash/wm/splitview/split_view_highlight_view.h b/ash/wm/splitview/split_view_highlight_view.h index f1a5d5b..3f9b3d9 100644 --- a/ash/wm/splitview/split_view_highlight_view.h +++ b/ash/wm/splitview/split_view_highlight_view.h
@@ -7,6 +7,8 @@ #include "ash/ash_export.h" #include "ash/wm/splitview/split_view_drag_indicators.h" +#include "ash/wm/splitview/split_view_utils.h" +#include "base/optional.h" #include "ui/views/view.h" namespace ash { @@ -35,10 +37,10 @@ explicit SplitViewHighlightView(bool is_right_or_bottom); ~SplitViewHighlightView() override; + // Updates bounds, animating if |animation_type| has a value. void SetBounds(const gfx::Rect& bounds, bool landscape, - bool animate, - bool nixing_preview_inset = false); + const base::Optional<SplitviewAnimationType>& animation_type); void SetColor(SkColor color);
diff --git a/ash/wm/splitview/split_view_highlight_view_unittest.cc b/ash/wm/splitview/split_view_highlight_view_unittest.cc index 0a3149ca..b9d8ba0 100644 --- a/ash/wm/splitview/split_view_highlight_view_unittest.cc +++ b/ash/wm/splitview/split_view_highlight_view_unittest.cc
@@ -47,7 +47,8 @@ // landscape mode. TEST_F(SplitViewHighlightViewTest, LandscapeBounds) { const gfx::Rect bounds(0, 0, 100, 100); - left_highlight()->SetBounds(bounds, /*landscape=*/true, /*animate=*/false); + left_highlight()->SetBounds(bounds, /*landscape=*/true, + /*animation_type=*/base::nullopt); // Tests that setting bounds without animations in landscape mode will set the // bounds of the components correctly, without any transforms. @@ -62,7 +63,9 @@ // Tests that after animating to new bounds, the components have the same // bounds, but have transforms. const gfx::Rect new_bounds(0, 0, 200, 100); - left_highlight()->SetBounds(new_bounds, /*landscape=*/true, /*animate=*/true); + left_highlight()->SetBounds( + new_bounds, /*landscape=*/true, /*animation_type=*/ + base::make_optional(SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN)); base::RunLoop().RunUntilIdle(); EXPECT_EQ(gfx::Rect(0, 0, 14, 100), test_api.GetLeftTopView()->bounds()); EXPECT_EQ(gfx::Rect(4, 0, 92, 100), test_api.GetMiddleView()->bounds()); @@ -84,7 +87,8 @@ base::test::ScopedRestoreICUDefaultLocale scoped_locale("he"); const gfx::Rect bounds(0, 0, 100, 100); - left_highlight()->SetBounds(bounds, /*landscape=*/true, /*animate=*/false); + left_highlight()->SetBounds(bounds, /*landscape=*/true, + /*animation_type=*/base::nullopt); // Tests that setting bounds without animations in landscape mode will set the // bounds of the components correctly, without any transforms. In rtl, the @@ -102,7 +106,9 @@ // is translated instead. The middle element has a extra translation in its // transform to account for the flipped scaling. const gfx::Rect new_bounds(0, 0, 200, 100); - left_highlight()->SetBounds(new_bounds, /*landscape=*/true, /*animate=*/true); + left_highlight()->SetBounds( + new_bounds, /*landscape=*/true, /*animation_type=*/ + base::make_optional(SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN)); base::RunLoop().RunUntilIdle(); EXPECT_EQ(gfx::Rect(86, 0, 14, 100), test_api.GetLeftTopView()->bounds()); EXPECT_EQ(gfx::Rect(4, 0, 92, 100), test_api.GetMiddleView()->bounds()); @@ -138,7 +144,8 @@ // portrait mode. The bounds should remain the same in ltr or rtl. TEST_P(SplitViewHighlightViewPortraitTest, Bounds) { const gfx::Rect bounds(0, 0, 100, 100); - left_highlight()->SetBounds(bounds, /*landscape=*/false, /*animate=*/false); + left_highlight()->SetBounds(bounds, /*landscape=*/false, + /*animation_type=*/base::nullopt); SplitViewHighlightViewTestApi test_api(left_highlight()); EXPECT_EQ(gfx::Rect(0, 0, 100, 14), test_api.GetLeftTopView()->bounds()); @@ -146,8 +153,9 @@ EXPECT_EQ(gfx::Rect(0, 86, 100, 14), test_api.GetRightBottomView()->bounds()); const gfx::Rect new_bounds(0, 0, 100, 200); - left_highlight()->SetBounds(new_bounds, /*landscape=*/false, - /*animate=*/true); + left_highlight()->SetBounds( + new_bounds, /*landscape=*/false, /*animation_type=*/ + base::make_optional(SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN)); base::RunLoop().RunUntilIdle(); EXPECT_EQ(gfx::Rect(0, 0, 100, 14), test_api.GetLeftTopView()->bounds()); EXPECT_EQ(gfx::Rect(0, 4, 100, 92), test_api.GetMiddleView()->bounds()); @@ -169,7 +177,8 @@ TEST_F(SplitViewHighlightViewTest, RightBounds) { const gfx::Rect bounds(100, 0, 100, 100); - right_highlight()->SetBounds(bounds, /*landscape=*/true, /*animate=*/false); + right_highlight()->SetBounds(bounds, /*landscape=*/true, + /*animation_type=*/base::nullopt); SplitViewHighlightViewTestApi test_api(right_highlight()); EXPECT_EQ(gfx::Rect(0, 0, 14, 100), test_api.GetLeftTopView()->bounds()); @@ -177,8 +186,9 @@ EXPECT_EQ(gfx::Rect(86, 0, 14, 100), test_api.GetRightBottomView()->bounds()); const gfx::Rect new_bounds(0, 0, 200, 100); - right_highlight()->SetBounds(new_bounds, /*landscape=*/true, - /*animate=*/true); + right_highlight()->SetBounds( + new_bounds, /*landscape=*/true, /*animation_type=*/ + base::make_optional(SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN)); base::RunLoop().RunUntilIdle(); EXPECT_EQ(gfx::Rect(100, 0, 14, 100), test_api.GetLeftTopView()->bounds()); EXPECT_EQ(gfx::Rect(104, 0, 92, 100), test_api.GetMiddleView()->bounds()); @@ -196,4 +206,4 @@ EXPECT_TRUE(GetTransform(test_api.GetRightBottomView()).IsIdentity()); } -} // namespace ash \ No newline at end of file +} // namespace ash
diff --git a/ash/wm/splitview/split_view_utils.cc b/ash/wm/splitview/split_view_utils.cc index 1d7e1c79..7ccd132 100644 --- a/ash/wm/splitview/split_view_utils.cc +++ b/ash/wm/splitview/split_view_utils.cc
@@ -30,8 +30,8 @@ // The animation speed which the other highlight fades in or out. constexpr base::TimeDelta kOtherFadeInOutMs = base::TimeDelta::FromMilliseconds(133); -// The delay before the other highlight starts fading in or out. -constexpr base::TimeDelta kOtherFadeOutDelayMs = +// The delay before the other highlight starts fading in. +constexpr base::TimeDelta kOtherFadeInDelayMs = base::TimeDelta::FromMilliseconds(117); // The animation speed for any animation on the indicator labels. constexpr base::TimeDelta kLabelAnimationMs = @@ -64,13 +64,17 @@ case SPLITVIEW_ANIMATION_OVERVIEW_ITEM_FADE_OUT: case SPLITVIEW_ANIMATION_TEXT_FADE_IN_WITH_HIGHLIGHT: case SPLITVIEW_ANIMATION_TEXT_FADE_OUT_WITH_HIGHLIGHT: - case SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN_OUT: + case SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN: + case SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_OUT: *out_duration = kHighlightsFadeInOutMs; *out_tween_type = gfx::Tween::FAST_OUT_SLOW_IN; return; + case SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_FADE_IN: case SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_IN: + *out_delay = kOtherFadeInDelayMs; *out_duration = kOtherFadeInOutMs; *out_tween_type = gfx::Tween::LINEAR_OUT_SLOW_IN; + *out_preemption_strategy = ui::LayerAnimator::ENQUEUE_NEW_ANIMATION; return; case SPLITVIEW_ANIMATION_TEXT_FADE_IN: case SPLITVIEW_ANIMATION_TEXT_SLIDE_IN: @@ -86,10 +90,8 @@ return; case SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_FADE_OUT: case SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_OUT: - *out_delay = kOtherFadeOutDelayMs; *out_duration = kOtherFadeInOutMs; - *out_tween_type = gfx::Tween::LINEAR_OUT_SLOW_IN; - *out_preemption_strategy = ui::LayerAnimator::ENQUEUE_NEW_ANIMATION; + *out_tween_type = gfx::Tween::FAST_OUT_LINEAR_IN; return; case SPLITVIEW_ANIMATION_SET_WINDOW_TRANSFORM: *out_duration = kWindowTransformMs; @@ -142,6 +144,7 @@ target_opacity = kPreviewAreaHighlightOpacity; break; case SPLITVIEW_ANIMATION_HIGHLIGHT_FADE_IN: + case SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_FADE_IN: target_opacity = kHighlightOpacity; break; case SPLITVIEW_ANIMATION_OVERVIEW_ITEM_FADE_IN: @@ -182,7 +185,8 @@ case SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_IN: case SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_OUT: case SPLITVIEW_ANIMATION_PREVIEW_AREA_NIX_INSET: - case SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN_OUT: + case SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN: + case SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_OUT: case SPLITVIEW_ANIMATION_SET_WINDOW_TRANSFORM: case SPLITVIEW_ANIMATION_TEXT_SLIDE_IN: case SPLITVIEW_ANIMATION_TEXT_SLIDE_OUT:
diff --git a/ash/wm/splitview/split_view_utils.h b/ash/wm/splitview/split_view_utils.h index 865bbcf..c97d3be 100644 --- a/ash/wm/splitview/split_view_utils.h +++ b/ash/wm/splitview/split_view_utils.h
@@ -27,10 +27,11 @@ // to drag a selector item. SPLITVIEW_ANIMATION_HIGHLIGHT_FADE_IN, SPLITVIEW_ANIMATION_HIGHLIGHT_FADE_OUT, - // Used to fade out the other highlight. There are normally two highlights, - // one on each side. When entering a state with a preview highlight, one - // highlight is the preview highlight, and the other highlight is the other - // highlight. + // Used to fade in and out the other highlight. There are normally two + // highlights, one on each side. When entering a state with a preview + // highlight, one highlight is the preview highlight, and the other highlight + // is the other highlight. + SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_FADE_IN, SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_FADE_OUT, // Used to fade in and out the preview area highlight which indicates the // bounds of the window that is about to get snapped. @@ -55,7 +56,8 @@ SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_IN, SPLITVIEW_ANIMATION_OTHER_HIGHLIGHT_SLIDE_OUT, // Used to slide in and out the preview area highlight. - SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN_OUT, + SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_IN, + SPLITVIEW_ANIMATION_PREVIEW_AREA_SLIDE_OUT, // Used to slide in the text labels. SPLITVIEW_ANIMATION_TEXT_SLIDE_IN, SPLITVIEW_ANIMATION_TEXT_SLIDE_OUT,
diff --git a/base/allocator/partition_allocator/page_allocator.cc b/base/allocator/partition_allocator/page_allocator.cc index e8a3801..f63b4ac 100644 --- a/base/allocator/partition_allocator/page_allocator.cc +++ b/base/allocator/partition_allocator/page_allocator.cc
@@ -115,19 +115,6 @@ uintptr_t align_base_mask = ~align_offset_mask; DCHECK(!(reinterpret_cast<uintptr_t>(address) & align_offset_mask)); -#if defined(OS_LINUX) && defined(ARCH_CPU_64_BITS) - // On 64 bit Linux, we may need to adjust the address space limit for - // guarded allocations. - if (length >= kMinimumGuardedMemorySize) { - CHECK_EQ(PageInaccessible, accessibility); - CHECK(!commit); - if (!AdjustAddressSpaceLimit(base::checked_cast<int64_t>(length))) { - DLOG(WARNING) << "Could not adjust address space by " << length; - // Fall through. Try the allocation, since we may have a reserve. - } - } -#endif - // If the client passed null as the address, choose a good one. if (address == nullptr) { address = GetRandomPageBase();
diff --git a/base/allocator/partition_allocator/page_allocator_internals_posix.h b/base/allocator/partition_allocator/page_allocator_internals_posix.h index 29fac43..1a1850c 100644 --- a/base/allocator/partition_allocator/page_allocator_internals_posix.h +++ b/base/allocator/partition_allocator/page_allocator_internals_posix.h
@@ -48,28 +48,6 @@ } } -#if defined(OS_LINUX) && defined(ARCH_CPU_64_BITS) - -// Multiple guarded memory regions may exceed the process address space limit. -// This function will raise or lower the limit by |amount|. -bool AdjustAddressSpaceLimit(int64_t amount) { - struct rlimit old_rlimit; - if (getrlimit(RLIMIT_AS, &old_rlimit)) - return false; - const rlim_t new_limit = - CheckAdd(old_rlimit.rlim_cur, amount).ValueOrDefault(old_rlimit.rlim_max); - const struct rlimit new_rlimit = {std::min(new_limit, old_rlimit.rlim_max), - old_rlimit.rlim_max}; - // setrlimit will fail if limit > old_rlimit.rlim_max. - return setrlimit(RLIMIT_AS, &new_rlimit) == 0; -} - -// Current WASM guarded memory regions have 8 GiB of address space. There are -// schemes that reduce that to 4 GiB. -constexpr size_t kMinimumGuardedMemorySize = 1ULL << 32; // 4 GiB - -#endif // defined(OS_LINUX) && defined(ARCH_CPU_64_BITS) - void* SystemAllocPagesInternal(void* hint, size_t length, PageAccessibilityConfiguration accessibility, @@ -143,13 +121,6 @@ void FreePagesInternal(void* address, size_t length) { CHECK(!munmap(address, length)); - -#if defined(OS_LINUX) && defined(ARCH_CPU_64_BITS) - // Restore the address space limit. - if (length >= kMinimumGuardedMemorySize) { - CHECK(AdjustAddressSpaceLimit(-base::checked_cast<int64_t>(length))); - } -#endif } void DecommitSystemPagesInternal(void* address, size_t length) {
diff --git a/base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java b/base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java index 5588ec5b..a421341 100644 --- a/base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java +++ b/base/android/java/src/org/chromium/base/multidex/ChromiumMultiDexInstaller.java
@@ -44,10 +44,13 @@ */ @VisibleForTesting public static void install(Context context) { + // No-op on platforms that support multidex natively. + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + return; + } // TODO(jbudorick): Back out this version check once support for K & below works. // http://crbug.com/512357 - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP - && !shouldInstallMultiDex(context)) { + if (!shouldInstallMultiDex(context)) { Log.i(TAG, "Skipping multidex installation: not needed for process."); } else { MultiDex.install(context);
diff --git a/base/metrics/persistent_histogram_allocator.cc b/base/metrics/persistent_histogram_allocator.cc index 6ad5739..b44baec 100644 --- a/base/metrics/persistent_histogram_allocator.cc +++ b/base/metrics/persistent_histogram_allocator.cc
@@ -839,16 +839,17 @@ bool GlobalHistogramAllocator::CreateSpareFile(const FilePath& spare_path, size_t size) { FilePath temp_spare_path = spare_path.AddExtension(FILE_PATH_LITERAL(".tmp")); - bool success = true; + bool success; { File spare_file(temp_spare_path, File::FLAG_CREATE_ALWAYS | File::FLAG_READ | File::FLAG_WRITE); - if (!spare_file.IsValid()) - return false; + success = spare_file.IsValid(); - MemoryMappedFile mmfile; - success = mmfile.Initialize(std::move(spare_file), {0, size}, - MemoryMappedFile::READ_WRITE_EXTEND); + if (success) { + MemoryMappedFile mmfile; + success = mmfile.Initialize(std::move(spare_file), {0, size}, + MemoryMappedFile::READ_WRITE_EXTEND); + } } if (success)
diff --git a/base/profiler/register_context.h b/base/profiler/register_context.h index 92d2e51..7c7dfd8 100644 --- a/base/profiler/register_context.h +++ b/base/profiler/register_context.h
@@ -54,6 +54,16 @@ #endif } +inline uintptr_t& RegisterContextInstructionPointer(::CONTEXT* context) { +#if defined(ARCH_CPU_X86_64) + return context->Rip; +#elif defined(ARCH_CPU_ARM64) + return context->Pc; +#else + return AsUintPtr(&context->Eip); +#endif +} + #elif defined(OS_MACOSX) && !defined(OS_IOS) // #if defined(OS_WIN) using RegisterContext = x86_thread_state64_t; @@ -66,12 +76,18 @@ return AsUintPtr(&context->__rbp); } +inline uintptr_t& RegisterContextInstructionPointer( + x86_thread_state64_t* context) { + return AsUintPtr(&context->__rip); +} + #else // #if defined(OS_WIN) // Placeholders for other platforms. struct RegisterContext { uintptr_t stack_pointer; uintptr_t frame_pointer; + uintptr_t instruction_pointer; }; inline uintptr_t& RegisterContextStackPointer(RegisterContext* context) { @@ -82,6 +98,10 @@ return context->frame_pointer; } +inline uintptr_t& RegisterContextInstructionPointer(RegisterContext* context) { + return context->instruction_pointer; +} + #endif // #if defined(OS_WIN) #endif // BASE_PROFILER_REGISTER_CONTEXT_H_
diff --git a/base/profiler/stack_sampler_impl.cc b/base/profiler/stack_sampler_impl.cc index 563829e..f89be3c 100644 --- a/base/profiler/stack_sampler_impl.cc +++ b/base/profiler/stack_sampler_impl.cc
@@ -163,6 +163,11 @@ // fewer. stack.reserve(128); + // Record the first frame from the context values. + stack.emplace_back(RegisterContextInstructionPointer(thread_context), + module_cache_->GetModuleForAddress( + RegisterContextInstructionPointer(thread_context))); + thread_delegate_->WalkNativeFrames(thread_context, stack_top, module_cache_, &stack);
diff --git a/base/profiler/stack_sampler_impl_unittest.cc b/base/profiler/stack_sampler_impl_unittest.cc index 2dfc37a2..2fd5175 100644 --- a/base/profiler/stack_sampler_impl_unittest.cc +++ b/base/profiler/stack_sampler_impl_unittest.cc
@@ -119,11 +119,37 @@ RegisterContext* thread_context_; }; +class TestModule : public ModuleCache::Module { + public: + TestModule(uintptr_t base_address, size_t size) + : base_address_(base_address), size_(size) {} + + uintptr_t GetBaseAddress() const override { return base_address_; } + std::string GetId() const override { return ""; } + FilePath GetDebugBasename() const override { return FilePath(); } + size_t GetSize() const override { return size_; } + + private: + const uintptr_t base_address_; + const size_t size_; +}; + +// Injects a fake module covering the initial instruction pointer value, to +// avoid asking the OS to look it up. Windows doesn't return a consistent error +// code when doing so, and we DCHECK_EQ the expected error code. +void InjectModuleForContextInstructionPointer( + const std::vector<uintptr_t>& stack, + ModuleCache* module_cache) { + module_cache->InjectModuleForTesting( + std::make_unique<TestModule>(stack[0], sizeof(uintptr_t))); +} + } // namespace TEST(StackSamplerImplTest, CopyStack) { ModuleCache module_cache; const std::vector<uintptr_t> stack = {0, 1, 2, 3, 4}; + InjectModuleForContextInstructionPointer(stack, &module_cache); std::vector<uintptr_t> stack_copy; StackSamplerImpl stack_sampler_impl( std::make_unique<TestThreadDelegate>(stack, &stack_copy), &module_cache); @@ -140,6 +166,7 @@ TEST(StackSamplerImplTest, CopyStackBufferTooSmall) { ModuleCache module_cache; std::vector<uintptr_t> stack = {0, 1, 2, 3, 4}; + InjectModuleForContextInstructionPointer(stack, &module_cache); std::vector<uintptr_t> stack_copy; StackSamplerImpl stack_sampler_impl( std::make_unique<TestThreadDelegate>(stack, &stack_copy), &module_cache); @@ -164,6 +191,7 @@ std::vector<uintptr_t> stack(2); stack[0] = reinterpret_cast<uintptr_t>(&stack[0]); stack[1] = reinterpret_cast<uintptr_t>(&stack[1]); + InjectModuleForContextInstructionPointer(stack, &module_cache); std::vector<uintptr_t> stack_copy; uintptr_t stack_copy_bottom; StackSamplerImpl stack_sampler_impl( @@ -184,7 +212,8 @@ TEST(StackSamplerImplTest, RewriteRegisters) { ModuleCache module_cache; - std::vector<uintptr_t> stack(3); + std::vector<uintptr_t> stack = {0, 1, 2}; + InjectModuleForContextInstructionPointer(stack, &module_cache); uintptr_t stack_copy_bottom; RegisterContext thread_context; RegisterContextFramePointer(&thread_context) =
diff --git a/base/profiler/thread_delegate.h b/base/profiler/thread_delegate.h index 17e55a9..d415106 100644 --- a/base/profiler/thread_delegate.h +++ b/base/profiler/thread_delegate.h
@@ -68,7 +68,9 @@ RegisterContext* thread_context) = 0; // Walks the native frames on the stack pointed to by the stack pointer in - // |thread_context|, appending the frames to |stack|. + // |thread_context|, appending the frames to |stack|. When invoked + // stack->back() contains the frame corresponding to the state in + // |thread_context|. // TODO(wittman): Move the unwinding support into a separate UnwindDelegate. virtual UnwindResult WalkNativeFrames( RegisterContext* thread_context,
diff --git a/base/profiler/thread_delegate_mac.cc b/base/profiler/thread_delegate_mac.cc index 1426bd41..33e8a13 100644 --- a/base/profiler/thread_delegate_mac.cc +++ b/base/profiler/thread_delegate_mac.cc
@@ -231,11 +231,9 @@ uintptr_t stack_top, ModuleCache* module_cache, std::vector<ProfileBuilder::Frame>* stack) { - // Record the first frame from the context values. - unw_word_t instruction_pointer = thread_context->__rip; - const ModuleCache::Module* module = - module_cache->GetModuleForAddress(instruction_pointer); - stack->emplace_back(instruction_pointer, module); + // We expect the frame corresponding to the |thread_context| register state to + // exist within |stack|. + DCHECK_GT(stack->size(), 0u); // There isn't an official way to create a unw_context other than to create it // from the current state of the current thread's stack. Since we're walking a @@ -250,20 +248,17 @@ // Avoid an out-of-bounds read bug in libunwind that can crash us in some // circumstances. If we're subject to that case, just record the first frame // and bail. See MayTriggerUnwInitLocalCrash for details. - const ModuleCache::Module* leaf_frame_module = - module_cache->GetModuleForAddress(instruction_pointer); - if (leaf_frame_module && MayTriggerUnwInitLocalCrash(leaf_frame_module)) + if (stack->back().module && MayTriggerUnwInitLocalCrash(stack->back().module)) return UnwindResult::ABORTED; unw_cursor_t unwind_cursor; unw_init_local(&unwind_cursor, &unwind_context); - bool at_top_frame = true; int step_result; for (;;) { // First frame unwind step, check pre-conditions for attempting a frame // unwind. - if (!module) { + if (!stack->back().module) { // There's no loaded module containing the instruction pointer. This is // due to either executing code that is not in a module (e.g. V8 // runtime-generated code), or to a previous bad unwind. @@ -289,8 +284,8 @@ // is very fragile. It's a complex DWARF unwind that needs to restore the // entire thread context which was saved by the kernel when the interrupt // occurred. - if (instruction_pointer >= sigtramp_start_ && - instruction_pointer < sigtramp_end_) { + if (stack->back().instruction_pointer >= sigtramp_start_ && + stack->back().instruction_pointer < sigtramp_end_) { return UnwindResult::ABORTED; } @@ -304,13 +299,13 @@ unw_get_reg(&unwind_cursor, UNW_REG_SP, &prev_stack_pointer); step_result = unw_step(&unwind_cursor); - if (step_result == 0 && at_top_frame) { + if (step_result == 0 && stack->size() == 1u) { // libunwind is designed to be triggered by user code on their own thread, // if it hits a library that has no unwind info for the function that is // being executed, it just stops. This isn't a problem in the normal case, - // but in this case, it's quite possible that the stack being walked is - // stopped in a function that bridges to the kernel and thus is missing - // the unwind info. + // but in the case where this is the first frame unwind, it's quite + // possible that the stack being walked is stopped in a function that + // bridges to the kernel and thus is missing the unwind info. // For now, just unwind the single case where the thread is stopped in a // function in libsystem_kernel. @@ -331,9 +326,11 @@ return UnwindResult::ABORTED; // Fourth frame unwind step: record the frame to which we just unwound. + unw_word_t instruction_pointer; unw_get_reg(&unwind_cursor, UNW_REG_IP, &instruction_pointer); unw_word_t stack_pointer; unw_get_reg(&unwind_cursor, UNW_REG_SP, &stack_pointer); + // Record the frame if the last step was successful. if (step_result > 0 || // libunwind considers the unwind complete and returns 0 if no unwind @@ -344,8 +341,9 @@ // whether the stack pointer was moved by unw_step. If so, record the // new frame to enable non-native unwinders to continue the unwinding. (step_result == 0 && stack_pointer > prev_stack_pointer)) { - module = module_cache->GetModuleForAddress(instruction_pointer); - stack->emplace_back(instruction_pointer, module); + stack->emplace_back( + instruction_pointer, + module_cache->GetModuleForAddress(instruction_pointer)); } // libunwind returns 0 if it can't continue because no unwind info was found @@ -359,8 +357,6 @@ // signify that we couldn't unwind further. if (step_result == 0) return UnwindResult::UNRECOGNIZED_FRAME; - - at_top_frame = false; } NOTREACHED();
diff --git a/base/profiler/thread_delegate_win.cc b/base/profiler/thread_delegate_win.cc index 5eef627b..e37d560b 100644 --- a/base/profiler/thread_delegate_win.cc +++ b/base/profiler/thread_delegate_win.cc
@@ -205,15 +205,14 @@ uintptr_t stack_top, ModuleCache* module_cache, std::vector<ProfileBuilder::Frame>* stack) { - // Record the first frame from the context values. - const ModuleCache::Module* module = - module_cache->GetModuleForAddress(ContextPC(thread_context)); - stack->emplace_back(ContextPC(thread_context), module); + // We expect the frame corresponding to the |thread_context| register state to + // exist within |stack|. + DCHECK_GT(stack->size(), 0u); Win32StackFrameUnwinder frame_unwinder; for (;;) { - if (!module) { - // There's no loaded module containing the instruction pointer. This can + if (!stack->back().module) { + // There's no loaded module corresponding to the current frame. This can // be due to executing code that is not in a module (e.g. V8 generated // code or runtime-generated code associated with third-party injected // DLLs). It can also be due to the the module having been unloaded since @@ -233,15 +232,18 @@ return UnwindResult::UNRECOGNIZED_FRAME; } - if (!frame_unwinder.TryUnwind(stack->size() == 1u, thread_context, module)) + if (!frame_unwinder.TryUnwind(stack->size() == 1u, thread_context, + stack->back().module)) { return UnwindResult::ABORTED; + } if (ContextPC(thread_context) == 0) return UnwindResult::COMPLETED; // Record the frame to which we just unwound. - module = module_cache->GetModuleForAddress(ContextPC(thread_context)); - stack->emplace_back(ContextPC(thread_context), module); + stack->emplace_back( + ContextPC(thread_context), + module_cache->GetModuleForAddress(ContextPC(thread_context))); } NOTREACHED();
diff --git a/base/trace_event/common/trace_event_common.h b/base/trace_event/common/trace_event_common.h index b716edd7..f9b9ad3 100644 --- a/base/trace_event/common/trace_event_common.h +++ b/base/trace_event/common/trace_event_common.h
@@ -1070,6 +1070,9 @@ #define TRACE_EVENT_FLAG_HAS_LOCAL_ID (static_cast<unsigned int>(1 << 12)) #define TRACE_EVENT_FLAG_HAS_GLOBAL_ID (static_cast<unsigned int>(1 << 13)) #define TRACE_EVENT_FLAG_DISALLOW_POSTTASK (static_cast<unsigned int>(1 << 14)) +// TODO(eseckler): Remove once we have native support for typed proto events in +// TRACE_EVENT macros. +#define TRACE_EVENT_FLAG_TYPED_PROTO_ARGS (static_cast<unsigned int>(1 << 15)) #define TRACE_EVENT_FLAG_SCOPE_MASK \ (static_cast<unsigned int>(TRACE_EVENT_FLAG_SCOPE_OFFSET | \
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h index 9cc13a9..ea29e14b 100644 --- a/base/trace_event/trace_event.h +++ b/base/trace_event/trace_event.h
@@ -310,6 +310,21 @@ INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ } +#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLAGS(category_group, name, \ + flags, ...) \ + INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ + trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \ + if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \ + base::trace_event::TraceEventHandle h = \ + trace_event_internal::AddTraceEvent( \ + TRACE_EVENT_PHASE_COMPLETE, \ + INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \ + trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \ + flags, trace_event_internal::kNoId, ##__VA_ARGS__); \ + INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \ + INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \ + } + #define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, \ bind_id, flow_flags, ...) \ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \ @@ -442,13 +457,14 @@ // // This implementation is for when location sources are available. // TODO(ssid): The program counter of the current task should be added here. -#define INTERNAL_TRACE_TASK_EXECUTION(run_function, task) \ - TRACE_EVENT2("toplevel", run_function, "src_file", \ - (task).posted_from.file_name(), "src_func", \ - (task).posted_from.function_name()); \ - TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION INTERNAL_TRACE_EVENT_UID( \ - task_event)((task).posted_from.file_name()); \ - TRACE_HEAP_PROFILER_API_SCOPED_WITH_PROGRAM_COUNTER \ +#define INTERNAL_TRACE_TASK_EXECUTION(run_function, task) \ + INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLAGS( \ + "toplevel", run_function, TRACE_EVENT_FLAG_TYPED_PROTO_ARGS, "src_file", \ + (task).posted_from.file_name(), "src_func", \ + (task).posted_from.function_name()); \ + TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION INTERNAL_TRACE_EVENT_UID( \ + task_event)((task).posted_from.file_name()); \ + TRACE_HEAP_PROFILER_API_SCOPED_WITH_PROGRAM_COUNTER \ INTERNAL_TRACE_EVENT_UID(task_pc_event)((task).posted_from.program_counter()); #else @@ -456,11 +472,13 @@ // TODO(http://crbug.com760702) remove file name and just pass the program // counter to the heap profiler macro. // TODO(ssid): The program counter of the current task should be added here. -#define INTERNAL_TRACE_TASK_EXECUTION(run_function, task) \ - TRACE_EVENT1("toplevel", run_function, "src", (task).posted_from.ToString()) \ - TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION INTERNAL_TRACE_EVENT_UID( \ - task_event)((task).posted_from.file_name()); \ - TRACE_HEAP_PROFILER_API_SCOPED_WITH_PROGRAM_COUNTER \ +#define INTERNAL_TRACE_TASK_EXECUTION(run_function, task) \ + INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLAGS( \ + "toplevel", run_function, TRACE_EVENT_FLAG_TYPED_PROTO_ARGS, "src", \ + (task).posted_from.ToString()) \ + TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION INTERNAL_TRACE_EVENT_UID( \ + task_event)((task).posted_from.file_name()); \ + TRACE_HEAP_PROFILER_API_SCOPED_WITH_PROGRAM_COUNTER \ INTERNAL_TRACE_EVENT_UID(task_pc_event)((task).posted_from.program_counter()); #endif
diff --git a/build/config/android/chrome_version.gni b/build/config/android/chrome_version.gni deleted file mode 100644 index 041e9872..0000000 --- a/build/config/android/chrome_version.gni +++ /dev/null
@@ -1,5 +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. - -import("//build/util/version.gni")
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index d8701eb..ed85335 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -1135,7 +1135,7 @@ _proguarding_with_r8 = _proguard_enabled && (!defined(invoker.proguard_jar_path) || use_r8) _enable_multidex = - defined(invoker.enable_multidex) && invoker.enable_multidex + !defined(invoker.enable_multidex) || invoker.enable_multidex _enable_main_dex_list = _enable_multidex && (!defined(invoker.min_sdk_version) || invoker.min_sdk_version < 21)
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index dc13739..414ed4c 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -2073,7 +2073,7 @@ _is_base_module = defined(invoker.is_base_module) && invoker.is_base_module _enable_multidex = - defined(invoker.enable_multidex) && invoker.enable_multidex + !defined(invoker.enable_multidex) || invoker.enable_multidex _final_dex_path = "$_gen_dir/classes.dex.zip" if (defined(invoker.final_apk_path)) { @@ -2636,7 +2636,7 @@ if (defined(invoker.proguard_configs)) { proguard_configs += invoker.proguard_configs } - if (_enable_multidex) { + if (_enable_main_dex_list) { proguard_configs += [ "//build/android/multidex.flags" ] } proguard_mapping_path = _proguard_mapping_path @@ -4110,7 +4110,7 @@ _proguard_enabled = defined(invoker.proguard_enabled) && invoker.proguard_enabled _enable_multidex = - defined(invoker.enable_multidex) && invoker.enable_multidex + !defined(invoker.enable_multidex) || invoker.enable_multidex if (!_proguard_enabled && defined(invoker.min_sdk_version)) { not_needed(invoker, [ "min_sdk_version" ])
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn index 1555e59..97f9e87 100644 --- a/build/config/win/BUILD.gn +++ b/build/config/win/BUILD.gn
@@ -104,6 +104,12 @@ # Tell clang which version of MSVC to emulate. cflags += [ "-fmsc-version=1911" ] + # Emit table of address-taken functions for Control-Flow Guard (CFG). We + # don't emit the CFG checks themselves, but this enables the functions to + # be called by code that is built with those checks enabled, such as system + # libraries. + cflags += [ "/guard:cf,nochecks" ] + if (is_component_build) { cflags += [ # Do not export inline member functions. This makes component builds
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 8eb4bd9..2039ce89 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -8917340288433684704 \ No newline at end of file +8917298174234173664 \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index f6581a13..7cf0c66e 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -8917337664716354304 \ No newline at end of file +8917296450736444400 \ No newline at end of file
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc index 54907fe..70f0024 100644 --- a/cc/layers/layer.cc +++ b/cc/layers/layer.cc
@@ -47,7 +47,7 @@ opacity(1.f), blend_mode(SkBlendMode::kSrcOver), is_root_for_isolated_group(false), - hit_testable(false), + hit_testable_without_draws_content(false), contents_opaque(false), is_drawable(false), double_sided(true), @@ -741,19 +741,15 @@ SetNeedsCommit(); } -void Layer::SetHitTestable(bool should_hit_test) { +void Layer::SetHitTestableWithoutDrawsContent(bool should_hit_test) { DCHECK(IsPropertyChangeAllowed()); - if (inputs_.hit_testable == should_hit_test) + if (inputs_.hit_testable_without_draws_content == should_hit_test) return; - inputs_.hit_testable = should_hit_test; + inputs_.hit_testable_without_draws_content = should_hit_test; SetPropertyTreesNeedRebuild(); SetNeedsCommit(); } -bool Layer::HitTestable() const { - return inputs_.hit_testable; -} - void Layer::SetContentsOpaque(bool opaque) { DCHECK(IsPropertyChangeAllowed()); if (inputs_.contents_opaque == opaque) @@ -1427,7 +1423,8 @@ layer->SetScrollTreeIndex(scroll_tree_index()); layer->SetOffsetToTransformParent(offset_to_transform_parent_); layer->SetDrawsContent(DrawsContent()); - layer->SetHitTestable(HitTestable()); + layer->SetHitTestableWithoutDrawsContent( + hit_testable_without_draws_content()); // subtree_property_changed_ is propagated to all descendants while building // property trees. So, it is enough to check it only for the current layer. if (subtree_property_changed_)
diff --git a/cc/layers/layer.h b/cc/layers/layer.h index 8fca418..826ba6f 100644 --- a/cc/layers/layer.h +++ b/cc/layers/layer.h
@@ -336,9 +336,15 @@ void SetContentsOpaque(bool opaque); bool contents_opaque() const { return inputs_.contents_opaque; } - // Set or get whether this layer should be a hit test target - void SetHitTestable(bool should_hit_test); - bool HitTestable() const; + // Set or get whether this layer should be a hit test target even if not + // visible. Normally if DrawsContent() is false, making the layer not + // contribute to the final composited output, the layer will not be eligable + // for hit testing since it is invisible. Set this to true to allow the layer + // to be hit tested regardless. + void SetHitTestableWithoutDrawsContent(bool should_hit_test); + bool hit_testable_without_draws_content() const { + return inputs_.hit_testable_without_draws_content; + } // Set or gets if this layer is a container for fixed position layers in its // subtree. Such layers will be positioned and transformed relative to this @@ -930,8 +936,10 @@ bool is_root_for_isolated_group : 1; - // Hit testing depends on this bit. - bool hit_testable : 1; + // Hit testing depends on draws_content (see: |LayerImpl::should_hit_test|) + // and this bit can be set to cause the LayerImpl to be hit testable without + // draws_content. + bool hit_testable_without_draws_content : 1; bool contents_opaque : 1;
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc index 36a262b3..0d9d4fb 100644 --- a/cc/layers/layer_impl.cc +++ b/cc/layers/layer_impl.cc
@@ -63,7 +63,7 @@ should_check_backface_visibility_(false), draws_content_(false), contributes_to_drawn_render_surface_(false), - hit_testable_(false), + hit_testable_without_draws_content_(false), is_resized_by_browser_controls_(false), viewport_layer_type_(NOT_VIEWPORT_LAYER), background_color_(0), @@ -324,7 +324,8 @@ layer->use_parent_backface_visibility_ = use_parent_backface_visibility_; layer->should_check_backface_visibility_ = should_check_backface_visibility_; layer->draws_content_ = draws_content_; - layer->hit_testable_ = hit_testable_; + layer->hit_testable_without_draws_content_ = + hit_testable_without_draws_content_; layer->non_fast_scrollable_region_ = non_fast_scrollable_region_; layer->touch_action_region_ = touch_action_region_; layer->wheel_event_handler_region_ = wheel_event_handler_region_; @@ -412,7 +413,8 @@ result->Set("Transform", std::move(list)); result->SetBoolean("DrawsContent", draws_content_); - result->SetBoolean("HitTestable", hit_testable_); + result->SetBoolean("HitTestableWithoutDrawsContent", + hit_testable_without_draws_content_); result->SetBoolean("Is3dSorted", Is3dSorted()); result->SetDouble("Opacity", Opacity()); result->SetBoolean("ContentsOpaque", contents_opaque_); @@ -605,25 +607,20 @@ NoteLayerPropertyChanged(); } -void LayerImpl::SetHitTestable(bool should_hit_test) { - if (hit_testable_ == should_hit_test) +void LayerImpl::SetHitTestableWithoutDrawsContent(bool should_hit_test) { + if (hit_testable_without_draws_content_ == should_hit_test) return; - hit_testable_ = should_hit_test; + hit_testable_without_draws_content_ = should_hit_test; NoteLayerPropertyChanged(); } -bool LayerImpl::HitTestable() const { - EffectTree& effect_tree = GetEffectTree(); - bool should_hit_test = hit_testable_; - // TODO(sunxd): remove or refactor SetHideLayerAndSubtree, or move this logic - // to subclasses of Layer. See https://crbug.com/595843 and - // https://crbug.com/931865. - // The bit |subtree_hidden| can only be true for ui::Layers. Other layers are - // not supposed to set this bit. - if (effect_tree.Node(effect_tree_index())) { - should_hit_test &= !effect_tree.Node(effect_tree_index())->subtree_hidden; - } +bool LayerImpl::ShouldHitTest() const { + bool should_hit_test = draws_content_; + if (GetEffectTree().Node(effect_tree_index())) + should_hit_test &= + !GetEffectTree().Node(effect_tree_index())->subtree_hidden; + should_hit_test |= hit_testable_without_draws_content_; return should_hit_test; }
diff --git a/cc/layers/layer_impl.h b/cc/layers/layer_impl.h index b98cfd6..8e6dd6c7 100644 --- a/cc/layers/layer_impl.h +++ b/cc/layers/layer_impl.h
@@ -165,9 +165,15 @@ void SetDrawsContent(bool draws_content); bool DrawsContent() const { return draws_content_; } - // Make the layer hit testable. - void SetHitTestable(bool should_hit_test); - bool HitTestable() const; + // Make the layer hit test (see: |should_hit_test|) even if !draws_content_. + void SetHitTestableWithoutDrawsContent(bool should_hit_test); + bool hit_testable_without_draws_content() const { + return hit_testable_without_draws_content_; + } + + // True if either the layer draws content or has been marked as hit testable + // without draws_content. + bool ShouldHitTest() const; LayerImplTestProperties* test_properties() { if (!test_properties_) @@ -530,8 +536,10 @@ bool draws_content_ : 1; bool contributes_to_drawn_render_surface_ : 1; - // Tracks if this layer should participate in hit testing. - bool hit_testable_ : 1; + // Hit testing depends on draws_content (see: |LayerImpl::should_hit_test|) + // and this bit can be set to cause the layer to be hit testable without + // draws_content. + bool hit_testable_without_draws_content_ : 1; bool is_resized_by_browser_controls_ : 1; // TODO(bokan): This can likely be removed after blink-gen-property-trees
diff --git a/cc/layers/layer_unittest.cc b/cc/layers/layer_unittest.cc index 9a6e3342..f207739 100644 --- a/cc/layers/layer_unittest.cc +++ b/cc/layers/layer_unittest.cc
@@ -1420,29 +1420,30 @@ LayerImpl::Create(host_impl_.active_tree(), 1); EXPECT_SET_NEEDS_FULL_TREE_SYNC(1, layer_tree_host_->SetRootLayer(root_layer)); - EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(5); + EXPECT_CALL(*layer_tree_host_, SetNeedsCommit()).Times(3); // A layer that draws content should be hit testable. root_layer->SetIsDrawable(true); - root_layer->SetHitTestable(true); root_layer->PushPropertiesTo(impl_layer.get()); EXPECT_TRUE(impl_layer->DrawsContent()); - EXPECT_TRUE(impl_layer->HitTestable()); + EXPECT_FALSE(impl_layer->hit_testable_without_draws_content()); + EXPECT_TRUE(impl_layer->ShouldHitTest()); // A layer that does not draw content and does not hit test without drawing // content should not be hit testable. root_layer->SetIsDrawable(false); - root_layer->SetHitTestable(false); root_layer->PushPropertiesTo(impl_layer.get()); EXPECT_FALSE(impl_layer->DrawsContent()); - EXPECT_FALSE(impl_layer->HitTestable()); + EXPECT_FALSE(impl_layer->hit_testable_without_draws_content()); + EXPECT_FALSE(impl_layer->ShouldHitTest()); // |SetHitTestableWithoutDrawsContent| should cause a layer to become hit // testable even though it does not draw content. - root_layer->SetHitTestable(true); + root_layer->SetHitTestableWithoutDrawsContent(true); root_layer->PushPropertiesTo(impl_layer.get()); EXPECT_FALSE(impl_layer->DrawsContent()); - EXPECT_TRUE(impl_layer->HitTestable()); + EXPECT_TRUE(impl_layer->hit_testable_without_draws_content()); + EXPECT_TRUE(impl_layer->ShouldHitTest()); } void ReceiveCopyOutputResult(int* result_count,
diff --git a/cc/paint/paint_image_builder.cc b/cc/paint/paint_image_builder.cc index 59d2db1..d8b3199f 100644 --- a/cc/paint/paint_image_builder.cc +++ b/cc/paint/paint_image_builder.cc
@@ -4,8 +4,6 @@ #include "cc/paint/paint_image_builder.h" -#include "build/build_config.h" - namespace cc { // static @@ -79,14 +77,6 @@ } #endif -#if defined(MEMORY_SANITIZER) && !defined(OS_NACL) - if (paint_image_.sk_image_ && !paint_image_.sk_image_->isTextureBacked()) { - SkBitmap bm; - if (paint_image_.sk_image_->asLegacyBitmap(&bm)) - MSAN_CHECK_MEM_IS_INITIALIZED(bm.getPixels(), bm.computeByteSize()); - } -#endif - // We may already have a cached_sk_image_ if this builder was created with a // copy. if (!paint_image_.cached_sk_image_)
diff --git a/cc/test/layer_tree_json_parser.cc b/cc/test/layer_tree_json_parser.cc index a7819bc..8d600d5 100644 --- a/cc/test/layer_tree_json_parser.cc +++ b/cc/test/layer_tree_json_parser.cc
@@ -35,14 +35,6 @@ bool draws_content; success &= dict->GetBoolean("DrawsContent", &draws_content); - bool hit_testable; - // If we cannot load hit_testable, we may try loading the old version, since - // we do not record |hit_testable_without_draws_content| in the past, we use - // |draws_content| as the value of |hit_testable|. - if (!dict->GetBoolean("HitTestable", &hit_testable)) { - hit_testable = draws_content; - } - scoped_refptr<Layer> new_layer; if (layer_type == "SolidColorLayer") { new_layer = SolidColorLayer::Create(); @@ -92,7 +84,6 @@ } new_layer->SetBounds(gfx::Size(width, height)); new_layer->SetIsDrawable(draws_content); - new_layer->SetHitTestable(hit_testable); double opacity; if (dict->GetDouble("Opacity", &opacity))
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 08818c80..8526bd0 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc
@@ -159,7 +159,6 @@ const gfx::Rect& rect, SkColor color) { scoped_refptr<SolidColorLayer> layer = SolidColorLayer::Create(); layer->SetIsDrawable(true); - layer->SetHitTestable(true); layer->SetBounds(rect.size()); layer->SetPosition(gfx::PointF(rect.origin())); layer->SetOffsetToTransformParent(
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 4e25ae1..d2a248a 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc
@@ -158,11 +158,9 @@ inner_viewport_container_layer->SetBounds(inner_bounds); inner_viewport_scroll_layer->SetScrollable(inner_bounds); - inner_viewport_scroll_layer->SetHitTestable(true); inner_viewport_scroll_layer->SetBounds(outer_bounds); outer_viewport_container_layer->SetBounds(outer_bounds); outer_scroll_layer->SetScrollable(outer_bounds); - outer_scroll_layer->SetHitTestable(true); inner_viewport_scroll_layer->SetIsContainerForFixedPositionLayers(true); outer_scroll_layer->SetIsContainerForFixedPositionLayers(true); @@ -186,7 +184,6 @@ outer_viewport_scroll_layer->SetBounds(scroll_bounds); outer_viewport_scroll_layer->SetIsDrawable(true); - outer_viewport_scroll_layer->SetHitTestable(true); CreateVirtualViewportLayers(root_layer, outer_viewport_scroll_layer, inner_bounds, outer_bounds, host); } @@ -440,6 +437,7 @@ void DidBeginMainFrame() override { test_hooks_->DidBeginMainFrame(); } + void WillUpdateLayers() override {} void DidUpdateLayers() override {} void BeginMainFrame(const viz::BeginFrameArgs& args) override { @@ -908,7 +906,6 @@ initial_device_scale_factor_, viz::LocalSurfaceIdAllocation()); layer_tree_host()->root_layer()->SetIsDrawable(true); - layer_tree_host()->root_layer()->SetHitTestable(true); layer_tree_host()->SetElementIdsForTesting(); }
diff --git a/cc/test/stub_layer_tree_host_client.h b/cc/test/stub_layer_tree_host_client.h index af112eb..b3a0db3 100644 --- a/cc/test/stub_layer_tree_host_client.h +++ b/cc/test/stub_layer_tree_host_client.h
@@ -17,6 +17,7 @@ // LayerTreeHostClient implementation. void WillBeginMainFrame() override {} void DidBeginMainFrame() override {} + void WillUpdateLayers() override {} void DidUpdateLayers() override {} void BeginMainFrame(const viz::BeginFrameArgs& args) override {} void RecordStartOfFrameMetrics() override {}
diff --git a/cc/tiles/gpu_image_decode_cache.cc b/cc/tiles/gpu_image_decode_cache.cc index 35bce70ff..96b32a6 100644 --- a/cc/tiles/gpu_image_decode_cache.cc +++ b/cc/tiles/gpu_image_decode_cache.cc
@@ -251,9 +251,6 @@ } return paint_image.Decode(pixmap.writable_addr(), &info, color_space, draw_image.frame_index(), client_id); - - MSAN_CHECK_MEM_IS_INITIALIZED(target_pixmap->addr(), - target_pixmap->computeByteSize()); } // If we can't decode/scale directly, we will handle this in 2 steps. @@ -306,9 +303,6 @@ if (initial_decode_failed) return false; - MSAN_CHECK_MEM_IS_INITIALIZED(decode_bitmap.getPixels(), - decode_bitmap.computeByteSize()); - if (decode_to_f16_using_n32_intermediate) { return ImageDecodeCacheUtils::ScaleToHalfFloatPixmapUsingN32Intermediate( decode_pixmap, &pixmap, filter_quality); @@ -346,13 +340,7 @@ unscaled_pixmap_v.scalePixels(*pixmap_v, filter_quality); return all_planes_scaled_successfully; } - - if (decode_pixmap.scalePixels(pixmap, filter_quality)) { - MSAN_CHECK_MEM_IS_INITIALIZED(target_pixmap->addr(), - target_pixmap->computeByteSize()); - return true; - } - return false; + return decode_pixmap.scalePixels(pixmap, filter_quality); } // Takes ownership of the backing texture of an SkImage. This allows us to
diff --git a/cc/tiles/software_image_decode_cache_utils.cc b/cc/tiles/software_image_decode_cache_utils.cc index 375d81cb..fac25c22 100644 --- a/cc/tiles/software_image_decode_cache_utils.cc +++ b/cc/tiles/software_image_decode_cache_utils.cc
@@ -77,8 +77,6 @@ bool result = paint_image.Decode(target_pixels->data(), &target_info, std::move(color_space), key.frame_key().frame_index(), client_id); - MSAN_CHECK_MEM_IS_INITIALIZED( - target_pixels->data(), target_info.minRowBytes() * target_info.height()); if (!result) { target_pixels->Unlock(); return nullptr; @@ -110,9 +108,6 @@ bool result = candidate_image.image()->readPixels( target_info, target_pixels->data(), target_info.minRowBytes(), key.src_rect().x(), key.src_rect().y(), SkImage::kDisallow_CachingHint); - MSAN_CHECK_MEM_IS_INITIALIZED( - target_pixels->data(), - target_info.minRowBytes() * target_info.height()); // We have a decoded image, and we're reading into already allocated memory. // This should never fail. DCHECK(result) << key.ToString(); @@ -150,8 +145,6 @@ } else { result = decoded_pixmap.scalePixels(target_pixmap, filter_quality); } - MSAN_CHECK_MEM_IS_INITIALIZED( - target_pixels->data(), target_info.minRowBytes() * target_info.height()); DCHECK(result) << key.ToString(); return std::make_unique<CacheEntry>(
diff --git a/cc/trees/effect_node.h b/cc/trees/effect_node.h index f9ad9713..7302bcee 100644 --- a/cc/trees/effect_node.h +++ b/cc/trees/effect_node.h
@@ -79,6 +79,9 @@ bool has_masking_child : 1; // Whether this node has a mask. This bit is not used when using layer lists. bool is_masked : 1; + // Whether layers associated with this node have a mask or ancestor mask that + // could affect the layer's hit testable bit. + bool hit_test_may_be_affected_by_mask : 1; // Whether this node's effect has been changed since the last // frame. Needed in order to compute damage rect. bool effect_changed : 1;
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc index b0efcfc..35a22bd 100644 --- a/cc/trees/layer_tree_host.cc +++ b/cc/trees/layer_tree_host.cc
@@ -690,6 +690,7 @@ DCHECK(!root_layer()->parent()); base::ElapsedTimer timer; + client_->WillUpdateLayers(); bool result = DoUpdateLayers(); client_->DidUpdateLayers(); micro_benchmark_controller_.DidUpdateLayers();
diff --git a/cc/trees/layer_tree_host_client.h b/cc/trees/layer_tree_host_client.h index 63fdda76..b54c5c1a 100644 --- a/cc/trees/layer_tree_host_client.h +++ b/cc/trees/layer_tree_host_client.h
@@ -85,6 +85,7 @@ virtual void BeginMainFrameNotExpectedSoon() = 0; virtual void BeginMainFrameNotExpectedUntil(base::TimeTicks time) = 0; virtual void DidBeginMainFrame() = 0; + virtual void WillUpdateLayers() = 0; virtual void DidUpdateLayers() = 0; // Visual frame-based updates to the state of the LayerTreeHost are expected
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index ea159a8..c0eb10a 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -2625,13 +2625,7 @@ // a result we do async hit test on any surface layers that bool assume_overlap = false; for (const auto* layer : base::Reversed(*active_tree())) { - // Viz hit test needs to collect information for pointer-events: none OOPIFs - // as well. Now Layer::HitTestable ignores pointer-events property, but this - // early out will not work correctly if we integrate has_pointer_events_none - // into Layer::HitTestable, so we make sure we don't skip surface layers - // that draws content but has pointer-events: none property. - if (!(layer->HitTestable() || - (layer->is_surface_layer() && layer->DrawsContent()))) + if (!layer->ShouldHitTest()) continue; if (layer->is_surface_layer()) {
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc index 478127f..6602005a 100644 --- a/cc/trees/layer_tree_host_impl_unittest.cc +++ b/cc/trees/layer_tree_host_impl_unittest.cc
@@ -394,7 +394,6 @@ LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); inner_scroll->SetScrollable(viewport_scroll_bounds); - inner_scroll->SetHitTestable(true); inner_scroll->SetElementId( LayerIdToElementIdForTesting(inner_scroll->id())); inner_scroll->SetBounds(content_size); @@ -409,7 +408,6 @@ std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); outer_scroll->SetScrollable(content_size); - outer_scroll->SetHitTestable(true); outer_scroll->SetElementId( LayerIdToElementIdForTesting(outer_scroll->id())); outer_scroll->layer_tree_impl() @@ -467,7 +465,6 @@ std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); scroll->SetBounds(scroll_content_size); scroll->SetScrollable(content_size); - scroll->SetHitTestable(true); scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); scroll->SetDrawsContent(true); @@ -487,17 +484,15 @@ squash1->test_properties()->opacity = 0.0f; // The transparent layer should still participate in hit testing even // through it does not draw content. - squash1->SetHitTestable(true); + squash1->SetHitTestableWithoutDrawsContent(true); } else { squash1->SetDrawsContent(true); - squash1->SetHitTestable(true); } std::unique_ptr<LayerImpl> squash2 = LayerImpl::Create(layer_tree_impl, 6); squash2->SetBounds(gfx::Size(140, 300)); squash2->test_properties()->position = gfx::PointF(220, 300); squash2->SetDrawsContent(true); - squash2->SetHitTestable(true); scroll->test_properties()->AddChild(std::move(squash2)); root->test_properties()->AddChild(std::move(scroll)); @@ -545,7 +540,6 @@ content_layer->SetBounds(content_size); host_impl_->OuterViewportScrollLayer()->SetBounds(content_size); host_impl_->OuterViewportScrollLayer()->SetScrollable(viewport_size); - host_impl_->OuterViewportScrollLayer()->SetHitTestable(true); LayerImpl* outer_clip = host_impl_->OuterViewportScrollLayer()->test_properties()->parent; @@ -558,7 +552,6 @@ inner_clip_layer->SetBounds(viewport_size); host_impl_->InnerViewportScrollLayer()->SetBounds(viewport_size); host_impl_->InnerViewportScrollLayer()->SetScrollable(viewport_size); - host_impl_->InnerViewportScrollLayer()->SetHitTestable(true); host_impl_->active_tree()->BuildPropertyTreesForTesting(); @@ -578,7 +571,6 @@ gfx::Size scroll_container_bounds = gfx::Size(size.width() / 2, size.height() / 2); layer->SetScrollable(scroll_container_bounds); - layer->SetHitTestable(true); return layer; } @@ -718,7 +710,6 @@ LayerImpl* overflow = scroll_layer->test_properties()->children[0]; overflow->SetBounds(overflow_size); overflow->SetScrollable(gfx::Size(100, 100)); - overflow->SetHitTestable(true); overflow->SetElementId(LayerIdToElementIdForTesting(overflow->id())); overflow->layer_tree_impl() ->property_trees() @@ -1044,7 +1035,6 @@ root->SetBounds(gfx::Size(110, 110)); root->SetScrollable(gfx::Size(10, 10)); - root->SetHitTestable(true); root->SetElementId(LayerIdToElementIdForTesting(root->id())); root->layer_tree_impl() ->property_trees() @@ -1344,10 +1334,8 @@ std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 3); scroll->SetBounds(scroll_content_size); scroll->SetScrollable(content_size); - scroll->SetHitTestable(true); scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); scroll->SetDrawsContent(true); - scroll->SetHitTestable(true); std::unique_ptr<SolidColorScrollbarLayerImpl> drawn_scrollbar = SolidColorScrollbarLayerImpl::Create(layer_tree_impl, 4, VERTICAL, 10, 0, @@ -1356,14 +1344,12 @@ drawn_scrollbar->test_properties()->position = gfx::PointF(345, 0); drawn_scrollbar->SetScrollElementId(scroll->element_id()); drawn_scrollbar->SetDrawsContent(true); - drawn_scrollbar->SetHitTestable(true); drawn_scrollbar->test_properties()->opacity = 1.f; std::unique_ptr<LayerImpl> squash = LayerImpl::Create(layer_tree_impl, 5); squash->SetBounds(gfx::Size(140, 300)); squash->test_properties()->position = gfx::PointF(220, 0); squash->SetDrawsContent(true); - squash->SetHitTestable(true); scroll->test_properties()->AddChild(std::move(drawn_scrollbar)); scroll->test_properties()->AddChild(std::move(squash)); @@ -1789,7 +1775,6 @@ LayerImpl* overflow = scroll_layer->test_properties()->children[0]; overflow->SetBounds(overflow_size); overflow->SetScrollable(gfx::Size(100, 100)); - overflow->SetHitTestable(true); overflow->SetElementId(LayerIdToElementIdForTesting(overflow->id())); overflow->layer_tree_impl() ->property_trees() @@ -1959,7 +1944,6 @@ LayerImpl* overflow = scroll_layer->test_properties()->children[0]; overflow->SetBounds(overflow_size); overflow->SetScrollable(gfx::Size(100, 100)); - overflow->SetHitTestable(true); overflow->SetElementId(LayerIdToElementIdForTesting(overflow->id())); overflow->layer_tree_impl() ->property_trees() @@ -2402,7 +2386,6 @@ // frame (outer viewport) such that it matches the width of the content, // preventing horizontal scrolling. Replicate that behavior here. host_impl_->OuterViewportScrollLayer()->SetScrollable(outer_viewport_size); - host_impl_->OuterViewportScrollLayer()->SetHitTestable(true); LayerImpl* outer_clip = host_impl_->OuterViewportScrollLayer()->test_properties()->parent; outer_clip->SetBounds(outer_viewport_size); @@ -4028,7 +4011,6 @@ child->SetBounds(child_layer_size); child->SetDrawsContent(true); child->SetScrollable(gfx::Size(100, 100)); - child->SetHitTestable(true); child->SetElementId(LayerIdToElementIdForTesting(child->id())); ElementId child_element_id = child->element_id(); @@ -4354,7 +4336,6 @@ // Check scrollbar registration on a sublayer. child->SetScrollable(viewport_size); - child->SetHitTestable(true); child->SetElementId(LayerIdToElementIdForTesting(child->id())); ElementId child_scroll_element_id = child->element_id(); root_scroll->test_properties()->AddChild(std::move(child)); @@ -5937,7 +5918,6 @@ LayerImpl::Create(host_impl_->active_tree(), id + 2); child->SetScrollable(sub_content_layer_size); - child->SetHitTestable(true); child->SetElementId(LayerIdToElementIdForTesting(child->id())); child->SetBounds(sub_content_size); child->test_properties()->position = gfx::PointF(); @@ -6492,7 +6472,6 @@ std::unique_ptr<LayerImpl> scroll_layer = LayerImpl::Create(host_impl_->active_tree(), 12); scroll_layer->SetScrollable(surface_size); - scroll_layer->SetHitTestable(true); scroll_layer->SetElementId(LayerIdToElementIdForTesting(scroll_layer->id())); scroll_layer->SetBounds(contents_size); scroll_layer->test_properties()->position = gfx::PointF(); @@ -7155,7 +7134,6 @@ child->test_properties()->is_container_for_fixed_position_layers = true; root_scroll->SetBounds(content_size); child->SetScrollable(content_size); - child->SetHitTestable(true); ElementId root_scroll_id = root_scroll->element_id(); root_scroll->test_properties()->AddChild(std::move(child)); @@ -7357,7 +7335,6 @@ gfx::Size(child->bounds().width(), child->bounds().height() / 2); clip_layer->SetBounds(scroll_container_bounds); child->SetScrollable(scroll_container_bounds); - child->SetHitTestable(true); // The rotation depends on the layer's transform origin, and the child layer // is a different size than the clip, so make sure the clip layer's origin // lines up over the child. @@ -7591,7 +7568,6 @@ scroll_layer->test_properties()->parent->test_properties()->parent; clip_layer->SetBounds(gfx::Size(10, 20)); scroll_layer->SetScrollable(gfx::Size(10, 20)); - scroll_layer->SetHitTestable(true); host_impl_->active_tree()->BuildPropertyTreesForTesting(); host_impl_->BindToClient(&scroll_watcher); @@ -7705,7 +7681,6 @@ scroll_layer->test_properties()->parent->test_properties()->parent; clip_layer->SetBounds(gfx::Size(10, 20)); scroll_layer->SetScrollable(gfx::Size(10, 20)); - scroll_layer->SetHitTestable(true); scroll_layer->SetDrawsContent(true); // Draw first frame to clear any pending draws and check scroll. @@ -7736,7 +7711,6 @@ scroll_layer->test_properties()->parent->test_properties()->parent; clip_layer->SetBounds(gfx::Size(10, 20)); scroll_layer->SetScrollable(gfx::Size(10, 20)); - scroll_layer->SetHitTestable(true); scroll_layer->SetDrawsContent(true); host_impl_->active_tree() ->InnerViewportScrollLayer() @@ -8048,7 +8022,6 @@ clip_layer->SetBounds(gfx::Size(50, 50)); scroll_layer->SetScrollable(gfx::Size(50, 50)); - scroll_layer->SetHitTestable(true); host_impl_->active_tree()->BuildPropertyTreesForTesting(); host_impl_->active_tree()->SetDeviceViewportSize(gfx::Size(50, 50)); @@ -8157,7 +8130,6 @@ std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); scroll->SetBounds(gfx::Size(400, 400)); scroll->SetScrollable(content_size); - scroll->SetHitTestable(true); scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); scroll->SetDrawsContent(true); @@ -8279,7 +8251,6 @@ std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); scroll->SetBounds(gfx::Size(400, 400)); scroll->SetScrollable(viewport_size); - scroll->SetHitTestable(true); scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); scroll->SetDrawsContent(true); @@ -8368,14 +8339,12 @@ std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); scroll->SetBounds(gfx::Size(400, 400)); scroll->SetScrollable(content_size); - scroll->SetHitTestable(true); scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); scroll->SetDrawsContent(true); std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 13); scroll2->SetBounds(gfx::Size(500, 500)); scroll2->SetScrollable(gfx::Size(300, 300)); - scroll2->SetHitTestable(true); scroll2->SetElementId(LayerIdToElementIdForTesting(scroll2->id())); scroll2->SetDrawsContent(true); @@ -8493,7 +8462,6 @@ std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); scroll->SetBounds(gfx::Size(1200, 1200)); scroll->SetScrollable(content_size); - scroll->SetHitTestable(true); scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); scroll->SetDrawsContent(true); @@ -8505,7 +8473,6 @@ std::unique_ptr<LayerImpl> scroll2 = LayerImpl::Create(layer_tree_impl, 15); scroll2->SetBounds(gfx::Size(1200, 1200)); scroll2->SetScrollable(gfx::Size(600, 600)); - scroll2->SetHitTestable(true); scroll2->SetElementId(LayerIdToElementIdForTesting(scroll2->id())); scroll2->SetDrawsContent(true); @@ -9749,7 +9716,6 @@ gfx::ScrollOffset scroll_offset(100000, 0); scrolling_layer->SetScrollable(content_layer_bounds); - scrolling_layer->SetHitTestable(true); scrolling_layer->SetElementId( LayerIdToElementIdForTesting(scrolling_layer->id())); host_impl_->pending_tree()->BuildPropertyTreesForTesting(); @@ -10254,7 +10220,6 @@ LayerImpl* scroll_layer = host_impl_->active_tree()->LayerById(scroll_layer_id); scroll_layer->SetDrawsContent(true); - scroll_layer->SetHitTestable(true); int page_scale_layer_id = 5; LayerImpl* page_scale_layer = @@ -10264,7 +10229,6 @@ std::unique_ptr<LayerImpl> occluder_layer = LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id); occluder_layer->SetDrawsContent(true); - occluder_layer->SetHitTestable(true); occluder_layer->SetBounds(content_size); occluder_layer->test_properties()->position = gfx::PointF(); @@ -10292,13 +10256,11 @@ LayerImpl* scroll_layer = host_impl_->active_tree()->LayerById(scroll_layer_id); scroll_layer->SetDrawsContent(true); - scroll_layer->SetHitTestable(true); int occluder_layer_id = 6; std::unique_ptr<LayerImpl> occluder_layer = LayerImpl::Create(host_impl_->active_tree(), occluder_layer_id); occluder_layer->SetDrawsContent(true); - occluder_layer->SetHitTestable(true); occluder_layer->SetBounds(content_size); occluder_layer->test_properties()->position = gfx::PointF(-10.f, -10.f); @@ -11167,7 +11129,6 @@ std::unique_ptr<LayerImpl> scroll = LayerImpl::Create(layer_tree_impl, 11); scroll->SetBounds(scroll_content_size); scroll->SetScrollable(root_layer_size); - scroll->SetHitTestable(true); scroll->SetElementId(LayerIdToElementIdForTesting(scroll->id())); scroll->SetDrawsContent(true); @@ -11236,7 +11197,6 @@ LayerImpl::Create(layer_tree_impl, kPageScaleLayerId); inner_scroll->SetScrollable(inner_viewport); - inner_scroll->SetHitTestable(true); inner_scroll->SetElementId( LayerIdToElementIdForTesting(inner_scroll->id())); inner_scroll->SetBounds(outer_viewport); @@ -11251,7 +11211,6 @@ std::unique_ptr<LayerImpl> outer_scroll = LayerImpl::Create(layer_tree_impl, kOuterViewportScrollLayerId); outer_scroll->SetScrollable(outer_viewport); - outer_scroll->SetHitTestable(true); outer_scroll->SetElementId( LayerIdToElementIdForTesting(outer_scroll->id())); outer_scroll->layer_tree_impl() @@ -13482,7 +13441,6 @@ child->SetBounds(child_layer_size); child->SetDrawsContent(true); child->SetScrollable(gfx::Size(100, 100)); - child->SetHitTestable(true); child->SetElementId(LayerIdToElementIdForTesting(child->id())); ElementId child_element_id = child->element_id(); @@ -14137,19 +14095,16 @@ rotate.Rotate(45); surface_child1->test_properties()->transform = rotate; surface_child1->SetDrawsContent(true); - surface_child1->SetHitTestable(true); surface_child1->SetSurfaceHitTestable(true); surface_child2->test_properties()->position = gfx::PointF(450, 300); surface_child2->SetBounds(gfx::Size(100, 100)); surface_child2->SetDrawsContent(true); - surface_child2->SetHitTestable(true); surface_child2->SetSurfaceHitTestable(true); overlapping_layer->test_properties()->position = gfx::PointF(500, 350); overlapping_layer->SetBounds(gfx::Size(200, 200)); overlapping_layer->SetDrawsContent(true); - overlapping_layer->SetHitTestable(true); viz::LocalSurfaceId child_local_surface_id(2, base::UnguessableToken::Create()); @@ -14246,14 +14201,12 @@ surface_child1->test_properties()->position = gfx::PointF(0, 0); surface_child1->SetBounds(gfx::Size(100, 100)); surface_child1->SetDrawsContent(true); - surface_child1->SetHitTestable(true); surface_child1->SetSurfaceHitTestable(true); surface_child1->SetHasPointerEventsNone(false); surface_child2->test_properties()->position = gfx::PointF(50, 50); surface_child2->SetBounds(gfx::Size(100, 100)); surface_child2->SetDrawsContent(true); - surface_child2->SetHitTestable(true); surface_child2->SetSurfaceHitTestable(false); surface_child2->SetHasPointerEventsNone(true); @@ -14326,7 +14279,6 @@ surface_child->test_properties()->position = gfx::PointF(0, 0); surface_child->SetBounds(gfx::Size(100, 100)); surface_child->SetDrawsContent(true); - surface_child->SetHitTestable(true); surface_child->SetSurfaceHitTestable(true); surface_child->SetHasPointerEventsNone(false); @@ -14352,7 +14304,6 @@ layer->test_properties()->position = gfx::PointF(110, 110); layer->SetBounds(gfx::Size(1, 1)); layer->SetDrawsContent(true); - layer->SetHitTestable(true); host_impl_->active_tree() ->root_layer_for_testing() ->test_properties()
diff --git a/cc/trees/layer_tree_host_unittest_scroll.cc b/cc/trees/layer_tree_host_unittest_scroll.cc index 667f67d..6a6f99b 100644 --- a/cc/trees/layer_tree_host_unittest_scroll.cc +++ b/cc/trees/layer_tree_host_unittest_scroll.cc
@@ -599,7 +599,6 @@ child_layer_->SetIsDrawable(true); child_layer_->SetScrollable(root_layer->bounds()); - child_layer_->SetHitTestable(true); child_layer_->SetElementId( LayerIdToElementIdForTesting(child_layer_->id())); child_layer_->SetBounds(root_scroll_layer_->bounds()); @@ -1131,7 +1130,6 @@ switch (layer_tree_host()->SourceFrameNumber()) { case 0: scroll_layer->SetScrollable(root->bounds()); - scroll_layer->SetHitTestable(true); // Set max_scroll_offset = (100, 100). scroll_layer->SetBounds(gfx::Size(root->bounds().width() + 100, root->bounds().height() + 100)); @@ -1412,7 +1410,6 @@ scroll_layer->SetPosition(gfx::PointF()); scroll_layer->SetIsDrawable(true); scroll_layer->SetScrollable(parent->bounds()); - scroll_layer->SetHitTestable(true); scroll_layer->SetElementId( LayerIdToElementIdForTesting(scroll_layer->id())); scroll_layer->SetBounds(gfx::Size(parent->bounds().width() + 100,
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc index 5d01b81..4fad6b06 100644 --- a/cc/trees/layer_tree_impl.cc +++ b/cc/trees/layer_tree_impl.cc
@@ -2174,7 +2174,10 @@ } struct HitTestVisibleScrollableOrTouchableFunctor { - bool operator()(LayerImpl* layer) const { return layer->HitTestable(); } + bool operator()(LayerImpl* layer) const { + return layer->scrollable() || layer->ShouldHitTest() || + !layer->touch_action_region().region().IsEmpty(); + } }; LayerImpl* LayerTreeImpl::FindLayerThatIsHitByPoint(
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc index e703093..c752ebca 100644 --- a/cc/trees/layer_tree_impl_unittest.cc +++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -77,7 +77,6 @@ root->test_properties()->sorting_context_id = root_sorting_context; root->SetBounds(bounds); root->SetDrawsContent(true); - root->SetHitTestable(true); } { gfx::Transform translate_z; @@ -87,7 +86,6 @@ left_child_sorting_context; left_child->SetBounds(bounds); left_child->SetDrawsContent(true); - left_child->SetHitTestable(true); left_child->test_properties()->should_flatten_transform = false; } { @@ -98,7 +96,6 @@ right_child_sorting_context; right_child->SetBounds(bounds); right_child->SetDrawsContent(true); - right_child->SetHitTestable(true); } root->test_properties()->AddChild(std::move(left_child)); @@ -127,7 +124,6 @@ LayerImpl* root = root_layer(); root->SetBounds(bounds); root->SetDrawsContent(true); - root->SetHitTestable(true); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -167,7 +163,6 @@ LayerImpl* root = root_layer(); root->SetBounds(bounds); root->SetDrawsContent(true); - root->SetHitTestable(true); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -190,14 +185,12 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); // Create hud and add it as a child of root. std::unique_ptr<HeadsUpDisplayLayerImpl> hud = HeadsUpDisplayLayerImpl::Create(host_impl().active_tree(), 11111); hud->SetBounds(gfx::Size(200, 200)); hud->SetDrawsContent(true); - hud->SetHitTestable(true); host_impl().active_tree()->SetDeviceViewportSize(hud->bounds()); host_impl().active_tree()->set_hud_layer(hud.get()); @@ -246,7 +239,6 @@ root->test_properties()->transform = uninvertible_transform; root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -303,7 +295,6 @@ test_layer->test_properties()->position = gfx::PointF(50.f, 50.f); test_layer->SetBounds(gfx::Size(100, 100)); test_layer->SetDrawsContent(true); - test_layer->SetHitTestable(true); root_layer()->test_properties()->AddChild(std::move(test_layer)); } @@ -352,7 +343,6 @@ root->test_properties()->transform = rotation45_degrees_about_center; root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -424,7 +414,6 @@ LayerImpl::Create(host_impl().active_tree(), 5); test->SetBounds(gfx::Size(100, 100)); test->SetDrawsContent(true); - test->SetHitTestable(true); clip->test_properties()->AddChild(std::move(test)); scale->test_properties()->AddChild(std::move(clip)); @@ -456,14 +445,12 @@ child1->SetBounds(gfx::Size(25, 25)); child1->SetMasksToBounds(true); child1->SetDrawsContent(true); - child1->SetHitTestable(true); std::unique_ptr<LayerImpl> child2 = LayerImpl::Create(host_impl().active_tree(), 3); child2->SetBounds(gfx::Size(75, 75)); child2->SetMasksToBounds(true); child2->SetDrawsContent(true); - child2->SetHitTestable(true); root->test_properties()->AddChild(std::move(child1)); root->test_properties()->AddChild(std::move(child2)); @@ -493,7 +480,6 @@ (perspective_projection_about_center * translation_by_z); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -549,7 +535,6 @@ child->test_properties()->position = gfx::PointF(-50.f, -50.f); child->SetBounds(gfx::Size(300, 300)); child->SetDrawsContent(true); - child->SetHitTestable(true); clipping_layer->test_properties()->AddChild(std::move(child)); root->test_properties()->AddChild(std::move(clipping_layer)); } @@ -644,7 +629,6 @@ rotated_leaf->SetBounds(gfx::Size(100, 100)); rotated_leaf->test_properties()->transform = rotated_leaf_transform; rotated_leaf->SetDrawsContent(true); - rotated_leaf->SetHitTestable(true); grand_child->test_properties()->AddChild(std::move(rotated_leaf)); child->test_properties()->AddChild(std::move(grand_child)); @@ -728,7 +712,6 @@ gfx::PointF(60.f, 60.f); // 70, 70 in screen spae child->SetBounds(gfx::Size(20, 20)); child->SetDrawsContent(true); - child->SetHitTestable(true); intermediate_layer->test_properties()->AddChild(std::move(child)); root->test_properties()->AddChild(std::move(intermediate_layer)); } @@ -771,7 +754,6 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); { // child 1 and child2 are initialized to overlap between x=50 and x=60. // grand_child is set to overlap both child1 and child2 between y=50 and @@ -789,12 +771,10 @@ child1->test_properties()->position = gfx::PointF(10.f, 10.f); child1->SetBounds(gfx::Size(50, 50)); child1->SetDrawsContent(true); - child1->SetHitTestable(true); child2->test_properties()->position = gfx::PointF(50.f, 10.f); child2->SetBounds(gfx::Size(50, 50)); child2->SetDrawsContent(true); - child2->SetHitTestable(true); // Remember that grand_child is positioned with respect to its parent (i.e. // child1). In screen space, the intended position is (10, 50), with size @@ -802,7 +782,6 @@ grand_child1->test_properties()->position = gfx::PointF(0.f, 40.f); grand_child1->SetBounds(gfx::Size(100, 50)); grand_child1->SetDrawsContent(true); - grand_child1->SetHitTestable(true); child1->test_properties()->AddChild(std::move(grand_child1)); root->test_properties()->AddChild(std::move(child1)); @@ -919,7 +898,6 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); root->test_properties()->should_flatten_transform = false; root->test_properties()->sorting_context_id = 1; { @@ -939,7 +917,6 @@ child1->test_properties()->position = gfx::PointF(10.f, 10.f); child1->SetBounds(gfx::Size(50, 50)); child1->SetDrawsContent(true); - child1->SetHitTestable(true); child1->test_properties()->should_flatten_transform = false; child1->test_properties()->sorting_context_id = 1; @@ -949,7 +926,6 @@ translate_z.Translate3d(0, 0, 10.f); child2->test_properties()->transform = translate_z; child2->SetDrawsContent(true); - child2->SetHitTestable(true); child2->test_properties()->should_flatten_transform = false; child2->test_properties()->sorting_context_id = 1; @@ -959,7 +935,6 @@ grand_child1->test_properties()->position = gfx::PointF(0.f, 40.f); grand_child1->SetBounds(gfx::Size(100, 50)); grand_child1->SetDrawsContent(true); - grand_child1->SetHitTestable(true); grand_child1->test_properties()->should_flatten_transform = false; child1->test_properties()->AddChild(std::move(grand_child1)); @@ -1033,7 +1008,6 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); { std::unique_ptr<LayerImpl> child = LayerImpl::Create(host_impl().active_tree(), 2); @@ -1043,13 +1017,11 @@ child->test_properties()->position = gfx::PointF(10.f, 10.f); child->SetBounds(gfx::Size(1, 1)); child->SetDrawsContent(true); - child->SetHitTestable(true); child->SetMasksToBounds(true); grand_child->test_properties()->position = gfx::PointF(0.f, 40.f); grand_child->SetBounds(gfx::Size(100, 50)); grand_child->SetDrawsContent(true); - grand_child->SetHitTestable(true); grand_child->test_properties()->force_render_surface = true; // This should let |grand_child| "escape" |child|'s clip. @@ -1077,7 +1049,6 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); { std::unique_ptr<LayerImpl> child = LayerImpl::Create(host_impl().active_tree(), 2); @@ -1089,12 +1060,10 @@ child->test_properties()->position = gfx::PointF(10.f, 10.f); child->SetBounds(gfx::Size(1, 1)); child->SetDrawsContent(true); - child->SetHitTestable(true); child->SetMasksToBounds(true); scroll_child->SetBounds(gfx::Size(200, 200)); scroll_child->SetDrawsContent(true); - scroll_child->SetHitTestable(true); // This should cause scroll child and its descendants to be affected by // |child|'s clip. @@ -1102,7 +1071,6 @@ grand_child->SetBounds(gfx::Size(200, 200)); grand_child->SetDrawsContent(true); - grand_child->SetHitTestable(true); grand_child->test_properties()->force_render_surface = true; scroll_child->test_properties()->AddChild(std::move(grand_child)); @@ -1129,7 +1097,6 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); { // child 1 and child2 are initialized to overlap between x=50 and x=60. // grand_child is set to overlap both child1 and child2 between y=50 and @@ -1147,13 +1114,11 @@ child1->test_properties()->position = gfx::PointF(10.f, 10.f); child1->SetBounds(gfx::Size(50, 50)); child1->SetDrawsContent(true); - child1->SetHitTestable(true); child1->test_properties()->force_render_surface = true; child2->test_properties()->position = gfx::PointF(50.f, 10.f); child2->SetBounds(gfx::Size(50, 50)); child2->SetDrawsContent(true); - child2->SetHitTestable(true); child2->test_properties()->force_render_surface = true; // Remember that grand_child is positioned with respect to its parent (i.e. @@ -1162,7 +1127,6 @@ grand_child1->test_properties()->position = gfx::PointF(0.f, 40.f); grand_child1->SetBounds(gfx::Size(100, 50)); grand_child1->SetDrawsContent(true); - grand_child1->SetHitTestable(true); grand_child1->test_properties()->force_render_surface = true; child1->test_properties()->AddChild(std::move(grand_child1)); @@ -1254,7 +1218,6 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree(); @@ -1332,7 +1295,6 @@ root->test_properties()->transform = uninvertible_transform; root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); root->SetTouchActionRegion(touch_action_region); host_impl().active_tree()->SetDeviceViewportSize(root->bounds()); @@ -1403,7 +1365,6 @@ test_layer->test_properties()->position = gfx::PointF(50.f, 50.f); test_layer->SetBounds(gfx::Size(100, 100)); test_layer->SetDrawsContent(true); - test_layer->SetHitTestable(true); test_layer->SetTouchActionRegion(touch_action_region); root_layer()->test_properties()->AddChild(std::move(test_layer)); } @@ -1473,7 +1434,6 @@ test_layer->test_properties()->position = gfx::PointF(25.f, 25.f); test_layer->SetBounds(gfx::Size(50, 50)); test_layer->SetDrawsContent(true); - test_layer->SetHitTestable(true); test_layer->SetTouchActionRegion(touch_action_region); root->test_properties()->AddChild(std::move(test_layer)); } @@ -1619,7 +1579,6 @@ child->test_properties()->position = gfx::PointF(-50.f, -50.f); child->SetBounds(gfx::Size(300, 300)); child->SetDrawsContent(true); - child->SetHitTestable(true); child->SetTouchActionRegion(touch_action_region); clipping_layer->test_properties()->AddChild(std::move(child)); root->test_properties()->AddChild(std::move(clipping_layer)); @@ -1704,7 +1663,6 @@ child->test_properties()->position = gfx::PointF(-50.f, -50.f); child->SetBounds(gfx::Size(300, 300)); child->SetDrawsContent(true); - child->SetHitTestable(true); child->SetTouchActionRegion(touch_action_region); clipping_layer->test_properties()->AddChild(std::move(child)); surface->test_properties()->AddChild(std::move(clipping_layer)); @@ -1765,7 +1723,6 @@ // layer is located. touch_layer->SetBounds(gfx::Size(50, 50)); touch_layer->SetDrawsContent(true); - touch_layer->SetHitTestable(true); TouchActionRegion touch_action_region; touch_action_region.Union(kTouchActionNone, gfx::Rect(0, 0, 50, 50)); touch_layer->SetTouchActionRegion(touch_action_region); @@ -1780,7 +1737,6 @@ notouch_layer->test_properties()->position = gfx::PointF(0, 25); notouch_layer->SetBounds(gfx::Size(50, 50)); notouch_layer->SetDrawsContent(true); - notouch_layer->SetHitTestable(true); root->test_properties()->AddChild(std::move(notouch_layer)); } @@ -1833,7 +1789,6 @@ LayerImpl* root = root_layer(); root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); { TouchActionRegion touch_action_region; touch_action_region.Union(kTouchActionNone, gfx::Rect(10, 10, 30, 30)); @@ -1841,7 +1796,6 @@ LayerImpl::Create(host_impl().active_tree(), 12345); test_layer->SetBounds(gfx::Size(50, 50)); test_layer->SetDrawsContent(false); - test_layer->SetHitTestable(false); test_layer->SetTouchActionRegion(touch_action_region); root->test_properties()->AddChild(std::move(test_layer)); } @@ -2305,7 +2259,6 @@ root->test_properties()->transform = translate_z; root->SetBounds(gfx::Size(100, 100)); root->SetDrawsContent(true); - root->SetHitTestable(true); } { gfx::Transform translate_z; @@ -2313,7 +2266,6 @@ left_child->test_properties()->transform = translate_z; left_child->SetBounds(gfx::Size(100, 100)); left_child->SetDrawsContent(true); - left_child->SetHitTestable(true); } { gfx::Transform translate_z;
diff --git a/cc/trees/property_tree.cc b/cc/trees/property_tree.cc index 60f4c43..1127f94 100644 --- a/cc/trees/property_tree.cc +++ b/cc/trees/property_tree.cc
@@ -831,9 +831,17 @@ // Reset to false when a node is first met. We'll set the bit later // when we actually encounter a masking child. node->has_masking_child = false; - if (node->blend_mode == SkBlendMode::kDstIn) { - DCHECK(parent_node->has_render_surface); + if (node->blend_mode == SkBlendMode::kDstIn) parent_node->has_masking_child = true; +} + +void EffectTree::UpdateHitTestMayBeAffectedByMask(EffectNode* node, + EffectNode* parent_node) { + node->hit_test_may_be_affected_by_mask = + node->is_masked || node->has_masking_child; + if (parent_node) { + node->hit_test_may_be_affected_by_mask |= + parent_node->hit_test_may_be_affected_by_mask; } } @@ -913,6 +921,7 @@ UpdateEffectChanged(node, parent_node); UpdateBackfaceVisibility(node, parent_node); UpdateHasMaskingChild(node, parent_node); + UpdateHitTestMayBeAffectedByMask(node, parent_node); UpdateSurfaceContentsScale(node); } @@ -1193,11 +1202,8 @@ bool EffectTree::HitTestMayBeAffectedByMask(int effect_id) const { const EffectNode* effect_node = Node(effect_id); - for (; effect_node->id != kContentsRootNodeId; - effect_node = Node(effect_node->target_id)) { - if (effect_node->has_masking_child || effect_node->is_masked) - return true; - } + if (effect_node) + return effect_node->hit_test_may_be_affected_by_mask; return false; }
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h index f71e580..42635e1 100644 --- a/cc/trees/property_tree.h +++ b/cc/trees/property_tree.h
@@ -382,6 +382,8 @@ void UpdateIsDrawn(EffectNode* node, EffectNode* parent_node); void UpdateBackfaceVisibility(EffectNode* node, EffectNode* parent_node); void UpdateHasMaskingChild(EffectNode* node, EffectNode* parent_node); + void UpdateHitTestMayBeAffectedByMask(EffectNode* node, + EffectNode* parent_node); // Stores copy requests, keyed by node id. std::unordered_multimap<int, std::unique_ptr<viz::CopyOutputRequest>>
diff --git a/cc/trees/proxy_main.cc b/cc/trees/proxy_main.cc index 6cc9a4b..b1688209 100644 --- a/cc/trees/proxy_main.cc +++ b/cc/trees/proxy_main.cc
@@ -292,7 +292,6 @@ current_pipeline_stage_ = NO_PIPELINE_STAGE; layer_tree_host_->DidBeginMainFrame(); TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoUpdates", TRACE_EVENT_SCOPE_THREAD); - layer_tree_host_->RecordEndOfFrameMetrics(begin_main_frame_start_time); std::vector<std::unique_ptr<SwapPromise>> swap_promises = layer_tree_host_->GetSwapPromiseManager()->TakeSwapPromises(); ImplThreadTaskRunner()->PostTask( @@ -306,6 +305,7 @@ // detected to be a no-op. From the perspective of an embedder, this commit // went through, and input should no longer be throttled, etc. layer_tree_host_->CommitComplete(); + layer_tree_host_->RecordEndOfFrameMetrics(begin_main_frame_start_time); return; } @@ -328,7 +328,6 @@ // coordinated by the Scheduler. { TRACE_EVENT0("cc", "ProxyMain::BeginMainFrame::commit"); - layer_tree_host_->RecordEndOfFrameMetrics(begin_main_frame_start_time); DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); @@ -345,6 +344,7 @@ } layer_tree_host_->CommitComplete(); + layer_tree_host_->RecordEndOfFrameMetrics(begin_main_frame_start_time); } void ProxyMain::DidPresentCompositorFrame(
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index 04b692b..e28f112 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -1583,6 +1583,7 @@ "is_modern", "module_name", "target_type", + "enable_multidex", ]) deps = _chrome_public_shared_deps @@ -1632,6 +1633,7 @@ chrome_public_apk_or_module_tmpl("chrome_public_apk") { target_type = "android_apk" apk_name = "ChromePublic" + enable_multidex = is_java_debug } chrome_public_apk_or_module_tmpl("chrome_modern_public_apk") { @@ -1906,11 +1908,6 @@ proguard_enabled = true proguard_configs = [ "//chrome/android/java/apk_for_test.flags" ] } - - # The test APK contains code from both the APK under test and the - # test APK when proguard is enabled. That causes this APK to exceed - # the dex limit. - enable_multidex = true } } @@ -1963,9 +1960,6 @@ ":chrome_test_vr_java", ] proguard_enabled = false - - # APK exceeds dex limit if not enabled - enable_multidex = true } } @@ -1987,11 +1981,6 @@ } alternative_android_sdk_dep = webview_framework_dep - # The test APK contains code from both the APK under test and the - # test APK when proguard is enabled. That causes this APK to exceed - # the dex limit. - enable_multidex = proguard_enabled - never_incremental = true } } @@ -2377,6 +2366,7 @@ "java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java", "java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java", "java/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtil.java", + "java/src/org/chromium/chrome/browser/notifications/NotificationTriggerScheduler.java", "java/src/org/chromium/chrome/browser/notifications/scheduler/NotificationSchedulerTask.java", "java/src/org/chromium/chrome/browser/ntp/ContentSuggestionsNotifier.java", "java/src/org/chromium/chrome/browser/ntp/ForeignSessionHelper.java",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index 188964d..d859517 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -961,6 +961,8 @@ "java/src/org/chromium/chrome/browser/notifications/NotificationService.java", "java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java", "java/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtil.java", + "java/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTask.java", + "java/src/org/chromium/chrome/browser/notifications/NotificationTriggerScheduler.java", "java/src/org/chromium/chrome/browser/notifications/NotificationUmaTracker.java", "java/src/org/chromium/chrome/browser/notifications/PendingIntentProvider.java", "java/src/org/chromium/chrome/browser/notifications/StandardNotificationBuilder.java", @@ -1254,7 +1256,6 @@ "java/src/org/chromium/chrome/browser/preferences/ManagedPreferenceDelegate.java", "java/src/org/chromium/chrome/browser/preferences/ManagedPreferencesUtils.java", "java/src/org/chromium/chrome/browser/preferences/ManageSyncPreferences.java", - "java/src/org/chromium/chrome/browser/preferences/NightModePreferences.java", "java/src/org/chromium/chrome/browser/preferences/NotificationsPreferences.java", "java/src/org/chromium/chrome/browser/preferences/PrefChangeRegistrar.java", "java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java", @@ -1339,6 +1340,8 @@ "java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferences.java", "java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java", "java/src/org/chromium/chrome/browser/preferences/privacy/UsageAndCrashReportsPreferenceFragment.java", + "java/src/org/chromium/chrome/browser/preferences/themes/RadioButtonGroupThemePreference.java", + "java/src/org/chromium/chrome/browser/preferences/themes/ThemePreferences.java", "java/src/org/chromium/chrome/browser/preferences/website/AddExceptionPreference.java", "java/src/org/chromium/chrome/browser/preferences/website/ChosenObjectInfo.java", "java/src/org/chromium/chrome/browser/preferences/website/ChosenObjectPreferences.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index 17f6f75..40ca732 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -59,8 +59,11 @@ "junit/src/org/chromium/chrome/browser/customtabs/CloseButtonNavigatorTest.java", "junit/src/org/chromium/chrome/browser/customtabs/NavigationInfoCaptureTriggerTest.java", "junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityContentTestEnvironment.java", + "junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationControllerTest.java", "junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityTabControllerTest.java", "junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityUrlLoadingTest.java", + "junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowExternalNavigationDelegateImpl.java", + "junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowPostTask.java", "junit/src/org/chromium/chrome/browser/display_cutout/DisplayCutoutControllerTest.java", "junit/src/org/chromium/chrome/browser/download/DownloadResumptionSchedulerTest.java", "junit/src/org/chromium/chrome/browser/download/DownloadSharedPreferenceEntryTest.java", @@ -110,6 +113,8 @@ "junit/src/org/chromium/chrome/browser/native_page/NativePageFactoryTest.java", "junit/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridgeUnitTest.java", "junit/src/org/chromium/chrome/browser/notifications/NotificationSystemStatusUtilUnitTest.java", + "junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java", + "junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java", "junit/src/org/chromium/chrome/browser/notifications/channels/ChannelDefinitionsTest.java", "junit/src/org/chromium/chrome/browser/ntp/TitleUtilTest.java", "junit/src/org/chromium/chrome/browser/ntp/cards/ContentSuggestionsUnitTestUtils.java",
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index 8d3c2374..73b703c 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -367,6 +367,7 @@ "javatests/src/org/chromium/chrome/browser/permissions/QuotaTest.java", "javatests/src/org/chromium/chrome/browser/photo_picker/PhotoPickerDialogTest.java", "javatests/src/org/chromium/chrome/browser/policy/CombinedPolicyProviderTest.java", + "javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java", "javatests/src/org/chromium/chrome/browser/preferences/ContextualSuggestionsPreferenceTest.java", "javatests/src/org/chromium/chrome/browser/preferences/NotificationsPreferencesTest.java", "javatests/src/org/chromium/chrome/browser/preferences/PasswordViewingTypeTest.java",
diff --git a/chrome/android/features/ar/ar_module_tmpl.gni b/chrome/android/features/ar/ar_module_tmpl.gni index c347dbf..0ed807f 100644 --- a/chrome/android/features/ar/ar_module_tmpl.gni +++ b/chrome/android/features/ar/ar_module_tmpl.gni
@@ -44,37 +44,8 @@ "//third_party/android_deps:com_google_ar_core_java", ] - if (defined(invoker.native_switches)) { - loadable_modules_if_32_bit = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ] - loadable_modules_if_64_bit = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/arm64-v8a/libarcore_sdk_c.so" ] - } else { - # TODO(huangs): Remove "else" case after updating downstream. - # We store the arcore shim as a separate .so in the bundle module and only - # load as needed. - if (android_64bit_target_cpu) { - if (defined(invoker.is_64_bit_browser) && invoker.is_64_bit_browser) { - loadable_modules = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/arm64-v8a/libarcore_sdk_c.so" ] - - # TODO(cjgrant): Make this a dummy lib, if SplitCompat properly opens the 64-bit library. - if (build_apk_secondary_abi && invoker.include_32_bit_webview) { - secondary_abi_loadable_modules = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/arm64-v8a/libarcore_sdk_c.so" ] - } - } else { - if (build_apk_secondary_abi) { - secondary_abi_loadable_modules = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ] - - # Disguise 32 bit library as 64 bit. This works around a Play Core bug where only 64 bit - # libraries are extracted on 64 bit devices. - # TODO(crbug.com/902859): Remove once bug is fixed. - loadable_modules = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ] - } else { - loadable_modules = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ] - } - } - } else { - loadable_modules = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ] - } - } + loadable_modules_if_32_bit = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/armeabi-v7a/libarcore_sdk_c.so" ] + loadable_modules_if_64_bit = [ "$root_gen_dir/third_party/android_deps/com_google_ar_core_java/jni/arm64-v8a/libarcore_sdk_c.so" ] uncompress_shared_libraries = true
diff --git a/chrome/android/features/autofill_assistant/BUILD.gn b/chrome/android/features/autofill_assistant/BUILD.gn index 413a8fb2..b84219e 100644 --- a/chrome/android/features/autofill_assistant/BUILD.gn +++ b/chrome/android/features/autofill_assistant/BUILD.gn
@@ -33,6 +33,7 @@ "//chrome/android:chrome_java", "//components/url_formatter/android:url_formatter_java", "//content/public/android:content_java", + "//third_party/android_deps:android_support_v7_appcompat_java", "//third_party/android_deps:com_android_support_design_java", "//third_party/android_deps:com_android_support_recyclerview_v7_java", "//third_party/android_deps:com_android_support_support_compat_java",
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable-hdpi/ic_check_circle_outline_48dp.png b/chrome/android/features/autofill_assistant/java/res/drawable-hdpi/ic_check_circle_outline_48dp.png deleted file mode 100644 index 01ada8a..0000000 --- a/chrome/android/features/autofill_assistant/java/res/drawable-hdpi/ic_check_circle_outline_48dp.png +++ /dev/null Binary files differ
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable-mdpi/ic_check_circle_outline_48dp.png b/chrome/android/features/autofill_assistant/java/res/drawable-mdpi/ic_check_circle_outline_48dp.png deleted file mode 100644 index 6bd8246..0000000 --- a/chrome/android/features/autofill_assistant/java/res/drawable-mdpi/ic_check_circle_outline_48dp.png +++ /dev/null Binary files differ
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable-xhdpi/ic_check_circle_outline_48dp.png b/chrome/android/features/autofill_assistant/java/res/drawable-xhdpi/ic_check_circle_outline_48dp.png deleted file mode 100644 index a088838..0000000 --- a/chrome/android/features/autofill_assistant/java/res/drawable-xhdpi/ic_check_circle_outline_48dp.png +++ /dev/null Binary files differ
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable-xxhdpi/ic_check_circle_outline_48dp.png b/chrome/android/features/autofill_assistant/java/res/drawable-xxhdpi/ic_check_circle_outline_48dp.png deleted file mode 100644 index 731ab65..0000000 --- a/chrome/android/features/autofill_assistant/java/res/drawable-xxhdpi/ic_check_circle_outline_48dp.png +++ /dev/null Binary files differ
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable-xxxhdpi/ic_check_circle_outline_48dp.png b/chrome/android/features/autofill_assistant/java/res/drawable-xxxhdpi/ic_check_circle_outline_48dp.png deleted file mode 100644 index 1687c2b..0000000 --- a/chrome/android/features/autofill_assistant/java/res/drawable-xxxhdpi/ic_check_circle_outline_48dp.png +++ /dev/null Binary files differ
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable/ic_tick.xml b/chrome/android/features/autofill_assistant/java/res/drawable/ic_tick.xml new file mode 100644 index 0000000..d02b6ed --- /dev/null +++ b/chrome/android/features/autofill_assistant/java/res/drawable/ic_tick.xml
@@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. --> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + tools:targetApi="21" + android:height="48dp" + android:width="48dp" + android:viewportHeight="50" + android:viewportWidth="50"> + + <path + android:fillColor="#FFFFFF" + android:fillType="evenOdd" + android:strokeColor="#2A84FC" + android:strokeWidth="1" + android:pathData="M25,1L25,1C38.2548,1 49,11.7452 49,25L49,25C49,38.2548 38.2548,49 +25,49L25,49C11.7452,49 1,38.2548 1,25L1,25C1,11.7452 11.7452,1 25,1Z" /> + <path + android:fillColor="#4285F4" + android:fillType="nonZero" + android:strokeColor="#00000000" + android:strokeWidth="1" + android:pathData="M21,30.25l-5.25,-5.25l-1.75,1.75l7,7l15,-15l-1.75,-1.75z" /> +</vector>
diff --git a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_info_box.xml b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_info_box.xml index 93002919..ad0db95 100644 --- a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_info_box.xml +++ b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_info_box.xml
@@ -6,10 +6,11 @@ <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/info_box_explanation" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" - android:drawableTop="@drawable/ic_check_circle_outline_48dp" - android:layout_marginTop="@dimen/autofill_assistant_bottombar_vertical_spacing" + android:gravity="center" + android:padding="@dimen/autofill_assistant_bottombar_vertical_spacing" + android:paddingBottom="@dimen/autofill_assistant_info_box_spacing" android:drawablePadding="@dimen/autofill_assistant_bottombar_vertical_spacing" android:textAppearance="@style/TextAppearance.BlackTitle1"/>
diff --git a/chrome/android/features/autofill_assistant/java/res/values-v17/dimens.xml b/chrome/android/features/autofill_assistant/java/res/values-v17/dimens.xml index 3bc1141..98be3947 100644 --- a/chrome/android/features/autofill_assistant/java/res/values-v17/dimens.xml +++ b/chrome/android/features/autofill_assistant/java/res/values-v17/dimens.xml
@@ -7,5 +7,6 @@ <dimen name="autofill_assistant_bottombar_vertical_spacing">20dp</dimen> <dimen name="autofill_assistant_details_image_size">48dp</dimen> <dimen name="autofill_assistant_poodle_size">24dp</dimen> + <dimen name="autofill_assistant_info_box_spacing">16dp</dimen> <dimen name="autofill_assistant_poodle_view_size">34dp</dimen> </resources>
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/infobox/AssistantInfoBoxViewBinder.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/infobox/AssistantInfoBoxViewBinder.java index d510808..9e41aba 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/infobox/AssistantInfoBoxViewBinder.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/infobox/AssistantInfoBoxViewBinder.java
@@ -7,6 +7,7 @@ import android.content.Context; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; +import android.support.v7.content.res.AppCompatResources; import android.view.View; import android.widget.TextView; @@ -59,7 +60,7 @@ viewHolder.mExplanationView.setText(infoBox.getExplanation()); if (infoBox.getImagePath().isEmpty()) { viewHolder.mExplanationView.setCompoundDrawablesWithIntrinsicBounds( - 0, R.drawable.ic_check_circle_outline_48dp, 0, 0); + null, AppCompatResources.getDrawable(mContext, R.drawable.ic_tick), null, null); } else { CachedImageFetcher.getInstance().fetchImage(infoBox.getImagePath(), CachedImageFetcher.ASSISTANT_INFO_BOX_UMA_CLIENT_NAME, image -> {
diff --git a/chrome/android/java/res/drawable-hdpi/infobar_savepassword.png b/chrome/android/java/res/drawable-hdpi/infobar_savepassword.png deleted file mode 100644 index 96a1839c..0000000 --- a/chrome/android/java/res/drawable-hdpi/infobar_savepassword.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/infobar_savepassword.png b/chrome/android/java/res/drawable-mdpi/infobar_savepassword.png deleted file mode 100644 index 7b7531ce..0000000 --- a/chrome/android/java/res/drawable-mdpi/infobar_savepassword.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/infobar_savepassword.png b/chrome/android/java/res/drawable-xhdpi/infobar_savepassword.png deleted file mode 100644 index 2337997..0000000 --- a/chrome/android/java/res/drawable-xhdpi/infobar_savepassword.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxhdpi/infobar_savepassword.png b/chrome/android/java/res/drawable-xxhdpi/infobar_savepassword.png deleted file mode 100644 index 7e55350..0000000 --- a/chrome/android/java/res/drawable-xxhdpi/infobar_savepassword.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xxxhdpi/infobar_savepassword.png b/chrome/android/java/res/drawable-xxxhdpi/infobar_savepassword.png deleted file mode 100644 index b9354cf..0000000 --- a/chrome/android/java/res/drawable-xxxhdpi/infobar_savepassword.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/layout/confirm_import_sync_data.xml b/chrome/android/java/res/layout/confirm_import_sync_data.xml index a3e10426..12a07b3 100644 --- a/chrome/android/java/res/layout/confirm_import_sync_data.xml +++ b/chrome/android/java/res/layout/confirm_import_sync_data.xml
@@ -28,7 +28,6 @@ android:id="@+id/sync_confirm_import_choice" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="16dp" android:background="?android:attr/selectableItemBackground" app:titleText="@string/sync_import_existing_data" /> @@ -36,7 +35,6 @@ android:id="@+id/sync_keep_separate_choice" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="16dp" android:background="?android:attr/selectableItemBackground" app:titleText="@string/sync_keep_existing_data_separate" />
diff --git a/chrome/android/java/res/layout/password_generation_popup_suggestion.xml b/chrome/android/java/res/layout/password_generation_popup_suggestion.xml deleted file mode 100644 index 6ca728e..0000000 --- a/chrome/android/java/res/layout/password_generation_popup_suggestion.xml +++ /dev/null
@@ -1,62 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. ---> - -<RelativeLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:tools="http://schemas.android.com/tools" - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - - <!-- Lint flags this as a false positive overlap. --> - <!--suppress RelativeOverlap --> - <RelativeLayout android:id="@+id/password_generation_suggestion" - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - - <ImageView android:id="@+id/password_generation_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="13dp" - android:layout_marginBottom="13dp" - android:layout_marginStart="@dimen/password_generation_horizontal_margin" - android:layout_marginEnd="@dimen/password_generation_horizontal_margin" - android:src="@drawable/infobar_savepassword" - tools:ignore="ContentDescription" /> - - <TextView android:id="@+id/password_generation_title" - android:layout_toEndOf="@id/password_generation_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingTop="@dimen/password_generation_text_vertical_margin" - android:paddingEnd="@dimen/password_generation_horizontal_margin" - android:singleLine="true" - android:textStyle="bold" - android:textColor="@color/default_text_color" - android:textSize="@dimen/password_generation_text_size" - android:includeFontPadding="false"/> - - <TextView android:id="@+id/password_generation_password" - android:layout_toEndOf="@id/password_generation_icon" - android:layout_below="@id/password_generation_title" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingBottom="@dimen/password_generation_text_vertical_margin" - android:paddingEnd="@dimen/password_generation_horizontal_margin" - android:singleLine="true" - android:textColor="@color/default_text_color" - android:textSize="@dimen/password_generation_text_size" - android:includeFontPadding="false"/> - - </RelativeLayout> - - <View android:id="@+id/password_generation_divider" - android:layout_below="@id/password_generation_suggestion" - android:layout_width="wrap_content" - android:layout_height="@dimen/password_generation_divider_height" - android:background="@color/password_generation_divider_color"/> - -</RelativeLayout>
diff --git a/chrome/android/java/res/layout/radio_button_group_theme_preference.xml b/chrome/android/java/res/layout/radio_button_group_theme_preference.xml new file mode 100644 index 0000000..1183109 --- /dev/null +++ b/chrome/android/java/res/layout/radio_button_group_theme_preference.xml
@@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. --> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:focusable="false"> + + <org.chromium.chrome.browser.widget.RadioButtonWithDescription + android:id="@+id/system_default" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + app:titleText="@string/themes_system_default_title" + app:descriptionText="@string/themes_system_default_summary" /> + + <org.chromium.chrome.browser.widget.RadioButtonWithDescription + android:id="@+id/light" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + app:titleText="@string/light_mode" /> + + <org.chromium.chrome.browser.widget.RadioButtonWithDescription + android:id="@+id/dark" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + app:titleText="@string/dark_mode" /> +</LinearLayout> \ No newline at end of file
diff --git a/chrome/android/java/res/layout/radio_button_with_description.xml b/chrome/android/java/res/layout/radio_button_with_description.xml index 5878855..06458fd 100644 --- a/chrome/android/java/res/layout/radio_button_with_description.xml +++ b/chrome/android/java/res/layout/radio_button_with_description.xml
@@ -4,18 +4,17 @@ found in the LICENSE file. --> <!-- RadioButtonWithDescription extends RelativeLayout --> -<merge xmlns:android="http://schemas.android.com/apk/res/android" - android:paddingTop="10dp" > +<merge xmlns:android="http://schemas.android.com/apk/res/android"> <RadioButton android:id="@+id/radio_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" + android:layout_marginEnd="16dp" android:clickable="false" android:focusable="false" - android:background="@null" - android:paddingEnd="16dp" /> + android:background="@null" /> <TextView android:id="@+id/title" @@ -32,5 +31,6 @@ android:layout_alignStart="@id/title" android:layout_below="@id/title" android:textAppearance="@style/TextAppearance.BlackHint2" - android:visibility="gone"/> + android:paddingTop="4dp" + android:visibility="gone" /> </merge>
diff --git a/chrome/android/java/res/layout/tri_state_site_settings_preference.xml b/chrome/android/java/res/layout/tri_state_site_settings_preference.xml index fff1771..d42140ff 100644 --- a/chrome/android/java/res/layout/tri_state_site_settings_preference.xml +++ b/chrome/android/java/res/layout/tri_state_site_settings_preference.xml
@@ -17,7 +17,6 @@ android:id="@+id/allowed" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="16dp" android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:background="?android:attr/selectableItemBackground" app:titleText="@string/website_settings_category_allowed" /> @@ -26,7 +25,6 @@ android:id="@+id/ask" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="16dp" android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:background="?android:attr/selectableItemBackground" app:titleText="@string/website_settings_category_ask" />
diff --git a/chrome/android/java/res/values/attrs.xml b/chrome/android/java/res/values/attrs.xml index 59266c58..86dd2f71 100644 --- a/chrome/android/java/res/values/attrs.xml +++ b/chrome/android/java/res/values/attrs.xml
@@ -63,6 +63,7 @@ <declare-styleable name="RadioButtonWithDescription"> <attr name="titleText" format="string" /> + <attr name="descriptionText" format="string" /> </declare-styleable> <declare-styleable name="SpinnerPreference">
diff --git a/chrome/android/java/res/values/colors.xml b/chrome/android/java/res/values/colors.xml index ff1174db..2415e60c 100644 --- a/chrome/android/java/res/values/colors.xml +++ b/chrome/android/java/res/values/colors.xml
@@ -85,9 +85,6 @@ <color name="distilled_page_prefs_selected">#999999</color> <color name="distilled_page_prefs_unselected">@android:color/white</color> - <!-- Password generation popup colors --> - <color name="password_generation_divider_color">#E5E5E5</color> - <!-- Preferences Colors --> <color name="pref_accent_color">@color/light_active_color</color> <color name="pref_dragged_row_background">@color/white_alpha_90</color>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index ef3e6ae6..fac9f9d4 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -149,7 +149,6 @@ <dimen name="keyboard_accessory_tab_size">@dimen/keyboard_accessory_height</dimen> <!-- Password generation popup dimensions --> - <dimen name="password_generation_divider_height">1dp</dimen> <dimen name="password_generation_text_size">14sp</dimen> <dimen name="password_generation_horizontal_margin">10dp</dimen> <dimen name="password_generation_text_vertical_margin">12dp</dimen> @@ -605,4 +604,7 @@ <dimen name="tab_grid_thumbnail_card_default_size">152dp</dimen> <dimen name="swipe_to_dismiss_threshold">72dp</dimen> + <!-- RadioButtonWithDescription dimensions --> + <dimen name="radio_button_with_description_padding">12dp</dimen> + </resources>
diff --git a/chrome/android/java/res/xml/main_preferences.xml b/chrome/android/java/res/xml/main_preferences.xml index 2e6458f..8ffe1baa 100644 --- a/chrome/android/java/res/xml/main_preferences.xml +++ b/chrome/android/java/res/xml/main_preferences.xml
@@ -65,12 +65,11 @@ android:key="homepage" android:order="11" android:title="@string/options_homepage_title"/> - <!-- TODO(huayinz): Change to a proper string. --> <Preference - android:fragment="org.chromium.chrome.browser.preferences.NightModePreferences" - android:key="night_mode" + android:fragment="org.chromium.chrome.browser.preferences.themes.ThemePreferences" + android:key="ui_theme" android:order="12" - android:title="Dark mode" /> + android:title="@string/prefs_themes" /> <PreferenceCategory android:key="advanced_section"
diff --git a/chrome/android/java/res/xml/night_mode_preferences.xml b/chrome/android/java/res/xml/night_mode_preferences.xml deleted file mode 100644 index f878bfb..0000000 --- a/chrome/android/java/res/xml/night_mode_preferences.xml +++ /dev/null
@@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- 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. --> - -<PreferenceScreen - xmlns:android="http://schemas.android.com/apk/res/android"> - - <org.chromium.chrome.browser.preferences.ChromeSwitchPreference - android:key="night_mode_switch" - android:summaryOn="@string/text_on" - android:summaryOff="@string/text_off" - android:persistent="false" /> - -</PreferenceScreen> \ No newline at end of file
diff --git a/chrome/android/java/res/xml/theme_preferences.xml b/chrome/android/java/res/xml/theme_preferences.xml new file mode 100644 index 0000000..9e1f0e7 --- /dev/null +++ b/chrome/android/java/res/xml/theme_preferences.xml
@@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. --> + +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <org.chromium.chrome.browser.preferences.themes.RadioButtonGroupThemePreference + android:key="ui_theme_pref" /> +</PreferenceScreen> \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java index bb355915..786f161 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/AppHooks.java
@@ -394,6 +394,15 @@ } /** + * Get the UI controller from the activity if it exists. + * @param activity The activity to get the UI controller from. + * @return The UI controller or null. + */ + public TouchlessUiController getTouchlessUiControllerForActivity(ChromeActivity activity) { + return null; + } + + /** * Checks the Google Play services availability on the this device. * * This is a workaround for the
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java index 15be3ca6..b2baace 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingMediator.java
@@ -388,6 +388,7 @@ int newControlsHeight = calculateAccessoryBarHeight(); int newControlsOffset = 0; if (mKeyboardAccessory.hasActiveTab()) { + restrictForcedAccessorySheetHeight(); newControlsHeight += mAccessorySheet.getHeight(); newControlsOffset += mAccessorySheet.getHeight(); } @@ -463,6 +464,24 @@ getKeyboard().calculateKeyboardHeight(rootView)); } + /** + * Double-checks that the accessory sheet height doesn't cover the whole page. Usually it is + * suppressed in these cases but if it is forced open (e.g. by rotation), this might not hold. + */ + private void restrictForcedAccessorySheetHeight() { + WebContents webContents = mActivity.getCurrentWebContents(); + if (webContents == null) return; + float density = mWindowAndroid.getDisplay().getDipScale(); + // The maximal height for the sheet ensures a minimal amount of WebContents space. + @Px + int maxHeight = mKeyboardExtensionSizeManager.getKeyboardExtensionHeight(); + maxHeight += Math.round(density * webContents.getHeight()); + maxHeight -= Math.round(density * MINIMAL_AVAILABLE_VERTICAL_SPACE); + maxHeight -= calculateAccessoryBarHeight(); + if (mAccessorySheet.getHeight() <= maxHeight) return; // Sheet height needs no adjustment! + mAccessorySheet.setHeight(maxHeight); + } + private @Px int calculateAccessoryBarHeight() { if (!mKeyboardAccessory.isShown()) return 0; return mActivity.getResources().getDimensionPixelSize(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/trustedwebactivityui/TrustedWebActivityCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/trustedwebactivityui/TrustedWebActivityCoordinator.java index 8280b5f..9ffaa80 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/trustedwebactivityui/TrustedWebActivityCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/trustedwebactivityui/TrustedWebActivityCoordinator.java
@@ -11,8 +11,8 @@ import org.chromium.chrome.browser.browserservices.trustedwebactivityui.splashscreen.SplashScreenController; import org.chromium.chrome.browser.browserservices.trustedwebactivityui.view.TrustedWebActivityDisclosureView; import org.chromium.chrome.browser.browserservices.trustedwebactivityui.view.TrustedWebActivityToolbarView; -import org.chromium.chrome.browser.customtabs.CloseButtonNavigator; import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider; +import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController; import org.chromium.chrome.browser.dependency_injection.ActivityScope; import javax.inject.Inject; @@ -33,13 +33,13 @@ TrustedWebActivityDisclosureView disclosureView, TrustedWebActivityOpenTimeRecorder openTimeRecorder, TrustedWebActivityVerifier verifier, - CloseButtonNavigator closeButtonNavigator, + CustomTabActivityNavigationController navigationController, Lazy<SplashScreenController> splashScreenController, CustomTabIntentDataProvider intentDataProvider) { // We don't need to do anything with most of the classes above, we just need to resolve them // so they start working. - closeButtonNavigator.setLandingPageCriteria(verifier::isPageOnVerifiedOrigin); + navigationController.setLandingPageOnCloseCriterion(verifier::isPageOnVerifiedOrigin); if (SplashScreenController.intentIsForTwaWithSplashScreen( intentDataProvider.getIntent())) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java index 398e9d94..57875ce4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -4,6 +4,8 @@ package org.chromium.chrome.browser.customtabs; +import static org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason.USER_NAVIGATION; + import android.app.Activity; import android.app.PendingIntent; import android.content.Context; @@ -14,15 +16,12 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; -import android.os.Bundle; -import android.os.StrictMode; import android.provider.Browser; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.customtabs.CustomTabsIntent; import android.support.customtabs.CustomTabsSessionToken; -import android.support.v4.app.ActivityOptionsCompat; import android.text.TextUtils; import android.util.Pair; import android.view.KeyEvent; @@ -38,10 +37,8 @@ import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.base.VisibleForTesting; -import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; -import org.chromium.base.task.PostTask; import org.chromium.chrome.R; import org.chromium.chrome.browser.ActivityTabTaskDescriptionHelper; import org.chromium.chrome.browser.ChromeActivity; @@ -58,6 +55,7 @@ import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.contextual_suggestions.ContextualSuggestionsModule; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController; +import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabController; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabFactory; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityTabProvider; @@ -66,7 +64,6 @@ import org.chromium.chrome.browser.customtabs.dependency_injection.CustomTabActivityModule; import org.chromium.chrome.browser.customtabs.dynamicmodule.DynamicModuleCoordinator; import org.chromium.chrome.browser.dependency_injection.ChromeActivityCommonsModule; -import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor; import org.chromium.chrome.browser.gsa.GSAState; import org.chromium.chrome.browser.incognito.IncognitoTabHost; @@ -84,11 +81,9 @@ import org.chromium.chrome.browser.toolbar.top.ToolbarControlContainer; import org.chromium.chrome.browser.util.ColorUtils; import org.chromium.chrome.browser.util.IntentUtils; -import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.NavigationController; import org.chromium.content_public.browser.NavigationEntry; -import org.chromium.content_public.browser.UiThreadTaskTraits; import org.chromium.content_public.browser.WebContents; import java.lang.annotation.Retention; @@ -101,18 +96,6 @@ public class CustomTabActivity extends ChromeActivity<CustomTabActivityComponent> { private static final String TAG = "CustomTabActivity"; - // For CustomTabs.WebContentsStateOnLaunch, see histograms.xml. Append only. - @IntDef({WebContentsState.NO_WEBCONTENTS, WebContentsState.PRERENDERED_WEBCONTENTS, - WebContentsState.SPARE_WEBCONTENTS, WebContentsState.TRANSFERRED_WEBCONTENTS}) - @Retention(RetentionPolicy.SOURCE) - private @interface WebContentsState { - int NO_WEBCONTENTS = 0; - int PRERENDERED_WEBCONTENTS = 1; - int SPARE_WEBCONTENTS = 2; - int TRANSFERRED_WEBCONTENTS = 3; - int NUM_ENTRIES = 4; - } - // For CustomTabs.ConnectionStatusOnReturn, see histograms.xml. Append only. @IntDef({ConnectionStatus.DISCONNECTED, ConnectionStatus.DISCONNECTED_KEEP_ALIVE, ConnectionStatus.CONNECTED, ConnectionStatus.CONNECTED_KEEP_ALIVE}) @@ -144,7 +127,6 @@ /** Adds and removes observers from tabs when needed. */ private TabObserverRegistrar mTabObserverRegistrar; - private boolean mIsClosing; private boolean mIsKeepAlive; private final CustomTabsConnection mConnection = CustomTabsConnection.getInstance(); @@ -182,7 +164,6 @@ @Override public void onAllTabsClosed() { resetPostMessageHandlersForCurrentSession(); - finishAndClose(false); } }; @@ -215,7 +196,6 @@ @Override public void onStart() { super.onStart(); - mIsClosing = false; mIsKeepAlive = mConnection.keepAliveForSession( mIntentDataProvider.getSession(), mIntentDataProvider.getKeepAliveServiceIntent()); } @@ -349,14 +329,7 @@ if (mIntentDataProvider.shouldEnableEmbeddedMediaExperience()) { RecordUserAction.record("CustomTabs.CloseButtonClicked.DownloadsUI"); } - if (getComponent().resolveCloseButtonNavigator() - .navigateOnClose(getNavigationController())) { - RecordUserAction.record( - "CustomTabs.CloseButtonClicked.GoToModuleManagedUrl"); - return; - } - recordClientConnectionStatus(); - finishAndClose(false); + mNavigationController.navigateOnClose(); } }); @@ -572,11 +545,6 @@ public void onStopWithNative() { super.onStopWithNative(); BrowserSessionContentUtils.removeActiveContentHandler(mBrowserSessionContentHandler); - if (mIsClosing) { - mTabController.closeAndForgetTab(); - } else { - mTabController.saveState(); - } } @Override @@ -662,28 +630,6 @@ } /** - * Finishes the activity and removes the reference from the Android recents. - * - * @param reparenting true iff the activity finishes due to tab reparenting. - */ - public final void finishAndClose(boolean reparenting) { - if (mIsClosing) return; - mIsClosing = true; - - if (!reparenting) { - // Closing the activity destroys the renderer as well. Re-create a spare renderer some - // time after, so that we have one ready for the next tab open. This does not increase - // memory consumption, as the current renderer goes away. We create a renderer as a lot - // of users open several Custom Tabs in a row. The delay is there to avoid jank in the - // transition animation when closing the tab. - PostTask.postDelayedTask(UiThreadTaskTraits.DEFAULT, - () -> CustomTabsConnection.createSpareWebContents(), 500); - } - - handleFinishAndClose(); - } - - /** * Internal implementation that finishes the activity and removes the references from Android * recents. */ @@ -697,31 +643,7 @@ @Override protected boolean handleBackPressed() { - if (!LibraryLoader.getInstance().isInitialized()) return false; - - RecordUserAction.record("CustomTabs.SystemBack"); - if (getActivityTab() == null) return false; - - if (exitFullscreenIfShowing()) return true; - - if (mDynamicModuleCoordinator != null && - mDynamicModuleCoordinator.onBackPressedAsync(this::handleTabBackNavigation)) { - return true; - } - - handleTabBackNavigation(); - return true; - } - - private void handleTabBackNavigation() { - if (!getToolbarManager().back()) { - if (getCurrentTabModel().getCount() > 1) { - getCurrentTabModel().closeTab(getActivityTab(), false, false, false); - } else { - recordClientConnectionStatus(); - finishAndClose(false); - } - } + return mNavigationController.navigateOnBack(); } private void recordClientConnectionStatus() { @@ -833,7 +755,7 @@ RecordUserAction.record("MobileMenuAddToBookmarks"); return true; } else if (id == R.id.open_in_browser_id) { - if (openCurrentUrlInBrowser(false)) { + if (mNavigationController.openCurrentUrlInBrowser(false)) { RecordUserAction.record("CustomTabsMenuOpenInChrome"); mConnection.notifyOpenInBrowser(mSession); } @@ -877,63 +799,6 @@ return mIntentDataProvider; } - /** - * Opens the URL currently being displayed in the Custom Tab in the regular browser. - * @param forceReparenting Whether tab reparenting should be forced for testing. - * - * @return Whether or not the tab was sent over successfully. - */ - boolean openCurrentUrlInBrowser(boolean forceReparenting) { - Tab tab = getActivityTab(); - if (tab == null) return false; - - String url = tab.getUrl(); - if (DomDistillerUrlUtils.isDistilledPage(url)) { - url = DomDistillerUrlUtils.getOriginalUrlFromDistillerUrl(url); - } - if (TextUtils.isEmpty(url)) url = mIntentDataProvider.getUrlToLoad(); - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - - boolean willChromeHandleIntent = - getIntentDataProvider().isOpenedByChrome() || getIntentDataProvider().isIncognito(); - - StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites(); - try { - willChromeHandleIntent |= ExternalNavigationDelegateImpl - .willChromeHandleIntent(intent, true); - } finally { - StrictMode.setThreadPolicy(oldPolicy); - } - - Bundle startActivityOptions = ActivityOptionsCompat.makeCustomAnimation( - this, R.anim.abc_fade_in, R.anim.abc_fade_out).toBundle(); - if (willChromeHandleIntent || forceReparenting) { - Runnable finalizeCallback = new Runnable() { - @Override - public void run() { - finishAndClose(true); - } - }; - - mTabController.detachAndStartReparenting(intent, startActivityOptions, - finalizeCallback); - } else { - // Temporarily allowing disk access while fixing. TODO: http://crbug.com/581860 - StrictMode.allowThreadDiskWrites(); - try { - if (mIntentDataProvider.isInfoPage()) { - IntentHandler.startChromeLauncherActivityForTrustedIntent(intent); - } else { - startActivity(intent, startActivityOptions); - } - } finally { - StrictMode.setThreadPolicy(oldPolicy); - } - } - return true; - } - @Override protected void initializeToolbar() { super.initializeToolbar(); @@ -1019,7 +884,7 @@ @Override public void closeAllIncognitoTabs() { - finishAndClose(false); + mNavigationController.finish(FinishReason.OTHER); } } @@ -1038,6 +903,10 @@ mTabFactory = component.resolveTabFactory(); component.resolveUmaTracker(); mNavigationController = component.resolveNavigationController(); + mNavigationController.setFinishHandler((reason) -> { + if (reason == USER_NAVIGATION) recordClientConnectionStatus(); + handleFinishAndClose(); + }); component.resolveInitialPageLoader(); if (mIntentDataProvider.isTrustedWebActivity()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java index 51ff97cd..0c22e7b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
@@ -757,7 +757,7 @@ * @return If the Custom Tab is an info page. * See {@link #EXTRA_UI_TYPE}. */ - boolean isInfoPage() { + public boolean isInfoPage() { return mUiType == CustomTabsUiType.INFO_PAGE; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java index e8170f7..be351a73 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
@@ -1512,7 +1512,7 @@ return mHiddenTabHolder.getSpeculationParamsForTesting(); } - /* package */ static void createSpareWebContents() { + public static void createSpareWebContents() { if (SysUtils.isLowEndDevice()) return; WarmupManager.getInstance().createSpareWebContents(WarmupManager.FOR_CCT); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationController.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationController.java index da51da7a..0258966 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationController.java
@@ -4,41 +4,139 @@ package org.chromium.chrome.browser.customtabs.content; -import android.os.SystemClock; +import static org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason.OTHER; +import static org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason.REPARENTING; +import static org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason.USER_NAVIGATION; +import android.app.Activity; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.os.StrictMode; +import android.os.SystemClock; +import android.support.annotation.IntDef; +import android.support.annotation.Nullable; +import android.support.v4.app.ActivityOptionsCompat; +import android.text.TextUtils; + +import org.chromium.base.metrics.RecordUserAction; +import org.chromium.base.task.PostTask; +import org.chromium.chrome.R; +import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.IntentHandler; +import org.chromium.chrome.browser.customtabs.CloseButtonNavigator; import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider; import org.chromium.chrome.browser.customtabs.CustomTabObserver; import org.chromium.chrome.browser.customtabs.CustomTabsConnection; import org.chromium.chrome.browser.dependency_injection.ActivityScope; +import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; +import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; +import org.chromium.chrome.browser.init.ActivityLifecycleDispatcher; +import org.chromium.chrome.browser.init.ChromeBrowserInitializer; +import org.chromium.chrome.browser.lifecycle.StartStopWithNativeObserver; import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.browser.toolbar.ToolbarManager; +import org.chromium.components.dom_distiller.core.DomDistillerUrlUtils; import org.chromium.content_public.browser.LoadUrlParams; +import org.chromium.content_public.browser.NavigationController; +import org.chromium.content_public.browser.UiThreadTaskTraits; +import org.chromium.content_public.browser.WebContents; import org.chromium.ui.base.PageTransition; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + import javax.inject.Inject; import dagger.Lazy; /** * Responsible for navigating to new pages and going back to previous pages. - * TODO(pshmakov): move back/close navigation from CustomTabActivity into this class. */ @ActivityScope -public class CustomTabActivityNavigationController { +public class CustomTabActivityNavigationController implements StartStopWithNativeObserver { + @IntDef({USER_NAVIGATION, REPARENTING, OTHER}) + @Retention(RetentionPolicy.SOURCE) + public @interface FinishReason { + int USER_NAVIGATION = 0; + int REPARENTING = 1; + int OTHER = 2; + } + + /** A handler of back presses. */ + public interface BackHandler { + /** + * Called when back button is pressed, unless already handled by another handler. + * The implementation should do one of the following: + * 1) Synchronously accept and handle the event and return true; + * 2) Synchronously reject the event by returning false; + * 3) Accept the event by returning true, handle it asynchronously, and if the handling + * fails, trigger the default handling routine by running the defaultBackHandler. + */ + boolean handleBackPressed(Runnable defaultBackHandler); + } + + public interface FinishHandler { + void onFinish(@FinishReason int reason); + } + + private final CustomTabActivityTabController mTabController; private final CustomTabActivityTabProvider mTabProvider; private final CustomTabIntentDataProvider mIntentDataProvider; private final CustomTabsConnection mConnection; private final Lazy<CustomTabObserver> mCustomTabObserver; + private final CloseButtonNavigator mCloseButtonNavigator; + private final Lazy<ToolbarManager> mToolbarManager; + private final ChromeBrowserInitializer mChromeBrowserInitializer; + private final Activity mActivity; + private final Lazy<ChromeFullscreenManager> mFullscreenManager; + + @Nullable + private BackHandler mBackHandler; + + @Nullable + private FinishHandler mFinishHandler; + + private boolean mIsFinishing; + + private boolean mIsClosingTabOnBack; + + private final CustomTabActivityTabProvider.Observer mTabObserver = + new CustomTabActivityTabProvider.Observer() { + + @Override + public void onAllTabsClosed() { + finish(mIsClosingTabOnBack ? USER_NAVIGATION : OTHER); + } + }; @Inject - public CustomTabActivityNavigationController(CustomTabActivityTabProvider tabProvider, - CustomTabIntentDataProvider intentDataProvider, CustomTabsConnection connection, - Lazy<CustomTabObserver> customTabObserver) { + public CustomTabActivityNavigationController( + CustomTabActivityTabController tabController, + CustomTabActivityTabProvider tabProvider, + CustomTabIntentDataProvider intentDataProvider, + CustomTabsConnection connection, + Lazy<CustomTabObserver> customTabObserver, + CloseButtonNavigator closeButtonNavigator, + Lazy<ToolbarManager> toolbarManager, + ChromeBrowserInitializer chromeBrowserInitializer, + ChromeActivity activity, + ActivityLifecycleDispatcher lifecycleDispatcher, + Lazy<ChromeFullscreenManager> fullscreenManager) { + mTabController = tabController; mTabProvider = tabProvider; mIntentDataProvider = intentDataProvider; mConnection = connection; mCustomTabObserver = customTabObserver; + mCloseButtonNavigator = closeButtonNavigator; + mToolbarManager = toolbarManager; + mChromeBrowserInitializer = chromeBrowserInitializer; + mActivity = activity; + mFullscreenManager = fullscreenManager; + + lifecycleDispatcher.register(this); + mTabProvider.addObserver(mTabObserver); } /** @@ -80,4 +178,176 @@ mIntentDataProvider.getIntent(), defaultTransition)); tab.loadUrl(params); } + + /** + * Handles back button navigation. + */ + public boolean navigateOnBack() { + if (!mChromeBrowserInitializer.hasNativeInitializationCompleted()) return false; + + RecordUserAction.record("CustomTabs.SystemBack"); + if (mTabProvider.getTab() == null) return false; + + if (mFullscreenManager.get().getPersistentFullscreenMode()) { + mFullscreenManager.get().exitPersistentFullscreenMode(); + return true; + } + + if (mBackHandler != null + && mBackHandler.handleBackPressed(this::executeDefaultBackHandling)) { + return true; + } + + executeDefaultBackHandling(); + return true; + } + + private void executeDefaultBackHandling() { + if (mToolbarManager.get().back()) return; + + // mTabController.closeTab may result in either closing the only tab, or swapping to the + // previous tab. In the first case we need finish to be called with USER_NAVIGATION reason. + mIsClosingTabOnBack = true; + mTabController.closeTab(); + mIsClosingTabOnBack = false; + } + + /** + * Handles close button navigation. + */ + public void navigateOnClose() { + NavigationController navigationController = getNavigationController(); + if (navigationController != null + && mCloseButtonNavigator.navigateOnClose(navigationController)) { + return; + } + finish(USER_NAVIGATION); + } + + @Nullable + private NavigationController getNavigationController() { + Tab tab = mTabProvider.getTab(); + if (tab == null) return null; + WebContents webContents = tab.getWebContents(); + if (webContents == null) return null; + return webContents.getNavigationController(); + } + + /** + * Opens the URL currently being displayed in the Custom Tab in the regular browser. + * @param forceReparenting Whether tab reparenting should be forced for testing. + * + * @return Whether or not the tab was sent over successfully. + */ + public boolean openCurrentUrlInBrowser(boolean forceReparenting) { + Tab tab = mTabProvider.getTab(); + if (tab == null) return false; + + String url = tab.getUrl(); + if (DomDistillerUrlUtils.isDistilledPage(url)) { + url = DomDistillerUrlUtils.getOriginalUrlFromDistillerUrl(url); + } + if (TextUtils.isEmpty(url)) url = mIntentDataProvider.getUrlToLoad(); + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + + boolean willChromeHandleIntent = + mIntentDataProvider.isOpenedByChrome() || mIntentDataProvider.isIncognito(); + + StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites(); + try { + willChromeHandleIntent |= ExternalNavigationDelegateImpl + .willChromeHandleIntent(intent, true); + } finally { + StrictMode.setThreadPolicy(oldPolicy); + } + + Bundle startActivityOptions = ActivityOptionsCompat.makeCustomAnimation( + mActivity, R.anim.abc_fade_in, R.anim.abc_fade_out).toBundle(); + if (willChromeHandleIntent || forceReparenting) { + // Remove observer to not trigger finishing in onAllTabsClosed() callback - we'll use + // reparenting finish callback instead. + mTabProvider.removeObserver(mTabObserver); + mTabController.detachAndStartReparenting(intent, startActivityOptions, + () -> finish(REPARENTING)); + } else { + // Temporarily allowing disk access while fixing. TODO: http://crbug.com/581860 + StrictMode.allowThreadDiskWrites(); + try { + if (mIntentDataProvider.isInfoPage()) { + IntentHandler.startChromeLauncherActivityForTrustedIntent(intent); + } else { + mActivity.startActivity(intent, startActivityOptions); + } + } finally { + StrictMode.setThreadPolicy(oldPolicy); + } + } + return true; + } + + /** + * Finishes the Custom Tab activity and removes the reference from the Android recents. + * + * @param reason The reason for finishing. + */ + public void finish(@FinishReason int reason) { + if (mIsFinishing) return; + mIsFinishing = true; + + if (reason != REPARENTING) { + // Closing the activity destroys the renderer as well. Re-create a spare renderer some + // time after, so that we have one ready for the next tab open. This does not increase + // memory consumption, as the current renderer goes away. We create a renderer as a lot + // of users open several Custom Tabs in a row. The delay is there to avoid jank in the + // transition animation when closing the tab. + PostTask.postDelayedTask(UiThreadTaskTraits.DEFAULT, + CustomTabsConnection::createSpareWebContents, 500); + } + + if (mFinishHandler != null) { + mFinishHandler.onFinish(reason); + } + } + + /** + * See {@link BackHandler}. Only one BackHandler at a time should be set. + */ + public void setBackHandler(BackHandler handler) { + assert mBackHandler == null : "Multiple BackHandlers not supported"; + mBackHandler = handler; + } + + /** + * Sets a {@link FinishHandler} to be notified when the custom tab is being closed. + */ + public void setFinishHandler(FinishHandler finishHandler) { + assert mFinishHandler == null : + "Multiple FinishedHandlers not supported, replace with ObserverList if necessary"; + mFinishHandler = finishHandler; + } + + /** + * Sets a criterion to choose a page to land to when close button is pressed. + * Only one such criterion can be set. + * If no page in the navigation history meets the criterion, or there is no criterion, then + * pressing close button will finish the Custom Tab activity. + */ + public void setLandingPageOnCloseCriterion(CloseButtonNavigator.PageCriteria criterion) { + mCloseButtonNavigator.setLandingPageCriteria(criterion); + } + + @Override + public void onStartWithNative() { + mIsFinishing = false; + } + + @Override + public void onStopWithNative() { + if (mIsFinishing) { + mTabController.closeAndForgetTab(); + } else { + mTabController.saveState(); + } + } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityTabController.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityTabController.java index 72265a16..f5e8e97 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityTabController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityTabController.java
@@ -145,7 +145,7 @@ * Detaches the tab and starts reparenting into the browser using given {@param intent} and * {@param startActivityOptions}. */ - public void detachAndStartReparenting(Intent intent, Bundle startActivityOptions, + void detachAndStartReparenting(Intent intent, Bundle startActivityOptions, Runnable finishCallback) { Tab tab = mTabProvider.getTab(); if (tab == null) { @@ -156,14 +156,24 @@ tab.detachAndStartReparenting(intent, startActivityOptions, finishCallback); } + /** + * Closes the current tab. This doesn't necessarily lead to closing the entire activity, in + * case links with target="_blank" were followed. See the comment to + * {@link CustomTabActivityTabProvider.Observer#onAllTabsClosed}. + */ + void closeTab() { + mTabFactory.getTabModelSelector().getCurrentModel().closeTab(mTabProvider.getTab(), + false, false, false); + } + /** Closes the tab and deletes related metadata. */ - public void closeAndForgetTab() { + void closeAndForgetTab() { mTabFactory.getTabModelSelector().closeAllTabs(true); mTabPersistencePolicy.deleteMetadataStateFileAsync(); } /** Save the current state of the tab. */ - public void saveState() { + void saveState() { mTabFactory.getTabModelSelector().saveState(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dependency_injection/CustomTabActivityComponent.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dependency_injection/CustomTabActivityComponent.java index d4302a26..89cd2b5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dependency_injection/CustomTabActivityComponent.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dependency_injection/CustomTabActivityComponent.java
@@ -6,7 +6,6 @@ import org.chromium.chrome.browser.browserservices.trustedwebactivityui.TrustedWebActivityCoordinator; import org.chromium.chrome.browser.contextual_suggestions.ContextualSuggestionsModule; -import org.chromium.chrome.browser.customtabs.CloseButtonNavigator; import org.chromium.chrome.browser.customtabs.CustomTabActivityLifecycleUmaTracker; import org.chromium.chrome.browser.customtabs.CustomTabBottomBarDelegate; import org.chromium.chrome.browser.customtabs.CustomTabTabPersistencePolicy; @@ -37,7 +36,6 @@ DynamicModuleToolbarController resolveDynamicModuleToolbarController(); DynamicModuleCoordinator resolveDynamicModuleCoordinator(); - CloseButtonNavigator resolveCloseButtonNavigator(); TabObserverRegistrar resolveTabObserverRegistrar(); CustomTabTopBarDelegate resolveTobBarDelegate(); CustomTabBottomBarDelegate resolveBottomBarDelegate();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dynamicmodule/DynamicModuleCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dynamicmodule/DynamicModuleCoordinator.java index c0019ab..549aed4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dynamicmodule/DynamicModuleCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/dynamicmodule/DynamicModuleCoordinator.java
@@ -194,6 +194,7 @@ mPageCriteria = url -> (isModuleLoading() || isModuleLoaded()) && isModuleManagedUrl(url); closeButtonNavigator.setLandingPageCriteria(mPageCriteria); + mNavigationController.setBackHandler(this::onBackPressedAsync); activityLifecycleDispatcher.register(this); } @@ -286,10 +287,10 @@ /** * @see IActivityDelegate#onBackPressedAsync */ - public boolean onBackPressedAsync(Runnable notHandledRunnable) { + public boolean onBackPressedAsync(Runnable defaultBackHandler) { if (mModuleEntryPoint != null && mModuleEntryPoint.getModuleVersion() >= ON_BACK_PRESSED_ASYNC_API_VERSION) { - mActivityDelegate.onBackPressedAsync(notHandledRunnable); + mActivityDelegate.onBackPressedAsync(defaultBackHandler); return true; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateController.java b/chrome/android/java/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateController.java index 6380b2e..fccd7e0b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/night_mode/GlobalNightModeStateController.java
@@ -4,7 +4,7 @@ package org.chromium.chrome.browser.night_mode; -import static org.chromium.chrome.browser.preferences.ChromePreferenceManager.NIGHT_MODE_SETTINGS_ENABLED_KEY; +import static org.chromium.chrome.browser.preferences.ChromePreferenceManager.UI_THEME_SETTING_KEY; import android.annotation.TargetApi; import android.content.BroadcastReceiver; @@ -24,6 +24,7 @@ import org.chromium.base.ObserverList; import org.chromium.chrome.browser.ChromeBaseAppCompatActivity; import org.chromium.chrome.browser.preferences.ChromePreferenceManager; +import org.chromium.chrome.browser.preferences.themes.ThemePreferences; import org.chromium.chrome.browser.util.FeatureUtilities; /** @@ -72,7 +73,7 @@ } mPreferenceObserver = key -> { - if (TextUtils.equals(key, NIGHT_MODE_SETTINGS_ENABLED_KEY)) updateNightMode(); + if (TextUtils.equals(key, UI_THEME_SETTING_KEY)) updateNightMode(); }; initializeForPowerSaveMode(); @@ -148,14 +149,15 @@ } private void updateNightMode() { - // TODO(https://crbug.com/942771): Update logic for real user settings. - final boolean newMode = mPowerSaveModeOn - || SystemNightModeMonitor.getInstance().isSystemNightModeOn() - || ChromePreferenceManager.getInstance().readBoolean( - NIGHT_MODE_SETTINGS_ENABLED_KEY, false); - if (mNightModeOn != null && newMode == mNightModeOn) return; + final int themeSetting = + ChromePreferenceManager.getInstance().readInt(UI_THEME_SETTING_KEY); + final boolean newNightModeOn = themeSetting == ThemePreferences.ThemeSetting.SYSTEM_DEFAULT + && (mPowerSaveModeOn + || SystemNightModeMonitor.getInstance().isSystemNightModeOn()) + || themeSetting == ThemePreferences.ThemeSetting.DARK; + if (mNightModeOn != null && newNightModeOn == mNightModeOn) return; - mNightModeOn = newMode; + mNightModeOn = newNightModeOn; AppCompatDelegate.setDefaultNightMode( mNightModeOn ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO); for (Observer observer : mObservers) observer.onNightModeStateChanged();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTask.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTask.java new file mode 100644 index 0000000..dae4d36f --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTask.java
@@ -0,0 +1,98 @@ +// 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. + +package org.chromium.chrome.browser.notifications; + +import android.content.Context; +import android.os.Bundle; + +import org.chromium.base.ContextUtils; +import org.chromium.base.VisibleForTesting; +import org.chromium.chrome.browser.background_task_scheduler.NativeBackgroundTask; +import org.chromium.components.background_task_scheduler.BackgroundTask.TaskFinishedCallback; +import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory; +import org.chromium.components.background_task_scheduler.TaskIds; +import org.chromium.components.background_task_scheduler.TaskInfo; +import org.chromium.components.background_task_scheduler.TaskParameters; + +/** + * Handles notification triggers scheduled via {@link NotificationTriggerScheduler}. + * This task calls NotificationTriggerScheduler::triggerNotifications after loading native code. + */ +public class NotificationTriggerBackgroundTask extends NativeBackgroundTask { + @VisibleForTesting + protected static final String KEY_TIMESTAMP = "Timestamp"; + + /** Indicates whether we should reschedule this task if it gets stopped. */ + private boolean mShouldReschedule = true; + + @Override + public @StartBeforeNativeResult int onStartTaskBeforeNativeLoaded( + Context context, TaskParameters taskParameters, TaskFinishedCallback callback) { + assert taskParameters.getTaskId() == TaskIds.NOTIFICATION_TRIGGER_JOB_ID; + // Check if we need to continue by waking up native or this trigger got handled already. + mShouldReschedule = NotificationTriggerScheduler.getInstance().checkAndResetTrigger( + taskParameters.getExtras().getLong(KEY_TIMESTAMP)); + return mShouldReschedule ? StartBeforeNativeResult.LOAD_NATIVE + : StartBeforeNativeResult.DONE; + } + + @Override + protected void onStartTaskWithNative( + Context context, TaskParameters taskParameters, TaskFinishedCallback callback) { + assert taskParameters.getTaskId() == TaskIds.NOTIFICATION_TRIGGER_JOB_ID; + // Simply waking up native should have triggered all outstanding notifications already. + // Explicitly calling TriggerNotifications here in case Chrome was already running. + NotificationTriggerScheduler.getInstance().triggerNotifications(); + // TODO(knollr): wait until native is done + mShouldReschedule = false; + callback.taskFinished(false); + } + + @Override + protected boolean onStopTaskBeforeNativeLoaded(Context context, TaskParameters taskParameters) { + assert taskParameters.getTaskId() == TaskIds.NOTIFICATION_TRIGGER_JOB_ID; + return mShouldReschedule; + } + + @Override + protected boolean onStopTaskWithNative(Context context, TaskParameters taskParameters) { + assert taskParameters.getTaskId() == TaskIds.NOTIFICATION_TRIGGER_JOB_ID; + return mShouldReschedule; + } + + @Override + public void reschedule(Context context) { + NotificationTriggerScheduler.getInstance().reschedule(); + } + + /** + * Schedules and replaces a task to trigger notifications at |timestamp|. + * @param timestamp The time at which this task should trigger. + * @param delay The delay from now in milliseconds when this task should trigger. + */ + public static void schedule(long timestamp, long delay) { + Bundle bundle = new Bundle(); + bundle.putLong(KEY_TIMESTAMP, timestamp); + TaskInfo taskInfo = TaskInfo.createOneOffTask(TaskIds.NOTIFICATION_TRIGGER_JOB_ID, + NotificationTriggerBackgroundTask.class, delay, delay) + .setUpdateCurrent(true) + .setIsPersisted(true) + .setExtras(bundle) + .build(); + + // This will overwrite any existing task with this ID. + BackgroundTaskSchedulerFactory.getScheduler().schedule( + ContextUtils.getApplicationContext(), taskInfo); + } + + /** + * Cancels any pending tasks with this ID. Note that a task that has already started executing + * might still continue to run after this has been called. + */ + public static void cancel() { + BackgroundTaskSchedulerFactory.getScheduler().cancel( + ContextUtils.getApplicationContext(), TaskIds.NOTIFICATION_TRIGGER_JOB_ID); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationTriggerScheduler.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationTriggerScheduler.java new file mode 100644 index 0000000..26d553cf --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationTriggerScheduler.java
@@ -0,0 +1,127 @@ +// 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. + +package org.chromium.chrome.browser.notifications; + +import android.text.format.DateUtils; + +import org.chromium.base.ContextUtils; +import org.chromium.base.VisibleForTesting; +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.NativeMethods; + +/** + * The {@link NotificationTriggerScheduler} singleton is responsible for scheduling notification + * triggers to wake Chrome up so that scheduled notifications can be displayed. + * Thread model: This class is to be run on the UI thread only. + */ +public class NotificationTriggerScheduler { + private static final String KEY_NEXT_TRIGGER = "notification_trigger_scheduler.next_trigger"; + + /** Clock to use so we can mock time in tests. */ + public static interface Clock { public long currentTimeMillis(); } + + private Clock mClock; + + // Delay by 9 minutes when we need to reschedule so we're not waking up too often but still + // within a reasonable time to show scheduled notifications. Note that if the reschedule was + // caused by an upgrade, we'll show all scheduled notifications on the next browser start anyway + // so this is just a fallback. 9 minutes were chosen as it's also the minimum time between two + // scheduled alarms via AlarmManager. + @VisibleForTesting + protected static final long RESCHEDULE_DELAY_TIME = DateUtils.MINUTE_IN_MILLIS * 9; + + private static class LazyHolder { + static final NotificationTriggerScheduler INSTANCE = + new NotificationTriggerScheduler(System::currentTimeMillis); + } + + private static NotificationTriggerScheduler sInstanceForTests; + + @VisibleForTesting + protected static void setInstanceForTests(NotificationTriggerScheduler instance) { + sInstanceForTests = instance; + } + + @CalledByNative + public static NotificationTriggerScheduler getInstance() { + return sInstanceForTests == null ? LazyHolder.INSTANCE : sInstanceForTests; + } + + @VisibleForTesting + protected NotificationTriggerScheduler(Clock clock) { + mClock = clock; + } + + /** + * Schedules a one-off background task to wake the browser up and call into native code to + * display pending notifications. If there is already a trigger scheduled earlier, this is a + * nop. Otherwise the existing trigger is overwritten. + * @param timestamp The timestamp of the next trigger. + */ + @CalledByNative + @VisibleForTesting + protected void schedule(long timestamp) { + // Check if there is already a trigger scheduled earlier. Also check for the case where + // Android did not execute our task and reschedule. + long now = mClock.currentTimeMillis(); + long nextTrigger = getNextTrigger(); + + if (timestamp < nextTrigger) { + // New timestamp is earlier than existing one -> schedule new task. + setNextTrigger(timestamp); + nextTrigger = timestamp; + } else if (nextTrigger >= now) { + // Existing timestamp is earlier than new one and still in future -> do nothing. + return; + } // else: Existing timestamp is earlier than new one and overdue -> schedule task again. + + long delay = Math.max(nextTrigger - now, 0); + NotificationTriggerBackgroundTask.schedule(nextTrigger, delay); + } + + /** + * Method for rescheduling a background task to wake up Chrome for processing notification + * trigger events in the event of an OS upgrade or Google Play Services upgrade. + */ + public void reschedule() { + schedule(mClock.currentTimeMillis() + RESCHEDULE_DELAY_TIME); + } + + /** + * Calls into native code to trigger all pending notifications. + */ + public void triggerNotifications() { + NotificationTriggerSchedulerJni.get().triggerNotifications(); + } + + /** + * Method to call when Android runs the scheduled task. + * @param timestamp The timestamp for which this trigger got scheduled. + * @return true if we should continue waking up native code, otherwise this event got handled + * already so no need to continue. + */ + public boolean checkAndResetTrigger(long timestamp) { + if (getNextTrigger() != timestamp) return false; + removeNextTrigger(); + return true; + } + + private long getNextTrigger() { + return ContextUtils.getAppSharedPreferences().getLong(KEY_NEXT_TRIGGER, Long.MAX_VALUE); + } + + private void removeNextTrigger() { + ContextUtils.getAppSharedPreferences().edit().remove(KEY_NEXT_TRIGGER).apply(); + } + + private void setNextTrigger(long timestamp) { + ContextUtils.getAppSharedPreferences().edit().putLong(KEY_NEXT_TRIGGER, timestamp).apply(); + } + + @NativeMethods + interface Natives { + void triggerNotifications(); + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupAdapter.java index f4b8e72..19960010 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupAdapter.java
@@ -7,7 +7,6 @@ import android.content.Context; import android.view.LayoutInflater; import android.view.View; -import android.view.View.MeasureSpec; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.RelativeLayout.LayoutParams; @@ -15,183 +14,88 @@ import org.chromium.chrome.R; -import java.util.Arrays; -import java.util.List; - /** - * The adapter that populates the list popup for password generation with data. If the constructor - * parameter passwordDisplayed is true, then this adapter makes the popup display two items in the - * list: (1) the password suggestion and (2) an explanation of the password generation feature. If - * the passwordDisplayed parameter is false, then the adapter shows only the explanation item. + * The adapter that populates the list popup for password generation with data. There is only + * one item in the list, the explanation of the password generation feature. */ public class PasswordGenerationPopupAdapter extends BaseAdapter { private final Context mContext; - private final List<Integer> mViewTypes; - private final String mPassword; - private final String mSuggestionTitle; private final String mExplanationText; - private final int mSuggestionMeasuredWidth; - - /** - * UI shows a generated password suggestion. - */ - private static final int SUGGESTION = 0; + private final int mWidth; /** * UI shows an explanation about storing passwords in Chrome. */ - private static final int EXPLANATION = 1; + private static final int EXPLANATION = 0; /** - * There're 2 types of views: SUGGESTION and EXPLANATION. + * There is only one type of view: EXPLANATION. */ - private static final int VIEW_TYPE_COUNT = 2; + private static final int VIEW_TYPE_COUNT = 1; /** * Builds the adapter to display views using data from delegate. * @param context Android context. - * @param passwordDisplayed Whether the auto-generated password should be suggested. - * @param password The auto-generated password to suggest. - * @param suggestionTitle The translated title of the suggestion part of the UI. * @param explanationText The translated text for the explanation part of the UI. * @param anchorWidthInDp The width of the anchor to which the popup is attached. Used to size * the explanation view. */ - public PasswordGenerationPopupAdapter(Context context, boolean passwordDisplayed, - String password, String suggestionTitle, String explanationText, - float anchorWidthInDp) { - super(); + public PasswordGenerationPopupAdapter( + Context context, String explanationText, float anchorWidthInDp) { mContext = context; - mViewTypes = passwordDisplayed ? Arrays.asList(SUGGESTION, EXPLANATION) - : Arrays.asList(EXPLANATION); - mPassword = password; - mSuggestionTitle = suggestionTitle; mExplanationText = explanationText; - - int horizontalMarginInPx = Math.round(mContext.getResources().getDimension( + int horizontalMarginInPx = Math.round(mContext.getResources().getDimensionPixelSize( R.dimen.password_generation_horizontal_margin)); int anchorWidthInPx = Math.round(anchorWidthInDp * mContext.getResources().getDisplayMetrics().density); - View suggestion = - getViewForType(SUGGESTION).findViewById(R.id.password_generation_suggestion); - suggestion.setMinimumWidth(anchorWidthInPx - 2 * horizontalMarginInPx); - suggestion.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), - MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED)); - mSuggestionMeasuredWidth = suggestion.getMeasuredWidth(); + mWidth = anchorWidthInPx - 2 * horizontalMarginInPx; } - /** - * Used by list popup window to draw an element. - * @param position The position of the element in the popup list. - * @param convertView If not null, the element view where the data goes. - * @param parent The list popup. - * @return The view of the popup list element at the given position. - */ @Override public View getView(int position, View convertView, ViewGroup parent) { - return convertView != null ? convertView : getViewForType(mViewTypes.get(position)); + return convertView != null ? convertView : createExplanationView(); } - /** - * Builds the view of this type. - * @param type The type of view to build. - * @return The view for this viewType. - */ - private View getViewForType(int type) { - LayoutInflater inflater = - (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - View view = null; - switch (type) { - case SUGGESTION: - view = inflater.inflate(R.layout.password_generation_popup_suggestion, null); - ((TextView) view.findViewById(R.id.password_generation_title)) - .setText(mSuggestionTitle); - ((TextView) view.findViewById(R.id.password_generation_password)) - .setText(mPassword); - break; - - case EXPLANATION: - view = inflater.inflate(R.layout.password_generation_popup_explanation, null); - TextView explanation = - (TextView) view.findViewById(R.id.password_generation_explanation); - explanation.setText(mExplanationText); - explanation.setLayoutParams( - new LayoutParams(mSuggestionMeasuredWidth, LayoutParams.WRAP_CONTENT)); - break; - - default: - assert false : "Unknown view type"; - break; - } - + private View createExplanationView() { + View view = LayoutInflater.from(mContext).inflate( + R.layout.password_generation_popup_explanation, null); + TextView explanation = view.findViewById(R.id.password_generation_explanation); + explanation.setText(mExplanationText); + explanation.setLayoutParams(new LayoutParams(mWidth, LayoutParams.WRAP_CONTENT)); return view; } - /** - * Returns the data item associated with this position in the data set. - * @return Always null. - */ @Override public Object getItem(int position) { return null; } - - /** - * Returns the row ID for the data set item at this position. - * @return Always position. - */ @Override public long getItemId(int position) { - return position; + return 0; } - /** - * Used by the popup window to determine which view should be reused to render the list item at - * this position. - * @return Either SUGGESTION or EXPLANATION. - */ @Override public int getItemViewType(int position) { - return mViewTypes.get(position); + return EXPLANATION; } - /** - * Used by the popup window to determine how many different views should be reused to render the - * popup. - * @return Always 2. - */ @Override public int getViewTypeCount() { return VIEW_TYPE_COUNT; } - /** - * Used by the popup window to determine how many items should be displayed in the list. - * @return Either 1 or 2. - */ @Override public int getCount() { - return mViewTypes.size(); + return 1; } - /** - * Used by list popup window to check if all of the elements are enabled. All password - * generation popups have an explanation element, which is not selectable. Therefore, this - * method always returns false: some of the items are disabled. - * @return boolean Always false. - */ @Override public boolean areAllItemsEnabled() { return false; } - /** - * Used by list popup window to check if the element at this position is enabled. Only the - * suggestion element is enabled. - * @return boolean True if the view at position is a suggestion. - */ @Override public boolean isEnabled(int position) { - return mViewTypes.get(position) == SUGGESTION; + return false; } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupBridge.java index 3e6123b..db23200 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/password_manager/PasswordGenerationPopupBridge.java
@@ -7,7 +7,6 @@ import android.content.Context; import android.os.Handler; import android.view.View; -import android.widget.AdapterView; import android.widget.PopupWindow; import org.chromium.base.annotations.CalledByNative; @@ -18,9 +17,8 @@ /** * JNI call glue for password generation between native and Java objects. */ -public class PasswordGenerationPopupBridge - implements AdapterView.OnItemClickListener, PopupWindow.OnDismissListener { - private final long mNativePasswordGenerationPopupViewAndroid; +public class PasswordGenerationPopupBridge implements PopupWindow.OnDismissListener { + private final long mNativePasswordGenerationEditingPopupViewAndroid; private final Context mContext; private final DropdownPopupWindow mPopup; private final View mAnchorView; @@ -44,7 +42,7 @@ */ public PasswordGenerationPopupBridge( View anchorView, long nativePopup, WindowAndroid windowAndroid) { - mNativePasswordGenerationPopupViewAndroid = nativePopup; + mNativePasswordGenerationEditingPopupViewAndroid = nativePopup; mContext = windowAndroid.getActivity().get(); mAnchorView = anchorView; // mContext could've been garbage collected. @@ -55,7 +53,6 @@ new Handler().post(this::onDismiss); } else { mPopup = new DropdownPopupWindow(mContext, anchorView); - mPopup.setOnItemClickListener(this); mPopup.setOnDismissListener(this); mPopup.disableHideOnOutsideTap(); mPopup.setContentDescriptionForAccessibility( @@ -64,48 +61,27 @@ } /** - * Handles clicks on popup list elements. Only suggestion element is enabled. Clicking on the - * suggestion element notifies the native counterpart that the suggested password was selected. - * @param parent The parent view where the click happened. - * @param view The view that was provided by the adapter that was clicked. - * @param position The position of the view in the adapter. - * @param id The row id of the clicked element. - */ - @Override - public void onItemClick(AdapterView<?> parent, View view, int position, long id) { - nativePasswordSelected(mNativePasswordGenerationPopupViewAndroid); - } - - private native void nativePasswordSelected(long nativePasswordGenerationPopupViewAndroid); - - /** * Handles dismissing the popup window. The native counterpart is notified to destroy the * controller. */ @Override public void onDismiss() { - nativeDismissed(mNativePasswordGenerationPopupViewAndroid); + nativeDismissed(mNativePasswordGenerationEditingPopupViewAndroid); } - private native void nativeDismissed(long nativePasswordGenerationPopupViewAndroid); - /** * Shows a password generation popup with specified data. Should be called after * setAnchorRect(). * @param isRtl True if the popup should be RTL. - * @param passwordDisplayed Whether the generated password should be displayed. - * @param password The auto-generated password to suggest. - * @param suggestionTitle The translated title of the suggestion part of the popup. * @param explanationText The translated text that explains the popup. */ @CalledByNative - private void show(boolean isRtl, boolean passwordDisplayed, String password, - String suggestionTitle, String explanationText) { + private void show(boolean isRtl, String explanationText) { if (mPopup != null) { float anchorWidth = mAnchorView.getLayoutParams().width; assert anchorWidth > 0; - PasswordGenerationPopupAdapter adapter = new PasswordGenerationPopupAdapter(mContext, - passwordDisplayed, password, suggestionTitle, explanationText, anchorWidth); + PasswordGenerationPopupAdapter adapter = + new PasswordGenerationPopupAdapter(mContext, explanationText, anchorWidth); mPopup.setAdapter(adapter); mPopup.setRtl(isRtl); mPopup.show(); @@ -119,4 +95,6 @@ private void hide() { if (mPopup != null) mPopup.dismiss(); } -} \ No newline at end of file + + private native void nativeDismissed(long nativePasswordGenerationEditingPopupViewAndroid); +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java index d18e6cb..042a3ba8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
@@ -185,7 +185,11 @@ mSpacingDecoration = new GridSpacingItemDecoration(mColumns, mPadding); mRecyclerView.addItemDecoration(mSpacingDecoration); - mPickerAdapter.notifyDataSetChanged(); + // Configuration change can happen at any time, even before the photos have been + // enumerated (when mPickerBitmaps is null, causing: https://crbug.com/947657). There's no + // need to call notifyDataSetChanged in that case because it will be called once the photo + // list becomes ready. + if (mPickerBitmaps != null) mPickerAdapter.notifyDataSetChanged(); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java index 8674934..c31a36f5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java
@@ -204,10 +204,10 @@ public static final String NIGHT_MODE_CCT_AVAILABLE_KEY = "night_mode_cct_available"; /** - * Whether or not night mode is enabled from user settings. - * Default value is false. + * The current theme setting in the user settings. + * Default value is System default (see {@link ThemePreference.ThemeSetting}). */ - public static final String NIGHT_MODE_SETTINGS_ENABLED_KEY = "night_mode_settings_enabled"; + public static final String UI_THEME_SETTING_KEY = "ui_theme_setting"; /** * Whether or not the download auto-resumption is enabled in native.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java index a606e467..cc74acb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/MainPreferences.java
@@ -45,7 +45,7 @@ public static final String PREF_SAVED_PASSWORDS = "saved_passwords"; public static final String PREF_CONTEXTUAL_SUGGESTIONS = "contextual_suggestions"; public static final String PREF_HOMEPAGE = "homepage"; - public static final String PREF_NIGHT_MODE = "night_mode"; + public static final String PREF_UI_THEME = "ui_theme"; public static final String PREF_DATA_REDUCTION = "data_reduction"; public static final String PREF_NOTIFICATIONS = "notifications"; public static final String PREF_LANGUAGES = "languages"; @@ -228,9 +228,9 @@ } if (FeatureUtilities.isNightModeAvailable()) { - addPreferenceIfAbsent(PREF_NIGHT_MODE); + addPreferenceIfAbsent(PREF_UI_THEME); } else { - removePreferenceIfPresent(PREF_NIGHT_MODE); + removePreferenceIfPresent(PREF_UI_THEME); } if (DeveloperPreferences.shouldShowDeveloperPreferences()) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/NightModePreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/NightModePreferences.java deleted file mode 100644 index a5c7702f..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/NightModePreferences.java +++ /dev/null
@@ -1,41 +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. - -package org.chromium.chrome.browser.preferences; - -import static org.chromium.chrome.browser.preferences.ChromePreferenceManager.NIGHT_MODE_SETTINGS_ENABLED_KEY; - -import android.os.Bundle; -import android.preference.PreferenceFragment; -import android.support.annotation.Nullable; - -import org.chromium.chrome.R; - -/** - * Fragment to manage the night mode user settings. - */ -public class NightModePreferences extends PreferenceFragment { - static final String PREF_NIGHT_MODE_SWITCH = "night_mode_switch"; - - @Override - public void onCreate(@Nullable Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - PreferenceUtils.addPreferencesFromResource(this, R.xml.night_mode_preferences); - // TODO(huayinz): Change to a proper string. - getActivity().setTitle("Dark mode"); - - // TODO(huayinz): Change this to a proper setting. - ChromeSwitchPreference switchPreference = - (ChromeSwitchPreference) findPreference(PREF_NIGHT_MODE_SWITCH); - switchPreference.setChecked(ChromePreferenceManager.getInstance().readBoolean( - NIGHT_MODE_SETTINGS_ENABLED_KEY, false)); - switchPreference.setOnPreferenceChangeListener((preference, newValue) -> { - boolean enabled = (boolean) newValue; - ChromePreferenceManager.getInstance().writeBoolean( - NIGHT_MODE_SETTINGS_ENABLED_KEY, enabled); - return true; - }); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/OWNERS b/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/OWNERS new file mode 100644 index 0000000..926f19c3 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/OWNERS
@@ -0,0 +1,5 @@ +twellington@chromium.org +huayinz@chromium.org + +# TEAM: chrome-android-app@chromium.org +# COMPONENT: UI>Browser>Mobile>Settings
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/RadioButtonGroupThemePreference.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/RadioButtonGroupThemePreference.java new file mode 100644 index 0000000..b188a49 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/RadioButtonGroupThemePreference.java
@@ -0,0 +1,89 @@ +// 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. + +package org.chromium.chrome.browser.preferences.themes; + +import android.content.Context; +import android.preference.Preference; +import android.util.AttributeSet; +import android.view.View; + +import org.chromium.chrome.R; +import org.chromium.chrome.browser.preferences.themes.ThemePreferences.ThemeSetting; +import org.chromium.chrome.browser.widget.RadioButtonWithDescription; + +import java.util.Arrays; +import java.util.List; + +/** + * A radio button group Preference used for Themes. Currently, it has 3 options: System default, + * Light, and Dark. + */ +public class RadioButtonGroupThemePreference + extends Preference implements RadioButtonWithDescription.OnCheckedChangeListener { + private @ThemeSetting int mSetting; + + private RadioButtonWithDescription mSystemDefault; + private RadioButtonWithDescription mLight; + private RadioButtonWithDescription mDark; + + public RadioButtonGroupThemePreference(Context context, AttributeSet attrs) { + super(context, attrs); + // Inflating from XML. + setLayoutResource(R.layout.radio_button_group_theme_preference); + } + + /** + * @param setting The initial setting for this Preference + */ + public void initialize(@ThemeSetting int setting) { + mSetting = setting; + } + + @Override + protected void onBindView(View view) { + super.onBindView(view); + + mSystemDefault = view.findViewById(R.id.system_default); + mLight = view.findViewById(R.id.light); + mDark = view.findViewById(R.id.dark); + + List<RadioButtonWithDescription> radioGroup = Arrays.asList(mSystemDefault, mLight, mDark); + for (RadioButtonWithDescription option : radioGroup) { + option.setRadioButtonGroup(radioGroup); + option.setOnCheckedChangeListener(this); + } + + RadioButtonWithDescription radioButton = findRadioButton(mSetting); + if (radioButton != null) radioButton.setChecked(true); + } + + @Override + public void onCheckedChanged() { + if (mSystemDefault.isChecked()) { + mSetting = ThemeSetting.SYSTEM_DEFAULT; + } else if (mLight.isChecked()) { + mSetting = ThemeSetting.LIGHT; + } else if (mDark.isChecked()) { + mSetting = ThemeSetting.DARK; + } + + callChangeListener(mSetting); + } + + /** + * @param setting The setting to find RadioButton for. + */ + private RadioButtonWithDescription findRadioButton(@ThemeSetting int setting) { + if (setting == ThemeSetting.SYSTEM_DEFAULT) { + return mSystemDefault; + } else if (setting == ThemeSetting.LIGHT) { + return mLight; + } else if (setting == ThemeSetting.DARK) { + return mDark; + } else { + return null; + } + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/ThemePreferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/ThemePreferences.java new file mode 100644 index 0000000..e104bfa --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/themes/ThemePreferences.java
@@ -0,0 +1,60 @@ +// 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. + +package org.chromium.chrome.browser.preferences.themes; + +import static org.chromium.chrome.browser.preferences.ChromePreferenceManager.UI_THEME_SETTING_KEY; + +import android.os.Bundle; +import android.preference.PreferenceFragment; +import android.support.annotation.IntDef; +import android.support.annotation.Nullable; +import android.widget.ListView; + +import org.chromium.chrome.R; +import org.chromium.chrome.browser.preferences.ChromePreferenceManager; +import org.chromium.chrome.browser.preferences.PreferenceUtils; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Fragment to manage the theme user settings. + */ +public class ThemePreferences extends PreferenceFragment { + @IntDef({ThemeSetting.SYSTEM_DEFAULT, ThemeSetting.LIGHT, ThemeSetting.DARK}) + @Retention(RetentionPolicy.SOURCE) + public @interface ThemeSetting { + int SYSTEM_DEFAULT = 0; + int LIGHT = 1; + int DARK = 2; + } + + static final String PREF_UI_THEME_PREF = "ui_theme_pref"; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + PreferenceUtils.addPreferencesFromResource(this, R.xml.theme_preferences); + getActivity().setTitle(getResources().getString(R.string.prefs_themes)); + + RadioButtonGroupThemePreference radioButtonGroupThemePreference = + (RadioButtonGroupThemePreference) findPreference(PREF_UI_THEME_PREF); + radioButtonGroupThemePreference.initialize( + ChromePreferenceManager.getInstance().readInt(UI_THEME_SETTING_KEY)); + radioButtonGroupThemePreference.setOnPreferenceChangeListener((preference, newValue) -> { + int theme = (int) newValue; + ChromePreferenceManager.getInstance().writeInt(UI_THEME_SETTING_KEY, theme); + return true; + }); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + ListView listView = getView().findViewById(android.R.id.list); + listView.setDivider(null); + } +} \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java index e69073b..98448f4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroid.java
@@ -510,7 +510,8 @@ // Following get* methods use this method instead of |Tab.getFullscreenManager| // because the latter can return null if invoked while the tab is in detached state. ChromeActivity activity = mTab.getActivity(); - return activity != null ? activity.getFullscreenManager() : null; + return activity != null && !activity.isActivityFinishingOrDestroyed() ? + activity.getFullscreenManager() : null; } @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java index 89b5a7e..b52f48e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelImpl.java
@@ -13,6 +13,7 @@ import org.chromium.chrome.browser.tab.InterceptNavigationDelegateImpl; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabCreatorManager.TabCreator; +import org.chromium.chrome.browser.util.FeatureUtilities; import org.chromium.chrome.browser.util.MathUtils; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.content_public.browser.WebContents; @@ -423,7 +424,13 @@ return; } - closeAllTabs(true, false, true); + // TODO(meiliang): This is a band-aid fix, should remove after LayoutManager is able to + // manage the Grid Tab Switcher. + // Disable animation if GridTabSwitcher or TabGroup is enabled. + boolean animate = !(FeatureUtilities.isGridTabSwitcherEnabled() + || FeatureUtilities.isTabGroupsAndroidEnabled()); + + closeAllTabs(animate, false, true); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/RadioButtonWithDescription.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/RadioButtonWithDescription.java index 2b212c8..3180c7a8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/RadioButtonWithDescription.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/RadioButtonWithDescription.java
@@ -54,6 +54,10 @@ if (attrs != null) applyAttributes(attrs); + final int padding = + getResources().getDimensionPixelSize(R.dimen.radio_button_with_description_padding); + setPaddingRelative(padding, padding, padding, padding); + // We want RadioButtonWithDescription to handle the clicks itself. setOnClickListener(this); // Make it focusable for navigation via key events (tab/up/down keys) @@ -68,6 +72,15 @@ String titleText = a.getString(R.styleable.RadioButtonWithDescription_titleText); if (titleText != null) mTitle.setText(titleText); + String descriptionText = + a.getString(R.styleable.RadioButtonWithDescription_descriptionText); + if (descriptionText != null) { + mDescription.setText(descriptionText); + mDescription.setVisibility(View.VISIBLE); + } else { + ((LayoutParams) mTitle.getLayoutParams()).addRule(RelativeLayout.CENTER_VERTICAL); + } + a.recycle(); } @@ -98,7 +111,14 @@ */ public void setDescriptionText(CharSequence text) { mDescription.setText(text); - mDescription.setVisibility(TextUtils.isEmpty(text) ? View.GONE : View.VISIBLE); + + if (TextUtils.isEmpty(text)) { + ((LayoutParams) mTitle.getLayoutParams()).addRule(RelativeLayout.CENTER_VERTICAL); + mDescription.setVisibility(View.GONE); + } else { + ((LayoutParams) mTitle.getLayoutParams()).removeRule(RelativeLayout.CENTER_VERTICAL); + mDescription.setVisibility(View.VISIBLE); + } } /**
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd index 35723b3..78329491 100644 --- a/chrome/android/java/strings/android_chrome_strings.grd +++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -697,6 +697,17 @@ Search and site suggestions disabled </message> + <!-- Themes preferences --> + <message name="IDS_PREFS_THEMES" desc="Title for the Themes preferences. [CHAR-LIMIT=32]"> + Themes + </message> + <message name="IDS_THEMES_SYSTEM_DEFAULT_TITLE" desc="Title for the System Default option. [CHAR-LIMIT=32]"> + System default + </message> + <message name="IDS_THEMES_SYSTEM_DEFAULT_SUMMARY" desc="Summary for the System Default option."> + Turn on dark theme when your device's Power Saver is on + </message> + <!-- Privacy preferences --> <message name="IDS_PREFS_PRIVACY" desc="Title for the Privacy preferences. [CHAR-LIMIT=32]"> Privacy
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_PREFS_THEMES.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_PREFS_THEMES.png.sha1 new file mode 100644 index 0000000..79c36c2 --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_PREFS_THEMES.png.sha1
@@ -0,0 +1 @@ +83e6b33441fb9fb040453b65e62b1ec2806b5dc0 \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_THEMES_SYSTEM_DEFAULT_SUMMARY.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_THEMES_SYSTEM_DEFAULT_SUMMARY.png.sha1 new file mode 100644 index 0000000..6a948f2 --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_THEMES_SYSTEM_DEFAULT_SUMMARY.png.sha1
@@ -0,0 +1 @@ +f480a380262e59945a8f6e231402e7811992452c \ No newline at end of file
diff --git a/chrome/android/java/strings/android_chrome_strings_grd/IDS_THEMES_SYSTEM_DEFAULT_TITLE.png.sha1 b/chrome/android/java/strings/android_chrome_strings_grd/IDS_THEMES_SYSTEM_DEFAULT_TITLE.png.sha1 new file mode 100644 index 0000000..cb22137 --- /dev/null +++ b/chrome/android/java/strings/android_chrome_strings_grd/IDS_THEMES_SYSTEM_DEFAULT_TITLE.png.sha1
@@ -0,0 +1 @@ +9050bd8f51737af32a7b110df31e7528028253b2 \ No newline at end of file
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java index e723158..69ab577 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -87,6 +87,7 @@ import org.chromium.chrome.browser.browserservices.BrowserSessionContentUtils; import org.chromium.chrome.browser.browserservices.Origin; import org.chromium.chrome.browser.browserservices.OriginVerifier; +import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason; import org.chromium.chrome.browser.dependency_injection.ModuleFactoryOverrides; import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.firstrun.FirstRunStatus; @@ -2178,7 +2179,7 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { Assert.assertFalse(WarmupManager.getInstance().hasSpareWebContents()); final CustomTabActivity activity = mCustomTabActivityTestRule.getActivity(); - activity.finishAndClose(false); + activity.getComponent().resolveNavigationController().finish(FinishReason.OTHER); }); CriteriaHelper.pollUiThread(new Criteria("No new spare renderer") { @Override @@ -2580,7 +2581,8 @@ }; tabToBeReparented.addObserver(observer); PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { - getActivity().openCurrentUrlInBrowser(true); + getActivity().getComponent().resolveNavigationController() + .openCurrentUrlInBrowser(true); Assert.assertNull(getActivity().getActivityTab()); }); // Use the extended CriteriaHelper timeout to make sure we get an activity
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java index 7a50814..6f5f32a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabTabPersistenceIntegrationTest.java
@@ -14,6 +14,7 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabState; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; @@ -56,7 +57,8 @@ waitForFileExistState(true, expectedTabFileName, stateDir); waitForFileExistState(true, expectedMetadataFileName, stateDir); - mCustomTabActivityTestRule.getActivity().finishAndClose(false); + mCustomTabActivityTestRule.getActivity().getComponent() + .resolveNavigationController().finish(FinishReason.OTHER); waitForFileExistState(false, expectedTabFileName, stateDir); waitForFileExistState(false, expectedMetadataFileName, stateDir);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java index 40a55ab9..1cd1b9e 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/TrustedCdnPublisherUrlTest.java
@@ -283,7 +283,8 @@ final Tab tab = customTabActivity.getActivityTab(); PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { Assert.assertEquals(publisherUrl, TrustedCdn.getPublisherUrl(tab)); - customTabActivity.openCurrentUrlInBrowser(true); + customTabActivity.getComponent().resolveNavigationController() + .openCurrentUrlInBrowser(true); Assert.assertNull(customTabActivity.getActivityTab()); });
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java index d3971573..4742e5f3 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java
@@ -18,6 +18,8 @@ import android.content.Intent; import android.content.SharedPreferences.Editor; +import android.os.Handler; +import android.os.Looper; import android.support.annotation.StringRes; import android.support.test.InstrumentationRegistry; import android.support.test.filters.MediumTest; @@ -94,24 +96,28 @@ public final CallbackHelper onSpaceDisplayUpdatedCallback = new CallbackHelper(); private List<DownloadHistoryItemWrapper> mOnSelectionItems; + private Handler mHandler; + + public TestObserver() { + mHandler = new Handler(Looper.getMainLooper()); + } @Override public void onChanged() { // To guarantee that all real Observers have had a chance to react to the event, post // the CallbackHelper.notifyCalled() call. - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> onChangedCallback.notifyCalled()); + mHandler.post(() -> onChangedCallback.notifyCalled()); } @Override public void onSelectionStateChange(List<DownloadHistoryItemWrapper> selectedItems) { mOnSelectionItems = selectedItems; - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> onSelectionCallback.notifyCalled()); + mHandler.post(() -> onSelectionCallback.notifyCalled()); } @Override public void onSpaceDisplayUpdated(SpaceDisplay display) { - PostTask.postTask( - UiThreadTaskTraits.DEFAULT, () -> onSpaceDisplayUpdatedCallback.notifyCalled()); + mHandler.post(() -> onSpaceDisplayUpdatedCallback.notifyCalled()); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/StubbedOfflineContentProvider.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/StubbedOfflineContentProvider.java index d5176b2..83a48f94 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/StubbedOfflineContentProvider.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/StubbedOfflineContentProvider.java
@@ -6,8 +6,10 @@ import static junit.framework.Assert.assertEquals; +import android.os.Handler; +import android.os.Looper; + import org.chromium.base.Callback; -import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CallbackHelper; import org.chromium.components.offline_items_collection.ContentId; import org.chromium.components.offline_items_collection.LaunchLocation; @@ -16,12 +18,12 @@ import org.chromium.components.offline_items_collection.RenameResult; import org.chromium.components.offline_items_collection.ShareCallback; import org.chromium.components.offline_items_collection.VisualsCallback; -import org.chromium.content_public.browser.UiThreadTaskTraits; import java.util.ArrayList; /** Stubs out the OfflineContentProvider. */ public class StubbedOfflineContentProvider implements OfflineContentProvider { + private final Handler mHandler; private final CallbackHelper mAddObserverCallback; private final CallbackHelper mRemoveObserverCallback; private final CallbackHelper mDeleteItemCallback; @@ -29,6 +31,7 @@ private OfflineContentProvider.Observer mObserver; public StubbedOfflineContentProvider() { + mHandler = new Handler(Looper.getMainLooper()); mAddObserverCallback = new CallbackHelper(); mRemoveObserverCallback = new CallbackHelper(); mDeleteItemCallback = new CallbackHelper(); @@ -59,23 +62,22 @@ @Override public void getItemById(ContentId id, Callback<OfflineItem> callback) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> callback.onResult(null)); + mHandler.post(() -> callback.onResult(null)); } @Override public void getAllItems(Callback<ArrayList<OfflineItem>> callback) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> callback.onResult(mItems)); + mHandler.post(() -> callback.onResult(mItems)); } @Override public void getVisualsForItem(ContentId id, VisualsCallback callback) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> callback.onVisualsAvailable(id, null)); + mHandler.post(() -> callback.onVisualsAvailable(id, null)); } @Override public void getShareInfoForItem(ContentId id, ShareCallback callback) { - PostTask.postTask( - UiThreadTaskTraits.DEFAULT, () -> callback.onShareInfoAvailable(id, null)); + mHandler.post(() -> callback.onShareInfoAvailable(id, null)); } @Override @@ -87,9 +89,12 @@ } } - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { - mObserver.onItemRemoved(id); - mDeleteItemCallback.notifyCalled(); + mHandler.post(new Runnable() { + @Override + public void run() { + mObserver.onItemRemoved(id); + mDeleteItemCallback.notifyCalled(); + } }); } @@ -107,7 +112,6 @@ @Override public void renameItem(ContentId id, String name, Callback<Integer /*RenameResult*/> callback) { - PostTask.postTask( - UiThreadTaskTraits.DEFAULT, () -> callback.onResult(RenameResult.SUCCESS)); + mHandler.post(() -> callback.onResult(RenameResult.SUCCESS)); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java index cdd10633..508571f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/download/ui/StubbedProvider.java
@@ -8,9 +8,10 @@ import static junit.framework.Assert.assertNull; import android.os.Environment; +import android.os.Handler; +import android.os.Looper; import org.chromium.base.Callback; -import org.chromium.base.task.PostTask; import org.chromium.base.test.util.CallbackHelper; import org.chromium.chrome.browser.download.DownloadInfo; import org.chromium.chrome.browser.download.DownloadItem; @@ -30,7 +31,6 @@ import org.chromium.components.offline_items_collection.RenameResult; import org.chromium.components.offline_items_collection.ShareCallback; import org.chromium.components.offline_items_collection.VisualsCallback; -import org.chromium.content_public.browser.UiThreadTaskTraits; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -66,9 +66,12 @@ @Override public void getAllDownloads(final boolean isOffTheRecord) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { - mObserver.onAllDownloadsRetrieved( - isOffTheRecord ? offTheRecordItems : regularItems, isOffTheRecord); + mHandler.post(new Runnable() { + @Override + public void run() { + mObserver.onAllDownloadsRetrieved( + isOffTheRecord ? offTheRecordItems : regularItems, isOffTheRecord); + } }); } @@ -83,9 +86,12 @@ @Override public void removeDownload( final String guid, final boolean isOffTheRecord, boolean externallyRemoved) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { - mObserver.onDownloadItemRemoved(guid, isOffTheRecord); - removeDownloadCallback.notifyCalled(); + mHandler.post(new Runnable() { + @Override + public void run() { + mObserver.onDownloadItemRemoved(guid, isOffTheRecord); + removeDownloadCallback.notifyCalled(); + } }); } @@ -126,7 +132,7 @@ @Override public void getAllItems(Callback<ArrayList<OfflineItem>> callback) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> callback.onResult(items)); + mHandler.post(() -> callback.onResult(items)); } @Override @@ -138,9 +144,12 @@ } } - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { - observer.onItemRemoved(id); - deleteItemCallback.notifyCalled(); + mHandler.post(new Runnable() { + @Override + public void run() { + observer.onItemRemoved(id); + deleteItemCallback.notifyCalled(); + } }); } @@ -155,26 +164,23 @@ @Override public void getItemById(ContentId id, Callback<OfflineItem> callback) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> callback.onResult(null)); + mHandler.post(() -> callback.onResult(null)); } @Override public void getVisualsForItem(ContentId id, VisualsCallback callback) { - PostTask.postTask( - UiThreadTaskTraits.DEFAULT, () -> callback.onVisualsAvailable(id, null)); + mHandler.post(() -> callback.onVisualsAvailable(id, null)); } @Override public void getShareInfoForItem(ContentId id, ShareCallback callback) { - PostTask.postTask( - UiThreadTaskTraits.DEFAULT, () -> callback.onShareInfoAvailable(id, null)); + mHandler.post(() -> callback.onShareInfoAvailable(id, null)); } @Override public void renameItem( ContentId id, String name, Callback<Integer /*RenameResult*/> callback) { - PostTask.postTask( - UiThreadTaskTraits.DEFAULT, () -> callback.onResult(RenameResult.SUCCESS)); + mHandler.post(() -> callback.onResult(RenameResult.SUCCESS)); } } @@ -197,7 +203,7 @@ public class StubbedUIDelegate implements UIDelegate { @Override public void deleteItem(DownloadHistoryItemWrapper item) { - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> item.removePermanently()); + mHandler.post(() -> item.removePermanently()); } @Override @@ -206,6 +212,7 @@ private static final long ONE_GIGABYTE = 1024L * 1024L * 1024L; + private final Handler mHandler; private final StubbedDownloadDelegate mDownloadDelegate; private final StubbedOfflineContentProvider mOfflineContentProvider; private final SelectionDelegate<DownloadHistoryItemWrapper> mSelectionDelegate; @@ -213,6 +220,7 @@ private UIDelegate mUIDelegate; public StubbedProvider() { + mHandler = new Handler(Looper.getMainLooper()); mDownloadDelegate = new StubbedDownloadDelegate(); mOfflineContentProvider = new StubbedOfflineContentProvider(); mSelectionDelegate = new DownloadItemSelectionDelegate();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java new file mode 100644 index 0000000..82717626 --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/portals/PortalsTest.java
@@ -0,0 +1,95 @@ +// 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. + +package org.chromium.chrome.browser.portals; + +import android.support.test.InstrumentationRegistry; +import android.support.test.filters.MediumTest; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +import org.chromium.base.test.util.CallbackHelper; +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.browser.ChromeActivity; +import org.chromium.chrome.browser.ChromeSwitches; +import org.chromium.chrome.browser.tab.EmptyTabObserver; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.chrome.test.ChromeActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.content_public.browser.WebContents; +import org.chromium.net.test.EmbeddedTestServer; + +/** + * Tests for the chrome/ layer support of the HTML portal element. + */ +@RunWith(ChromeJUnit4ClassRunner.class) +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, "enable-features=Portals"}) +public class PortalsTest { + @Rule + public ChromeActivityTestRule<ChromeActivity> mActivityTestRule = + new ChromeActivityTestRule<>(ChromeActivity.class); + + private EmbeddedTestServer mTestServer; + + @Before + public void setUp() throws Exception { + mTestServer = EmbeddedTestServer.createAndStartServer(InstrumentationRegistry.getContext()); + } + + @After + public void tearDown() throws Exception { + mTestServer.stopAndDestroyServer(); + } + + private class TabContentsSwapObserver extends EmptyTabObserver { + private final CallbackHelper mCallbackHelper; + + public TabContentsSwapObserver() { + mCallbackHelper = new CallbackHelper(); + } + + public CallbackHelper getCallbackHelper() { + return mCallbackHelper; + } + + @Override + public void onWebContentsSwapped(Tab tab, boolean didStartLoad, boolean didFinishLoad) { + mCallbackHelper.notifyCalled(); + } + } + + /** + * Tests that a portal can be activated and have its contents swapped in to its embedder's tab. + */ + @Test + @MediumTest + @Feature({"Portals"}) + public void testActivate() throws Exception { + mActivityTestRule.startMainActivityWithURL(mTestServer.getURL( + "/chrome/test/data/android/portals/portal-to-basic-content.html")); + + final Tab tab = mActivityTestRule.getActivity().getActivityTab(); + + final WebContents embedderContents = tab.getWebContents(); + Assert.assertNotNull(embedderContents); + + TabContentsSwapObserver swapObserver = new TabContentsSwapObserver(); + CallbackHelper swapWaiter = swapObserver.getCallbackHelper(); + tab.addObserver(swapObserver); + + int currSwapCount = swapWaiter.getCallCount(); + mActivityTestRule.runJavaScriptCodeInCurrentTab("activatePortal();"); + swapWaiter.waitForCallback(currSwapCount, 1); + + final WebContents portalContents = tab.getWebContents(); + Assert.assertNotNull(portalContents); + Assert.assertNotSame(embedderContents, portalContents); + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java index 6a20b33..943d9985 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/autofill/keyboard_accessory/ManualFillingControllerTest.java
@@ -254,7 +254,7 @@ when(mMockActivity.findViewById(android.R.id.content)).thenReturn(mMockContentView); mLastMockWebContents = mock(WebContents.class); when(mMockActivity.getCurrentWebContents()).then(i -> mLastMockWebContents); - when(mMockResources.getDimensionPixelSize(anyInt())).thenReturn(48); + setContentAreaDimensions(2.f, 80, 300); PasswordAccessorySheetCoordinator.IconProvider.getInstance().setIconForTesting(mMockIcon); mController.initialize(mMockWindow, mMockKeyboardAccessory, mMockAccessorySheet); } @@ -648,6 +648,35 @@ } @Test + public void testRestrictsSheetSizeIfVerticalSpaceChanges() { + // Resize the screen from 300x80@2.f to 300x160@2.f. + setContentAreaDimensions(2.f, 160, 300); + mMediator.onLayoutChange(mMockContentView, 0, 0, 320, 600, 0, 0, 160, 600); + reset(mMockKeyboardAccessory); + + addBrowserTab(mMediator, 1234, null); + SheetProviderHelper tabHelper = new SheetProviderHelper(); + mController.registerPasswordProvider(tabHelper.getSheetDataProvider()); + when(mMockKeyboard.isSoftKeyboardShowing(eq(mMockActivity), any())).thenReturn(true); + when(mMockKeyboardAccessory.hasContents()).thenReturn(true); + + // Show the accessory bar: + mController.showWhenKeyboardIsVisible(); + verify(mMockKeyboardAccessory).requestShowing(); + when(mMockKeyboardAccessory.isShown()).thenReturn(true); + + // Simulate an open tab: + when(mMockKeyboardAccessory.hasActiveTab()).thenReturn(true); + when(mMockAccessorySheet.getHeight()).thenReturn(120); // Return height of a large keyboard. + mMediator.onLayoutChange(mMockContentView, 0, 0, 320, 264, 0, 0, 320, 600); + + // An orientation change will not close the open sheet but restrict its size: + simulateOrientationChange(2.0f, 300, 160); + // Expect that the remaining space is at least 80dp plus height of accessory bar (48dp). + verify(mMockAccessorySheet).setHeight(64); // == 2f * (160dp - 80dp - 48dp)) + } + + @Test public void testClosingTabDoesntAffectUnitializedComponents() { // A leftover tab is closed before the filling component could pick up the active tab. closeBrowserTab(mMediator, mock(Tab.class)); @@ -745,6 +774,8 @@ when(mMockWindow.getDisplay()).thenReturn(mockDisplay); when(mLastMockWebContents.getHeight()).thenReturn(heightDp); when(mLastMockWebContents.getWidth()).thenReturn(widthDp); + // Return the correct keyboard_accessory_height for the current density: + when(mMockResources.getDimensionPixelSize(anyInt())).thenReturn((int) (density * 48)); } /**
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityContentTestEnvironment.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityContentTestEnvironment.java index 42d957c..448e7b1 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityContentTestEnvironment.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityContentTestEnvironment.java
@@ -25,6 +25,7 @@ import org.chromium.base.UserDataHost; import org.chromium.base.metrics.RecordHistogram; +import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.ActivityTabProvider.ActivityTabObserver; import org.chromium.chrome.browser.ChromeActivity; @@ -33,6 +34,7 @@ import org.chromium.chrome.browser.WebContentsFactory; import org.chromium.chrome.browser.compositor.CompositorViewHolder; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; +import org.chromium.chrome.browser.customtabs.CloseButtonNavigator; import org.chromium.chrome.browser.customtabs.CustomTabDelegateFactory; import org.chromium.chrome.browser.customtabs.CustomTabIntentDataProvider; import org.chromium.chrome.browser.customtabs.CustomTabNavigationEventObserver; @@ -40,13 +42,18 @@ import org.chromium.chrome.browser.customtabs.CustomTabTabPersistencePolicy; import org.chromium.chrome.browser.customtabs.CustomTabsConnection; import org.chromium.chrome.browser.customtabs.TabObserverRegistrar; +import org.chromium.chrome.browser.customtabs.shadows.ShadowExternalNavigationDelegateImpl; +import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; import org.chromium.chrome.browser.init.ActivityLifecycleDispatcher; +import org.chromium.chrome.browser.init.ChromeBrowserInitializer; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.AsyncTabParamsManager; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelectorImpl; import org.chromium.chrome.browser.tabmodel.document.AsyncTabCreationParams; +import org.chromium.chrome.browser.toolbar.ToolbarManager; import org.chromium.content_public.browser.LoadUrlParams; +import org.chromium.content_public.browser.NavigationController; import org.chromium.content_public.browser.WebContents; /** @@ -78,6 +85,10 @@ @Mock public TabModelSelectorImpl tabModelSelector; @Mock public TabModel tabModel; @Mock public CustomTabNavigationEventObserver navigationEventObserver; + @Mock public CloseButtonNavigator closeButtonNavigator; + @Mock public ToolbarManager toolbarManager; + @Mock public ChromeBrowserInitializer browserInitializer; + @Mock public ChromeFullscreenManager fullscreenManager; public final CustomTabActivityTabProvider tabProvider = new CustomTabActivityTabProvider(); @Captor public ArgumentCaptor<ActivityTabObserver> activityTabObserverCaptor; @@ -90,7 +101,7 @@ @Override protected void starting(Description description) { RecordHistogram.setDisabledForTests(true); - + RecordUserAction.setDisabledForTests(true); MockitoAnnotations.initMocks(this); tabFromFactory = prepareTab(); @@ -102,6 +113,7 @@ when(tabFactory.getTabModelSelector()).thenReturn(tabModelSelector); when(tabModelSelector.getModel(anyBoolean())).thenReturn(tabModel); when(connection.getSpeculatedUrl(any())).thenReturn(SPECULATED_URL); + when(browserInitializer.hasNativeInitializationCompleted()).thenReturn(true); doNothing().when(activityTabProvider).addObserverAndTrigger( activityTabObserverCaptor.capture()); @@ -113,7 +125,9 @@ @Override protected void finished(Description description) { RecordHistogram.setDisabledForTests(false); + RecordUserAction.setDisabledForTests(false); AsyncTabParamsManager.getAsyncTabParams().clear(); + ShadowExternalNavigationDelegateImpl.setWillChromeHandleIntent(false); } public CustomTabActivityTabController createTabController() { @@ -127,9 +141,12 @@ () -> customTabObserver, webContentsFactory, navigationEventObserver, tabProvider); } - public CustomTabActivityNavigationController createNavigationController() { - return new CustomTabActivityNavigationController(tabProvider, - intentDataProvider, connection, () -> customTabObserver); + public CustomTabActivityNavigationController createNavigationController( + CustomTabActivityTabController tabController) { + return new CustomTabActivityNavigationController(tabController, tabProvider, + intentDataProvider, connection, () -> customTabObserver, closeButtonNavigator, + () -> toolbarManager, browserInitializer, activity, lifecycleDispatcher, + () -> fullscreenManager); } public CustomTabActivityInitialPageLoader createInitialPageLoader( @@ -191,6 +208,10 @@ Tab tab = mock(Tab.class); when(tab.getView()).thenReturn(mock(View.class)); when(tab.getUserDataHost()).thenReturn(new UserDataHost()); + WebContents webContents = mock(WebContents.class); + when(tab.getWebContents()).thenReturn(webContents); + NavigationController navigationController = mock(NavigationController.class); + when(webContents.getNavigationController()).thenReturn(navigationController); return tab; } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationControllerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationControllerTest.java new file mode 100644 index 0000000..272af9ed --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityNavigationControllerTest.java
@@ -0,0 +1,156 @@ +// 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. + +package org.chromium.chrome.browser.customtabs.content; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.mockito.stubbing.Answer; +import org.robolectric.annotation.Config; + +import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.BackHandler; +import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishHandler; +import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason; +import org.chromium.chrome.browser.customtabs.shadows.ShadowExternalNavigationDelegateImpl; +import org.chromium.chrome.browser.customtabs.shadows.ShadowPostTask; +import org.chromium.chrome.browser.tab.Tab; +import org.chromium.testing.local.LocalRobolectricTestRunner; + +/** + * Unit tests for {@link CustomTabActivityNavigationController}. + * + * {@link CustomTabActivityNavigationController#navigate} is tested in integration with other + * classes in {@link CustomTabActivityUrlLoadingTest}. + */ +@RunWith(LocalRobolectricTestRunner.class) +@Config(manifest = Config.NONE, shadows = { + ShadowExternalNavigationDelegateImpl.class, ShadowPostTask.class}) +public class CustomTabActivityNavigationControllerTest { + + @Rule + public final CustomTabActivityContentTestEnvironment env = + new CustomTabActivityContentTestEnvironment(); + + private CustomTabActivityNavigationController mNavigationController; + + @Mock CustomTabActivityTabController mTabController; + @Mock FinishHandler mFinishHandler; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mNavigationController = env.createNavigationController(mTabController); + mNavigationController.setFinishHandler(mFinishHandler); + Tab tab = env.prepareTab(); + when(tab.getUrl()).thenReturn(""); // avoid DomDistillerUrlUtils going to native. + env.tabProvider.setInitialTab(tab, TabCreationMode.DEFAULT); + } + + @Test + public void doesntFinish_IfCloseButtonNavigatorHandlesClose() { + when(env.closeButtonNavigator.navigateOnClose(any())).thenReturn(true); + mNavigationController.navigateOnClose(); + verify(mFinishHandler, never()).onFinish(anyInt()); + } + + @Test + public void closesTab_IfCloseButtonNavigatorDoesntHandleClose() { + when(env.closeButtonNavigator.navigateOnClose(any())).thenReturn(false); + mNavigationController.navigateOnClose(); + verify(mFinishHandler).onFinish(eq(FinishReason.USER_NAVIGATION)); + } + + @Test + public void handlesBackNavigation_IfExternalBackHandlerRejectsSynchronously() { + mNavigationController.setBackHandler(notHandledRunnable -> false); + mNavigationController.navigateOnBack(); + verify(mTabController).closeTab(); + } + + @Test + public void handlesBackNavigation_IfExternalBackHandlerRejectsAsynchronously() { + ArgumentCaptor<Runnable> notHandledRunnableCaptor = ArgumentCaptor.forClass(Runnable.class); + BackHandler backHandler = mock(BackHandler.class); + doReturn(true).when(backHandler).handleBackPressed(notHandledRunnableCaptor.capture()); + mNavigationController.setBackHandler(backHandler); + mNavigationController.navigateOnBack(); + notHandledRunnableCaptor.getValue().run(); + verify(mTabController).closeTab(); + } + + @Test + public void doesntHandlesBackNavigation_IfExternalBackHandlerAccepts() { + mNavigationController.setBackHandler(notHandledRunnable -> true); + mNavigationController.navigateOnBack(); + verify(mTabController, never()).closeTab(); + } + + @Test + public void finishes_IfBackNavigationClosesTheOnlyTab() { + doAnswer((Answer<Void>) invocation -> { + env.tabProvider.swapTab(null); + return null; + }).when(mTabController).closeTab(); + + mNavigationController.navigateOnBack(); + verify(mFinishHandler).onFinish(eq(FinishReason.USER_NAVIGATION)); + } + + @Test + public void doesntFinish_IfBackNavigationReplacesTabWithPreviousOne() { + doAnswer((Answer<Void>) invocation -> { + env.tabProvider.swapTab(env.prepareTab()); + return null; + }).when(mTabController).closeTab(); + + mNavigationController.navigateOnBack(); + verify(mFinishHandler, never()).onFinish(anyInt()); + } + + @Test + public void startsReparenting_WhenOpenInBrowserCalled_AndChromeCanHandleIntent() { + ShadowExternalNavigationDelegateImpl.setWillChromeHandleIntent(true); + mNavigationController.openCurrentUrlInBrowser(false); + verify(env.activity, never()).startActivity(any()); + verify(mTabController).detachAndStartReparenting(any(), any(), any()); + } + + @Test + public void finishes_whenDoneReparenting() { + ShadowExternalNavigationDelegateImpl.setWillChromeHandleIntent(true); + ArgumentCaptor<Runnable> captor = ArgumentCaptor.forClass(Runnable.class); + doNothing().when(mTabController).detachAndStartReparenting(any(), any(), + captor.capture()); + + mNavigationController.openCurrentUrlInBrowser(false); + + verify(mFinishHandler, never()).onFinish(anyInt()); + captor.getValue().run(); + verify(mFinishHandler).onFinish(FinishReason.REPARENTING); + } + + @Test + public void startsNewActivity_WhenOpenInBrowserCalled_AndChromeCanNotHandleIntent() { + ShadowExternalNavigationDelegateImpl.setWillChromeHandleIntent(false); + mNavigationController.openCurrentUrlInBrowser(false); + verify(mTabController, never()).detachAndStartReparenting(any(), any(), any()); + verify(env.activity).startActivity(any(), any()); + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityUrlLoadingTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityUrlLoadingTest.java index a57b60ea..e2c5cc44 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityUrlLoadingTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/content/CustomTabActivityUrlLoadingTest.java
@@ -49,7 +49,7 @@ @Before public void setUp() { mTabController = env.createTabController(); - mNavigationController = env.createNavigationController(); + mNavigationController = env.createNavigationController(mTabController); mInitialPageLoader = env.createInitialPageLoader(mNavigationController); }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowExternalNavigationDelegateImpl.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowExternalNavigationDelegateImpl.java new file mode 100644 index 0000000..f9baf20 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowExternalNavigationDelegateImpl.java
@@ -0,0 +1,28 @@ +// 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. + +package org.chromium.chrome.browser.customtabs.shadows; + +import android.content.Intent; + +import org.robolectric.annotation.Implementation; +import org.robolectric.annotation.Implements; + +import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl; + +/** Shadow implementation of ExternalNavigationDelegateImpl. */ +@Implements(ExternalNavigationDelegateImpl.class) +public class ShadowExternalNavigationDelegateImpl { + + private static boolean sWillChromeHandleIntent; + + public static void setWillChromeHandleIntent(boolean value) { + sWillChromeHandleIntent = value; + } + + @Implementation + public static boolean willChromeHandleIntent(Intent intent, boolean matchDefaultOnly) { + return sWillChromeHandleIntent; + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowPostTask.java b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowPostTask.java new file mode 100644 index 0000000..dbc8bee --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/customtabs/shadows/ShadowPostTask.java
@@ -0,0 +1,23 @@ +// 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. + +package org.chromium.chrome.browser.customtabs.shadows; + +import org.robolectric.annotation.Implementation; +import org.robolectric.annotation.Implements; + +import org.chromium.base.task.PostTask; +import org.chromium.base.task.TaskTraits; + +/** + * TODO(pshmakov): make a more elaborate shadow, or perhaps a non-static wrapper for PostTask + * to be injected. + */ +@Implements(PostTask.class) +public class ShadowPostTask { + + @Implementation + public static void postDelayedTask(TaskTraits taskTraits, Runnable task, long delay) { + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java new file mode 100644 index 0000000..6c05999 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerBackgroundTaskTest.java
@@ -0,0 +1,244 @@ +// 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. + +package org.chromium.chrome.browser.notifications; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +import android.os.Bundle; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +import org.chromium.base.SysUtils; +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.chrome.browser.background_task_scheduler.NativeBackgroundTask; +import org.chromium.components.background_task_scheduler.BackgroundTask; +import org.chromium.components.background_task_scheduler.BackgroundTaskScheduler; +import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory; +import org.chromium.components.background_task_scheduler.TaskIds; +import org.chromium.components.background_task_scheduler.TaskInfo; +import org.chromium.components.background_task_scheduler.TaskParameters; + +/** + * Unit tests for NotificationTriggerBackgroundTask. + */ +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class NotificationTriggerBackgroundTaskTest { + @Mock + private BackgroundTaskScheduler mTaskScheduler; + @Mock + private NotificationTriggerScheduler mTriggerScheduler; + @Mock + private BackgroundTask.TaskFinishedCallback mTaskFinishedCallback; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); + NotificationTriggerScheduler.setInstanceForTests(mTriggerScheduler); + } + + @After + public void tearDown() throws Exception { + SysUtils.resetForTesting(); + } + + private static TaskParameters createTaskParameters(long timestamp) { + Bundle extras = new Bundle(); + extras.putLong(NotificationTriggerBackgroundTask.KEY_TIMESTAMP, timestamp); + return TaskParameters.create(TaskIds.NOTIFICATION_TRIGGER_JOB_ID).addExtras(extras).build(); + } + + @Test + public void testScheduleInitializesOneOffTask() { + long delay = 1000; + long timestamp = System.currentTimeMillis() + delay; + ArgumentCaptor<TaskInfo> taskInfoCaptor = ArgumentCaptor.forClass(TaskInfo.class); + NotificationTriggerBackgroundTask.schedule(timestamp, delay); + verify(mTaskScheduler).schedule(any(), taskInfoCaptor.capture()); + TaskInfo taskInfo = taskInfoCaptor.getValue(); + + assertEquals(TaskIds.NOTIFICATION_TRIGGER_JOB_ID, taskInfo.getTaskId()); + assertEquals(NotificationTriggerBackgroundTask.class, taskInfo.getBackgroundTaskClass()); + assertTrue(taskInfo.isPersisted()); + assertFalse(taskInfo.isPeriodic()); + assertTrue(taskInfo.shouldUpdateCurrent()); + assertEquals(TaskInfo.NetworkType.NONE, taskInfo.getRequiredNetworkType()); + assertEquals(delay, taskInfo.getOneOffInfo().getWindowStartTimeMs()); + assertEquals(delay, taskInfo.getOneOffInfo().getWindowEndTimeMs()); + assertEquals(timestamp, + taskInfo.getExtras().getLong(NotificationTriggerBackgroundTask.KEY_TIMESTAMP)); + } + + @Test + public void testCancelCancelsTask() { + NotificationTriggerBackgroundTask.cancel(); + verify(mTaskScheduler).cancel(any(), eq(TaskIds.NOTIFICATION_TRIGGER_JOB_ID)); + } + + @Test + public void testRescheduleCallsScheduler() { + new NotificationTriggerBackgroundTask().reschedule(RuntimeEnvironment.application); + verify(mTriggerScheduler).reschedule(); + } + + @Test + public void testStartBeforeNative_ValidTrigger() { + long timestamp = System.currentTimeMillis() + 1000; + doReturn(true).when(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + + int result = new NotificationTriggerBackgroundTask().onStartTaskBeforeNativeLoaded( + RuntimeEnvironment.application, createTaskParameters(timestamp), + mTaskFinishedCallback); + + assertEquals(NativeBackgroundTask.StartBeforeNativeResult.LOAD_NATIVE, result); + verify(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + verify(mTaskFinishedCallback, never()).taskFinished(anyBoolean()); + } + + @Test + public void testStartBeforeNative_InvalidTrigger() { + long timestamp = System.currentTimeMillis() + 1000; + doReturn(false).when(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + + int result = new NotificationTriggerBackgroundTask().onStartTaskBeforeNativeLoaded( + RuntimeEnvironment.application, createTaskParameters(timestamp), + mTaskFinishedCallback); + + assertEquals(NativeBackgroundTask.StartBeforeNativeResult.DONE, result); + verify(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + verify(mTaskFinishedCallback, never()).taskFinished(anyBoolean()); + } + + @Test + public void testStartWithNativeCallsTriggerNotifications() { + long timestamp = System.currentTimeMillis() + 1000; + new NotificationTriggerBackgroundTask().onStartTaskWithNative( + RuntimeEnvironment.application, createTaskParameters(timestamp), + mTaskFinishedCallback); + + verify(mTriggerScheduler).triggerNotifications(); + verify(mTaskFinishedCallback).taskFinished(eq(false)); + } + + @Test + public void testReschedule_BeforeNative() { + long timestamp = System.currentTimeMillis() + 1000; + boolean shouldReschedule = + new NotificationTriggerBackgroundTask().onStopTaskBeforeNativeLoaded( + RuntimeEnvironment.application, createTaskParameters(timestamp)); + assertTrue(shouldReschedule); + } + + @Test + public void testReschedule_WithNative() { + long timestamp = System.currentTimeMillis() + 1000; + boolean shouldReschedule = new NotificationTriggerBackgroundTask().onStopTaskWithNative( + RuntimeEnvironment.application, createTaskParameters(timestamp)); + assertTrue(shouldReschedule); + } + + @Test + public void testReschedule_AfterTriggerBeforeNative() { + long timestamp = System.currentTimeMillis() + 1000; + + NotificationTriggerBackgroundTask task = new NotificationTriggerBackgroundTask(); + TaskParameters params = createTaskParameters(timestamp); + task.onStartTaskWithNative(RuntimeEnvironment.application, params, mTaskFinishedCallback); + boolean shouldReschedule = + task.onStopTaskBeforeNativeLoaded(RuntimeEnvironment.application, params); + + assertFalse(shouldReschedule); + } + + @Test + public void testReschedule_AfterTriggerWithNative() { + long timestamp = System.currentTimeMillis() + 1000; + + NotificationTriggerBackgroundTask task = new NotificationTriggerBackgroundTask(); + TaskParameters params = createTaskParameters(timestamp); + task.onStartTaskWithNative(RuntimeEnvironment.application, params, mTaskFinishedCallback); + boolean shouldReschedule = + task.onStopTaskWithNative(RuntimeEnvironment.application, params); + + assertFalse(shouldReschedule); + } + + @Test + public void testReschedule_ValidTriggerBeforeNative() { + long timestamp = System.currentTimeMillis() + 1000; + doReturn(true).when(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + + NotificationTriggerBackgroundTask task = new NotificationTriggerBackgroundTask(); + TaskParameters params = createTaskParameters(timestamp); + task.onStartTaskBeforeNativeLoaded( + RuntimeEnvironment.application, params, mTaskFinishedCallback); + boolean shouldReschedule = + task.onStopTaskBeforeNativeLoaded(RuntimeEnvironment.application, params); + + assertTrue(shouldReschedule); + } + + @Test + public void testReschedule_ValidTriggerWithNative() { + long timestamp = System.currentTimeMillis() + 1000; + doReturn(true).when(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + + NotificationTriggerBackgroundTask task = new NotificationTriggerBackgroundTask(); + TaskParameters params = createTaskParameters(timestamp); + task.onStartTaskBeforeNativeLoaded( + RuntimeEnvironment.application, params, mTaskFinishedCallback); + boolean shouldReschedule = + task.onStopTaskWithNative(RuntimeEnvironment.application, params); + + assertTrue(shouldReschedule); + } + + @Test + public void testReschedule_InvalidTriggerBeforeNative() { + long timestamp = System.currentTimeMillis() + 1000; + doReturn(false).when(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + + NotificationTriggerBackgroundTask task = new NotificationTriggerBackgroundTask(); + TaskParameters params = createTaskParameters(timestamp); + task.onStartTaskBeforeNativeLoaded( + RuntimeEnvironment.application, params, mTaskFinishedCallback); + boolean shouldReschedule = + task.onStopTaskBeforeNativeLoaded(RuntimeEnvironment.application, params); + + assertFalse(shouldReschedule); + } + + @Test + public void testReschedule_InvalidTriggerWithNative() { + long timestamp = System.currentTimeMillis() + 1000; + doReturn(false).when(mTriggerScheduler).checkAndResetTrigger(eq(timestamp)); + + NotificationTriggerBackgroundTask task = new NotificationTriggerBackgroundTask(); + TaskParameters params = createTaskParameters(timestamp); + task.onStartTaskBeforeNativeLoaded( + RuntimeEnvironment.application, params, mTaskFinishedCallback); + boolean shouldReschedule = + task.onStopTaskWithNative(RuntimeEnvironment.application, params); + + assertFalse(shouldReschedule); + } +}
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java new file mode 100644 index 0000000..6a72337 --- /dev/null +++ b/chrome/android/junit/src/org/chromium/chrome/browser/notifications/NotificationTriggerSchedulerTest.java
@@ -0,0 +1,174 @@ +// 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. + +package org.chromium.chrome.browser.notifications; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.robolectric.annotation.Config; + +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.JniMocker; +import org.chromium.components.background_task_scheduler.BackgroundTaskScheduler; +import org.chromium.components.background_task_scheduler.BackgroundTaskSchedulerFactory; +import org.chromium.components.background_task_scheduler.TaskInfo; + +import java.util.List; + +/** + * Unit tests for NotificationTriggerScheduler. + */ +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +public class NotificationTriggerSchedulerTest { + @Rule + public JniMocker mocker = new JniMocker(); + + @Mock + private NotificationTriggerScheduler.Natives mNativeMock; + @Mock + private BackgroundTaskScheduler mTaskScheduler; + @Captor + private ArgumentCaptor<TaskInfo> mTaskInfoCaptor; + + private NotificationTriggerScheduler.Clock mClock; + + private NotificationTriggerScheduler mTriggerScheduler; + + @Before + public void setUp() throws Exception { + MockitoAnnotations.initMocks(this); + BackgroundTaskSchedulerFactory.setSchedulerForTesting(mTaskScheduler); + mocker.mock(NotificationTriggerSchedulerJni.TEST_HOOKS, mNativeMock); + doReturn(true).when(mTaskScheduler).schedule(any(), mTaskInfoCaptor.capture()); + + mClock = () -> 1415926535; + mTriggerScheduler = new NotificationTriggerScheduler(mClock); + } + + private static long getTimestamp(TaskInfo taskInfo) { + final String key = NotificationTriggerBackgroundTask.KEY_TIMESTAMP; + return taskInfo.getExtras().getLong(key); + } + + private static long getScheduledDelay(TaskInfo taskInfo) { + return taskInfo.getOneOffInfo().getWindowEndTimeMs(); + } + + @Test + public void testSchedule_OnceInFuture() { + long timestamp = mClock.currentTimeMillis() + 1000; + + mTriggerScheduler.schedule(timestamp); + + List<TaskInfo> taskInfos = mTaskInfoCaptor.getAllValues(); + assertEquals(1, taskInfos.size()); + assertEquals(timestamp, getTimestamp(taskInfos.get(0))); + assertEquals(1000, getScheduledDelay(taskInfos.get(0))); + } + + @Test + public void testSchedule_OnceInPast() { + long timestamp = mClock.currentTimeMillis() - 1000; + + mTriggerScheduler.schedule(timestamp); + + List<TaskInfo> taskInfos = mTaskInfoCaptor.getAllValues(); + assertEquals(1, taskInfos.size()); + assertEquals(timestamp, getTimestamp(taskInfos.get(0))); + assertEquals(0, getScheduledDelay(taskInfos.get(0))); + } + + @Test + public void testSchedule_MultipleTimes() { + long now = mClock.currentTimeMillis(); + + // Only the first and fourth should schedule a new trigger as the others are ahead of the + // currently scheduled trigger timestamp. + long[] timestamps = {now + 10000, now + 10000, now + 20000, now + 5000, now + 7000}; + + for (long timestamp : timestamps) { + mTriggerScheduler.schedule(timestamp); + } + + List<TaskInfo> taskInfos = mTaskInfoCaptor.getAllValues(); + assertEquals(2, taskInfos.size()); + assertEquals(timestamps[0], getTimestamp(taskInfos.get(0))); + assertEquals(timestamps[3], getTimestamp(taskInfos.get(1))); + } + + @Test + public void testSchedule_ExistingTriggerInPast() { + long past = mClock.currentTimeMillis() - 10000; + long future = mClock.currentTimeMillis() + 10000; + + mTriggerScheduler.schedule(past); + mTriggerScheduler.schedule(future); + + List<TaskInfo> taskInfos = mTaskInfoCaptor.getAllValues(); + assertEquals(2, taskInfos.size()); + assertEquals(past, getTimestamp(taskInfos.get(0))); + // The first trigger has not been executed yet, scheduling it again. + assertEquals(past, getTimestamp(taskInfos.get(1))); + } + + @Test + public void testCheckAndResetTrigger_WrongTimestamp() { + long timestamp = mClock.currentTimeMillis() + 10000; + + mTriggerScheduler.schedule(timestamp); + + assertFalse(mTriggerScheduler.checkAndResetTrigger(timestamp + 1)); + } + + @Test + public void testCheckAndResetTrigger_CorrectTimestamp() { + long timestamp = mClock.currentTimeMillis() + 10000; + + mTriggerScheduler.schedule(timestamp); + + assertTrue(mTriggerScheduler.checkAndResetTrigger(timestamp)); + } + + @Test + public void testCheckAndResetTrigger_CorrectTimestampTwice() { + long timestamp = mClock.currentTimeMillis() + 10000; + + mTriggerScheduler.schedule(timestamp); + mTriggerScheduler.checkAndResetTrigger(timestamp); + + assertFalse(mTriggerScheduler.checkAndResetTrigger(timestamp)); + } + + @Test + public void testTriggerNotifications_CallsNative() { + mTriggerScheduler.triggerNotifications(); + verify(mNativeMock).triggerNotifications(); + } + + @Test + public void testReschedule() { + long timestamp = + mClock.currentTimeMillis() + NotificationTriggerScheduler.RESCHEDULE_DELAY_TIME; + + mTriggerScheduler.reschedule(); + + List<TaskInfo> taskInfos = mTaskInfoCaptor.getAllValues(); + assertEquals(1, taskInfos.size()); + assertEquals(timestamp, getTimestamp(taskInfos.get(0))); + } +}
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index f5b7931e..9fe6a0a 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-75.0.3753.0_rc-r1-merged.afdo.bz2 \ No newline at end of file +chromeos-chrome-amd64-75.0.3754.0_rc-r1-merged.afdo.bz2 \ No newline at end of file
diff --git a/chrome/android/touchless/fallback/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java b/chrome/android/touchless/fallback/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java deleted file mode 100644 index 7ff99ca..0000000 --- a/chrome/android/touchless/fallback/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java +++ /dev/null
@@ -1,10 +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. - -package org.chromium.chrome.browser.touchless; - -/** - * The fallback version of TouchlessUiController, when touchless mode isn't enabled. - */ -public class TouchlessUiController {}
diff --git a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java index 17bf0b1..d1162d8 100644 --- a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java +++ b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/NoTouchActivity.java
@@ -274,4 +274,11 @@ mUiController = null; } } + + /** + * @return A UI controller implementation. + */ + public TouchlessUiController getTouchlessUiController() { + return mUiController; + } }
diff --git a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java index bfb42b49..e16785b 100644 --- a/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java +++ b/chrome/android/touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java
@@ -6,9 +6,23 @@ import android.view.KeyEvent; +import org.chromium.ui.modelutil.PropertyModel; + /** A controller for touchless UI. */ public interface TouchlessUiController { /** + * Add a model to the queue to be shown. + * @param model The model to add. + */ + default void addModelToQueue(PropertyModel model) {} + + /** + * Remove a model from the queue to be shown. + * @param model The model to remove. + */ + default void removeModelFromQueue(PropertyModel model) {} + + /** * A notification that a key event occurred. * @param event The event object. * @return Whether the event was consumed.
diff --git a/chrome/android/touchless/touchless_java_sources.gni b/chrome/android/touchless/touchless_java_sources.gni index f92ac7e7..03b9813 100644 --- a/chrome/android/touchless/touchless_java_sources.gni +++ b/chrome/android/touchless/touchless_java_sources.gni
@@ -48,6 +48,6 @@ touchess_fallback_java_sources = [ "touchless/fallback/java/src/org/chromium/chrome/browser/touchless/TouchlessDelegate.java", - "touchless/fallback/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java", + "touchless/java/src/org/chromium/chrome/browser/touchless/TouchlessUiController.java", "touchless/java/src/org/chromium/chrome/browser/touchless/dialog/TouchlessDialogProperties.java", ]
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 4d895688..772fb81f 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -3823,6 +3823,9 @@ <message name="IDS_PLUGIN_VM_LAUNCHER_UNZIPPING_MESSAGE" desc="Description of the current state of PluginVm environment setting." translateable="false"> Configuring <ph name="APP_NAME">PluginVm</ph> image... </message> + <message name="IDS_PLUGIN_VM_LAUNCHER_REGISTERING_MESSAGE" desc="Description of the current state of PluginVm environment setting." translateable="false"> + Putting on final touches... + </message> <message name="IDS_PLUGIN_VM_LAUNCHER_FINISHED_MESSAGE" desc="Description of the current state of PluginVm environment setting." translateable="false"> Set up was successfully completed. Click on the launch button to start using <ph name="APP_NAME">PluginVm</ph>. </message>
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 14f3310..bfeb566 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -8006,6 +8006,12 @@ <message name="IDS_TURNED_OFF" desc="Description text for the state of camera or microphone"> Turned off </message> + <message name="IDS_CAMERA_TURNED_OFF" desc="Description text in the omnibox icon showing when camera permission is turned off."> + Camera turned off + </message> + <message name="IDS_MIC_TURNED_OFF" desc="Decription text in the omnibox icon showing when microphone permission is turned off."> + Microphone turned off + </message> </if> <!-- Protected media identifier permission infobar -->
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 9cac854b..66f315c 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2567,6 +2567,8 @@ "autofill/android/personal_data_manager_android.cc", "autofill/android/personal_data_manager_android.h", "autofill/android/phone_number_util_android.cc", + "autofill/autofill_keyboard_accessory_adapter.cc", + "autofill/autofill_keyboard_accessory_adapter.h", "autofill/manual_filling_controller.h", "autofill/manual_filling_controller_impl.cc", "autofill/manual_filling_controller_impl.h", @@ -2630,6 +2632,8 @@ "notifications/notification_background_task_scheduler_android.h", "notifications/notification_platform_bridge_android.cc", "notifications/notification_platform_bridge_android.h", + "notifications/notification_trigger_scheduler_android.cc", + "notifications/notification_trigger_scheduler_android.h", "page_load_metrics/observers/android_page_load_metrics_observer.cc", "page_load_metrics/observers/android_page_load_metrics_observer.h", "password_manager/account_chooser_dialog_android.cc", @@ -5127,6 +5131,8 @@ visibility = [ "//chrome/test:test_support" ] sources = [ + "autofill/mock_autofill_popup_controller.cc", + "autofill/mock_autofill_popup_controller.h", "autofill/mock_manual_filling_controller.cc", "autofill/mock_manual_filling_controller.h", "browsing_data/mock_browsing_data_appcache_helper.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index c215353..7cea71f 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -1616,10 +1616,6 @@ SINGLE_VALUE_TYPE(switches::kHostedAppQuitNotification)}, #endif // OS_MACOSX #if defined(OS_ANDROID) - {"disable-pull-to-refresh-effect", - flag_descriptions::kPullToRefreshEffectName, - flag_descriptions::kPullToRefreshEffectDescription, kOsAndroid, - SINGLE_DISABLE_VALUE_TYPE(switches::kDisablePullToRefreshEffect)}, {"translate-force-trigger-on-english", flag_descriptions::kTranslateForceTriggerOnEnglishName, flag_descriptions::kTranslateForceTriggerOnEnglishDescription, kOsAndroid, @@ -2138,11 +2134,6 @@ FEATURE_WITH_PARAMS_VALUE_TYPE(ntp_snippets::kArticleSuggestionsFeature, kRemoteSuggestionsFeatureVariations, "NTPArticleSuggestions")}, - {"enable-ntp-offline-page-download-suggestions", - flag_descriptions::kEnableNtpOfflinePageDownloadSuggestionsName, - flag_descriptions::kEnableNtpOfflinePageDownloadSuggestionsDescription, - kOsAndroid, - FEATURE_VALUE_TYPE(features::kOfflinePageDownloadSuggestionsFeature)}, {"enable-ntp-suggestions-notifications", flag_descriptions::kEnableNtpSuggestionsNotificationsName, flag_descriptions::kEnableNtpSuggestionsNotificationsDescription, @@ -2228,6 +2219,10 @@ ENABLE_DISABLE_VALUE_TYPE( chromeos::switches::kEnableEncryptionMigration, chromeos::switches::kDisableEncryptionMigration)}, + {"enable-cros-ime-input-logic-fst", + flag_descriptions::kImeInputLogicFstName, + flag_descriptions::kImeInputLogicFstDescription, kOsCrOS, + FEATURE_VALUE_TYPE(chromeos::features::kImeInputLogicFst)}, {"enable-cros-ime-service", flag_descriptions::kImeServiceName, flag_descriptions::kImeServiceDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kImeServiceConnectable)}, @@ -2527,6 +2522,10 @@ {"crostini-usb-support", flag_descriptions::kCrostiniUsbSupportName, flag_descriptions::kCrostiniUsbSupportDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kCrostiniUsbSupport)}, + {"file-manager-feedback-panel", + flag_descriptions::kFileManagerFeedbackPanelName, + flag_descriptions::kFileManagerFeedbackPanelDescription, kOsCrOS, + FEATURE_VALUE_TYPE(chromeos::features::kEnableFileManagerFeedbackPanel)}, #endif // OS_CHROMEOS #if defined(OS_WIN) @@ -3410,10 +3409,6 @@ flag_descriptions::kEnableAutoplayIgnoreWebAudioDescription, kOsDesktop, FEATURE_VALUE_TYPE(media::kAutoplayIgnoreWebAudio)}, - {"upcoming-ui-features", flag_descriptions::kExperimentalUiName, - flag_descriptions::kExperimentalUiDescription, kOsAll, - FEATURE_VALUE_TYPE(features::kExperimentalUi)}, - #if defined(OS_ANDROID) {"cct-module", flag_descriptions::kCCTModuleName, flag_descriptions::kCCTModuleDescription, kOsAndroid,
diff --git a/chrome/browser/android/chrome_feature_list.cc b/chrome/browser/android/chrome_feature_list.cc index 68952c3..5cc36ca 100644 --- a/chrome/browser/android/chrome_feature_list.cc +++ b/chrome/browser/android/chrome_feature_list.cc
@@ -71,7 +71,6 @@ &features::kClipboardContentSetting, &features::kDownloadsLocationChange, &features::kExperimentalAppBanners, - &features::kExperimentalUi, &features::kIncognitoStrings, &features::kOverscrollHistoryNavigation, &features::kPermissionDelegation,
diff --git a/chrome/browser/autofill/autofill_keyboard_accessory_adapter.cc b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.cc new file mode 100644 index 0000000..216e03f --- /dev/null +++ b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.cc
@@ -0,0 +1,226 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/autofill/autofill_keyboard_accessory_adapter.h" + +#include <numeric> +#include <vector> + +#include "base/bind.h" +#include "base/callback.h" +#include "base/memory/weak_ptr.h" +#include "chrome/browser/ui/autofill/autofill_popup_controller.h" +#include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" +#include "components/autofill/core/browser/popup_item_ids.h" +#include "components/autofill/core/browser/suggestion.h" + +namespace autofill { + +AutofillKeyboardAccessoryAdapter::AutofillKeyboardAccessoryAdapter( + AutofillPopupController* controller, + unsigned int animation_duration_millis, + bool should_limit_label_width) + : controller_(controller), + animation_duration_millis_(animation_duration_millis), + should_limit_label_width_(should_limit_label_width), + weak_ptr_factory_(this) {} + +AutofillKeyboardAccessoryAdapter::~AutofillKeyboardAccessoryAdapter() = default; + +// AutofillPopupView implementation. + +void AutofillKeyboardAccessoryAdapter::Show() { + DCHECK(view_) << "Show called before a View was set!"; + view_->Initialize(animation_duration_millis_, should_limit_label_width_); + OnSuggestionsChanged(); +} + +void AutofillKeyboardAccessoryAdapter::Hide() { + DCHECK(view_) << "Hide called before a View was set!"; + view_->Hide(); +} + +void AutofillKeyboardAccessoryAdapter::OnSelectedRowChanged( + base::Optional<int> previous_row_selection, + base::Optional<int> current_row_selection) {} + +void AutofillKeyboardAccessoryAdapter::OnSuggestionsChanged() { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + DCHECK(view_) << "OnSuggestionsChanged called before a View was set!"; + + front_element_ = base::nullopt; + for (int i = 0; i < GetLineCount(); ++i) { + const Suggestion& suggestion = controller_->GetSuggestionAt(i); + if (suggestion.frontend_id != POPUP_ITEM_ID_CLEAR_FORM && + suggestion.frontend_id != POPUP_ITEM_ID_CREATE_HINT) + continue; + DCHECK(!front_element_.has_value()) << "Additional front item at: " << i; + front_element_ = base::Optional<int>(i); + } + + view_->Show(); +} + +// AutofillPopupController implementation. + +void AutofillKeyboardAccessoryAdapter::AcceptSuggestion(int index) { + if (controller_) + controller_->AcceptSuggestion(OffsetIndexFor(index)); +} + +int AutofillKeyboardAccessoryAdapter::GetLineCount() const { + return controller_ ? controller_->GetLineCount() : 0; +} + +const autofill::Suggestion& AutofillKeyboardAccessoryAdapter::GetSuggestionAt( + int row) const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + return controller_->GetSuggestionAt(OffsetIndexFor(row)); +} + +const base::string16& AutofillKeyboardAccessoryAdapter::GetElidedValueAt( + int row) const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + return controller_->GetElidedValueAt(OffsetIndexFor(row)); +} + +const base::string16& AutofillKeyboardAccessoryAdapter::GetElidedLabelAt( + int row) const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + const base::string16& label = + controller_->GetElidedLabelAt(OffsetIndexFor(row)); + if (label.empty()) + return GetSuggestionAt(row).additional_label; + return label; +} + +bool AutofillKeyboardAccessoryAdapter::GetRemovalConfirmationText( + int index, + base::string16* title, + base::string16* body) { + return controller_ && controller_->GetRemovalConfirmationText( + OffsetIndexFor(index), title, body); +} + +bool AutofillKeyboardAccessoryAdapter::RemoveSuggestion(int index) { + DCHECK(view_) << "RemoveSuggestion called before a View was set!"; + base::string16 title, body; + if (!GetRemovalConfirmationText(index, &title, &body)) + return false; + + view_->ConfirmDeletion( + title, body, + base::BindOnce(&AutofillKeyboardAccessoryAdapter::OnDeletionConfirmed, + weak_ptr_factory_.GetWeakPtr(), index)); + return true; +} + +ui::NativeTheme::ColorId +AutofillKeyboardAccessoryAdapter::GetBackgroundColorIDForRow(int index) const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + return controller_->GetBackgroundColorIDForRow(OffsetIndexFor(index)); +} + +void AutofillKeyboardAccessoryAdapter::SetSelectedLine( + base::Optional<int> selected_line) { + if (!controller_) + return; + if (!selected_line.has_value()) { + controller_->SetSelectedLine(base::nullopt); + return; + } + controller_->SetSelectedLine(OffsetIndexFor(selected_line.value())); +} + +base::Optional<int> AutofillKeyboardAccessoryAdapter::selected_line() const { + if (!controller_ || !controller_->selected_line().has_value()) + return base::nullopt; + for (int i = 0; i < GetLineCount(); ++i) { + if (OffsetIndexFor(i) == controller_->selected_line().value()) { + return i; + } + } + return base::nullopt; +} + +const AutofillPopupLayoutModel& AutofillKeyboardAccessoryAdapter::layout_model() + const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + return controller_->layout_model(); +} + +// AutofillPopupViewDelegate implementation + +void AutofillKeyboardAccessoryAdapter::ViewDestroyed() { + if (controller_) + controller_->ViewDestroyed(); + + view_.reset(); +} + +void AutofillKeyboardAccessoryAdapter::SetSelectionAtPoint( + const gfx::Point& point) { + if (controller_) + controller_->SetSelectionAtPoint(point); +} + +bool AutofillKeyboardAccessoryAdapter::AcceptSelectedLine() { + return controller_ && controller_->AcceptSelectedLine(); +} + +void AutofillKeyboardAccessoryAdapter::SelectionCleared() { + if (controller_) + controller_->SelectionCleared(); +} + +bool AutofillKeyboardAccessoryAdapter::HasSelection() const { + return controller_ && controller_->HasSelection(); +} + +gfx::Rect AutofillKeyboardAccessoryAdapter::popup_bounds() const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + return controller_->popup_bounds(); +} + +gfx::NativeView AutofillKeyboardAccessoryAdapter::container_view() const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + return controller_->container_view(); +} + +const gfx::RectF& AutofillKeyboardAccessoryAdapter::element_bounds() const { + DCHECK(controller_) << "Call OnSuggestionsChanged only from its owner!"; + return controller_->element_bounds(); +} + +bool AutofillKeyboardAccessoryAdapter::IsRTL() const { + return controller_ && controller_->IsRTL(); +} + +const std::vector<autofill::Suggestion> +AutofillKeyboardAccessoryAdapter::GetSuggestions() { + if (!controller_) + return std::vector<autofill::Suggestion>(); + std::vector<autofill::Suggestion> suggestions = controller_->GetSuggestions(); + if (front_element_.has_value()) { + std::rotate(suggestions.begin(), + suggestions.begin() + front_element_.value(), + suggestions.begin() + front_element_.value() + 1); + } + return suggestions; +} + +void AutofillKeyboardAccessoryAdapter::OnDeletionConfirmed(int index) { + if (controller_) + controller_->RemoveSuggestion(OffsetIndexFor(index)); +} + +int AutofillKeyboardAccessoryAdapter::OffsetIndexFor(int element_index) const { + if (!front_element_.has_value()) + return element_index; + if (0 == element_index) + return front_element_.value(); + return element_index - (element_index <= front_element_.value() ? 1 : 0); +} + +} // namespace autofill
diff --git a/chrome/browser/autofill/autofill_keyboard_accessory_adapter.h b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.h new file mode 100644 index 0000000..bfa8b4b --- /dev/null +++ b/chrome/browser/autofill/autofill_keyboard_accessory_adapter.h
@@ -0,0 +1,121 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_ADAPTER_H_ +#define CHROME_BROWSER_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_ADAPTER_H_ + +#include <cstddef> +#include <memory> +#include <utility> +#include <vector> + +#include "base/callback_forward.h" +#include "build/build_config.h" +#include "chrome/browser/ui/autofill/autofill_popup_controller.h" +#include "chrome/browser/ui/autofill/autofill_popup_view.h" + +namespace autofill { + +// This adapter allows the AutofillPopupController to treat the keyboard +// accessory like any other implementation of AutofillPopupView. +// From the controller's perspective, this behaves like a real AutofillPopupView +// and for the view, it behaves like the real AutofillPopupController. +class AutofillKeyboardAccessoryAdapter : public AutofillPopupView, + public AutofillPopupController { + public: + AutofillKeyboardAccessoryAdapter(AutofillPopupController* controller, + unsigned int animation_duration_millis, + bool should_limit_label_width); + ~AutofillKeyboardAccessoryAdapter() override; + + // Interface describing the minimal capabilities for the native view. + class AccessoryView { + public: + virtual ~AccessoryView() = default; + + // Initializes the Java-side of this bridge. + virtual void Initialize(unsigned int animation_duration_millis, + bool should_limit_label_width) = 0; + + // Requests to dismiss this view. + virtual void Hide() = 0; + + // Requests to show this view with the data provided by the controller. + virtual void Show() = 0; + + // Ask to confirm a deletion. Triggers the callback upon confirmation. + virtual void ConfirmDeletion(const base::string16& confirmation_title, + const base::string16& confirmation_body, + base::OnceClosure confirm_deletion) = 0; + }; + + void SetAccessoryView(std::unique_ptr<AccessoryView> view) { + view_ = std::move(view); + } + + private: + // AutofillPopupView implementation. + void Show() override; + void Hide() override; + void OnSelectedRowChanged(base::Optional<int> previous_row_selection, + base::Optional<int> current_row_selection) override; + void OnSuggestionsChanged() override; + + // AutofillPopupController implementation. + // Hidden: void OnSuggestionsChanged() override; + void AcceptSuggestion(int index) override; + int GetLineCount() const override; + const autofill::Suggestion& GetSuggestionAt(int row) const override; + const base::string16& GetElidedValueAt(int row) const override; + const base::string16& GetElidedLabelAt(int row) const override; + bool GetRemovalConfirmationText(int index, + base::string16* title, + base::string16* body) override; + bool RemoveSuggestion(int index) override; + ui::NativeTheme::ColorId GetBackgroundColorIDForRow(int index) const override; + void SetSelectedLine(base::Optional<int> selected_line) override; + base::Optional<int> selected_line() const override; + const AutofillPopupLayoutModel& layout_model() const override; + + // AutofillPopupViewDelegate implementation + // Hidden: void Hide() override; + void ViewDestroyed() override; + void SetSelectionAtPoint(const gfx::Point& point) override; + bool AcceptSelectedLine() override; + void SelectionCleared() override; + bool HasSelection() const override; + gfx::Rect popup_bounds() const override; + gfx::NativeView container_view() const override; + const gfx::RectF& element_bounds() const override; + bool IsRTL() const override; + const std::vector<autofill::Suggestion> GetSuggestions() override; + + void OnDeletionConfirmed(int index); + + // Indices might be offset because a special item is moved to the front. This + // method returns the index used by the keyboard accessory (may be offset). + // |element_index| is the position of an element as returned by |controller_|. + int OffsetIndexFor(int element_index) const; + + AutofillPopupController* controller_; // weak. + std::unique_ptr<AutofillKeyboardAccessoryAdapter::AccessoryView> view_; + + // If 0, don't animate suggestion view. + const unsigned int animation_duration_millis_; + + // If true, limits label width to 1/2 device's width. + const bool should_limit_label_width_; + + // Position that the front element has in the suggestion list returned by + // controller_. It is used to determine the offset suggestions. + base::Optional<int> front_element_; + + base::WeakPtrFactory<AutofillKeyboardAccessoryAdapter> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(AutofillKeyboardAccessoryAdapter); +}; + +} // namespace autofill + +#endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_KEYBOARD_ACCESSORY_ADAPTER_H_
diff --git a/chrome/browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc b/chrome/browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc new file mode 100644 index 0000000..8b39e66 --- /dev/null +++ b/chrome/browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc
@@ -0,0 +1,229 @@ +// 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 <cstddef> + +#include <memory> +#include <utility> +#include <vector> + +#include "base/callback.h" +#include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" +#include "chrome/browser/autofill/autofill_keyboard_accessory_adapter.h" +#include "chrome/browser/autofill/mock_autofill_popup_controller.h" +#include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" +#include "chrome/browser/ui/autofill/autofill_popup_view.h" +#include "components/autofill/core/browser/popup_item_ids.h" +#include "components/autofill/core/browser/suggestion.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/geometry/rect_f.h" + +using base::ASCIIToUTF16; +using ::testing::_; +using ::testing::Invoke; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::StrictMock; +using ::testing::WithArg; + +namespace autofill { +namespace { + +class MockAccessoryView + : public AutofillKeyboardAccessoryAdapter::AccessoryView { + public: + MockAccessoryView() {} + MOCK_METHOD2(Initialize, void(unsigned int, bool)); + MOCK_METHOD0(Hide, void()); + MOCK_METHOD0(Show, void()); + MOCK_METHOD3(ConfirmDeletion, + void(const base::string16&, + const base::string16&, + base::OnceClosure)); + MOCK_METHOD1(SetTypesetter, void(gfx::Typesetter)); + MOCK_METHOD1(GetElidedValueWidthForRow, int(int)); + MOCK_METHOD1(GetElidedLabelWidthForRow, int(int)); + + private: + DISALLOW_COPY_AND_ASSIGN(MockAccessoryView); +}; + +std::vector<Suggestion> createSuggestions() { + std::vector<Suggestion> suggestions = { + Suggestion("*", "A", "", PopupItemId::POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY), + Suggestion("**", "", "", PopupItemId::POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY), + Suggestion("***", "C", "", + PopupItemId::POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY)}; + suggestions[1].additional_label = ASCIIToUTF16("B"); + return suggestions; +} + +std::vector<Suggestion> createSuggestions(int clearItemOffset) { + std::vector<Suggestion> suggestions = createSuggestions(); + suggestions.emplace( + suggestions.begin() + clearItemOffset, + Suggestion("Clear", "", "", PopupItemId::POPUP_ITEM_ID_CLEAR_FORM)); + return suggestions; +} + +// Matcher returning true if suggestions have equal members. +MATCHER_P(equalsSuggestion, other, "") { + if (arg.frontend_id != other.frontend_id) { + *result_listener << "has frontend_id " << arg.frontend_id; + return false; + } + if (arg.value != other.value) { + *result_listener << "has value " << arg.value; + return false; + } + if (arg.label != other.label) { + *result_listener << "has label " << arg.label; + return false; + } + if (arg.icon != other.icon) { + *result_listener << "has icon " << arg.icon; + return false; + } + return true; +} + +} // namespace + +// Automagically used to pretty-print Suggestion. Must be in same namespace. +void PrintTo(const Suggestion& suggestion, std::ostream* os) { + *os << "(value: \"" << suggestion.value << "\", label: \"" << suggestion.label + << "\", frontend_id: " << suggestion.frontend_id + << ", additional_label: \"" << suggestion.additional_label << "\")"; +} + +class AutofillKeyboardAccessoryAdapterTest : public testing::Test { + public: + AutofillKeyboardAccessoryAdapterTest() + : popup_controller_( + std::make_unique<StrictMock<MockAutofillPopupController>>()) { + auto view = std::make_unique<StrictMock<MockAccessoryView>>(); + accessory_view_ = view.get(); + + autofill_accessory_adapter_ = + std::make_unique<AutofillKeyboardAccessoryAdapter>(controller(), 0, + false); + autofill_accessory_adapter_->SetAccessoryView(std::move(view)); + } + + void NotifyAboutSuggestions() { + EXPECT_CALL(*view(), Show()); + + adapter_as_view()->OnSuggestionsChanged(); + + testing::Mock::VerifyAndClearExpectations(view()); + } + + const Suggestion& suggestion(int i) { + return controller()->GetSuggestionAt(i); + } + + AutofillPopupController* adapter_as_controller() { + return autofill_accessory_adapter_.get(); + } + + AutofillPopupView* adapter_as_view() { + return autofill_accessory_adapter_.get(); + } + + MockAutofillPopupController* controller() { return popup_controller_.get(); } + + MockAccessoryView* view() { return accessory_view_; } + + private: + StrictMock<MockAccessoryView>* accessory_view_; + std::unique_ptr<StrictMock<MockAutofillPopupController>> popup_controller_; + std::unique_ptr<AutofillKeyboardAccessoryAdapter> autofill_accessory_adapter_; +}; + +TEST_F(AutofillKeyboardAccessoryAdapterTest, ShowingInitializesAndUpdatesView) { + { + ::testing::Sequence s; + EXPECT_CALL(*view(), Initialize(_, _)); + EXPECT_CALL(*view(), Show()); + } + adapter_as_view()->Show(); +} + +TEST_F(AutofillKeyboardAccessoryAdapterTest, HidingAdapterHidesView) { + EXPECT_CALL(*view(), Hide()); + adapter_as_view()->Hide(); +} + +TEST_F(AutofillKeyboardAccessoryAdapterTest, ReorderUpdatedSuggestions) { + controller()->set_suggestions(createSuggestions(/*clearItemOffset=*/2)); + EXPECT_CALL(*view(), Show()); + + adapter_as_view()->OnSuggestionsChanged(); + + EXPECT_THAT(adapter_as_controller()->GetSuggestionAt(0), + equalsSuggestion(suggestion(2))); + EXPECT_THAT(adapter_as_controller()->GetSuggestionAt(1), + equalsSuggestion(suggestion(0))); + EXPECT_THAT(adapter_as_controller()->GetSuggestionAt(2), + equalsSuggestion(suggestion(1))); + EXPECT_THAT(adapter_as_controller()->GetSuggestionAt(3), + equalsSuggestion(suggestion(3))); +} + +TEST_F(AutofillKeyboardAccessoryAdapterTest, UseAdditionalLabelForElidedLabel) { + controller()->set_suggestions(createSuggestions()); + NotifyAboutSuggestions(); + + // If there is a label, use it. + EXPECT_EQ(adapter_as_controller()->GetElidedLabelAt(0), ASCIIToUTF16("A")); + + // If the label is empty, use the additional label: + EXPECT_EQ(adapter_as_controller()->GetElidedLabelAt(1), ASCIIToUTF16("B")); +} + +TEST_F(AutofillKeyboardAccessoryAdapterTest, ProvideReorderedSuggestions) { + controller()->set_suggestions(createSuggestions(/*clearItemOffset=*/2)); + NotifyAboutSuggestions(); + + EXPECT_THAT(adapter_as_controller()->GetSuggestions(), + testing::ElementsAre(equalsSuggestion(suggestion(2)), + equalsSuggestion(suggestion(0)), + equalsSuggestion(suggestion(1)), + equalsSuggestion(suggestion(3)))); +} + +TEST_F(AutofillKeyboardAccessoryAdapterTest, RemoveAfterConfirmation) { + controller()->set_suggestions(createSuggestions()); + NotifyAboutSuggestions(); + + base::OnceClosure confirm; + EXPECT_CALL(*controller(), GetRemovalConfirmationText(0, _, _)) + .WillOnce(Return(true)); + EXPECT_CALL(*view(), ConfirmDeletion(_, _, _)) + .WillOnce(WithArg<2>(Invoke([&](base::OnceClosure closure) -> void { + confirm = std::move(closure); + }))); + EXPECT_TRUE(adapter_as_controller()->RemoveSuggestion(0)); + + EXPECT_CALL(*controller(), RemoveSuggestion(0)).WillOnce(Return(true)); + std::move(confirm).Run(); +} + +TEST_F(AutofillKeyboardAccessoryAdapterTest, MapSelectedLineToChangedIndices) { + controller()->set_suggestions(createSuggestions(/*clearItemOffset=*/2)); + NotifyAboutSuggestions(); + + EXPECT_CALL(*controller(), SetSelectedLine(base::Optional<int>(0))); + adapter_as_controller()->SetSelectedLine(1); + + EXPECT_CALL(*controller(), selected_line()).WillRepeatedly(Return(0)); + EXPECT_EQ(adapter_as_controller()->selected_line(), 1); + + EXPECT_CALL(*controller(), AcceptSelectedLine()); + adapter_as_controller()->AcceptSelectedLine(); +} + +} // namespace autofill
diff --git a/chrome/browser/autofill/mock_autofill_popup_controller.cc b/chrome/browser/autofill/mock_autofill_popup_controller.cc new file mode 100644 index 0000000..06dc6e4c --- /dev/null +++ b/chrome/browser/autofill/mock_autofill_popup_controller.cc
@@ -0,0 +1,17 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/autofill/mock_autofill_popup_controller.h" + +namespace autofill { + +MockAutofillPopupController::MockAutofillPopupController() { + gfx::FontList::SetDefaultFontDescription("Arial, Times New Roman, 15px"); + layout_model_ = std::make_unique<autofill::AutofillPopupLayoutModel>( + this, false /* is_credit_card_field */); +} + +MockAutofillPopupController::~MockAutofillPopupController() = default; + +} // namespace autofill
diff --git a/chrome/browser/autofill/mock_autofill_popup_controller.h b/chrome/browser/autofill/mock_autofill_popup_controller.h new file mode 100644 index 0000000..37a6fb6 --- /dev/null +++ b/chrome/browser/autofill/mock_autofill_popup_controller.h
@@ -0,0 +1,94 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_AUTOFILL_MOCK_AUTOFILL_POPUP_CONTROLLER_H_ +#define CHROME_BROWSER_AUTOFILL_MOCK_AUTOFILL_POPUP_CONTROLLER_H_ + +#include <memory> +#include <vector> + +#include "base/no_destructor.h" +#include "build/build_config.h" +#include "chrome/browser/ui/autofill/autofill_popup_controller.h" +#include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" +#include "components/autofill/core/browser/suggestion.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "ui/gfx/geometry/rect_f.h" + +namespace autofill { + +class MockAutofillPopupController : public AutofillPopupController { + public: + MockAutofillPopupController(); + ~MockAutofillPopupController(); + + // AutofillPopupViewDelegate + MOCK_METHOD0(Hide, void()); + MOCK_METHOD0(ViewDestroyed, void()); + MOCK_METHOD1(SetSelectionAtPoint, void(const gfx::Point& point)); + MOCK_METHOD0(AcceptSelectedLine, bool()); + MOCK_METHOD0(SelectionCleared, void()); + MOCK_CONST_METHOD0(HasSelection, bool()); + MOCK_CONST_METHOD0(popup_bounds, gfx::Rect()); + MOCK_CONST_METHOD0(container_view, gfx::NativeView()); + const gfx::RectF& element_bounds() const override { + static base::NoDestructor<gfx::RectF> bounds({100, 100, 250, 50}); + return *bounds; + } + MOCK_CONST_METHOD0(IsRTL, bool()); + const std::vector<autofill::Suggestion> GetSuggestions() override { + return suggestions_; + } +#if !defined(OS_ANDROID) + MOCK_METHOD1(SetTypesetter, void(gfx::Typesetter typesetter)); + MOCK_METHOD1(GetElidedValueWidthForRow, int(int row)); + MOCK_METHOD1(GetElidedLabelWidthForRow, int(int row)); +#endif + + // AutofillPopupController + MOCK_METHOD0(OnSuggestionsChanged, void()); + MOCK_METHOD1(AcceptSuggestion, void(int index)); + + int GetLineCount() const override { return suggestions_.size(); } + + const autofill::Suggestion& GetSuggestionAt(int row) const override { + return suggestions_[row]; + } + + const base::string16& GetElidedValueAt(int i) const override { + return suggestions_[i].value; + } + + const base::string16& GetElidedLabelAt(int row) const override { + return suggestions_[row].label; + } + + MOCK_METHOD3(GetRemovalConfirmationText, + bool(int index, base::string16* title, base::string16* body)); + MOCK_METHOD1(RemoveSuggestion, bool(int index)); + MOCK_CONST_METHOD1(GetBackgroundColorIDForRow, + ui::NativeTheme::ColorId(int index)); + MOCK_METHOD1(SetSelectedLine, void(base::Optional<int> selected_line)); + MOCK_CONST_METHOD0(selected_line, base::Optional<int>()); + const autofill::AutofillPopupLayoutModel& layout_model() const override { + return *layout_model_; + } + + void set_suggestions(const std::vector<int>& ids) { + for (const auto& id : ids) + suggestions_.push_back(autofill::Suggestion("", "", "", id)); + } + + void set_suggestions(const std::vector<Suggestion>& suggestions) { + suggestions_ = suggestions; + } + + private: + std::unique_ptr<autofill::AutofillPopupLayoutModel> layout_model_; + std::vector<autofill::Suggestion> suggestions_; +}; + +} // namespace autofill + +#endif // CHROME_BROWSER_AUTOFILL_MOCK_AUTOFILL_POPUP_CONTROLLER_H_
diff --git a/chrome/browser/background_fetch/background_fetch_download_client.cc b/chrome/browser/background_fetch/background_fetch_download_client.cc index a30dbfc..e434ac0 100644 --- a/chrome/browser/background_fetch/background_fetch_download_client.cc +++ b/chrome/browser/background_fetch/background_fetch_download_client.cc
@@ -10,13 +10,13 @@ #include "base/bind.h" #include "base/threading/sequenced_task_runner_handle.h" -#include "chrome/browser/after_startup_task_utils.h" #include "chrome/browser/background_fetch/background_fetch_delegate_impl.h" #include "chrome/browser/download/download_service_factory.h" #include "components/download/public/background_service/download_metadata.h" #include "components/download/public/background_service/download_service.h" #include "content/public/browser/background_fetch_response.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/browser_thread.h" #include "services/network/public/cpp/resource_request_body.h" #include "url/origin.h" @@ -70,7 +70,7 @@ if (download.paused) { // We need to resurface the notification in a paused state. - AfterStartupTaskUtils::PostTask( + content::BrowserThread::PostAfterStartupTask( FROM_HERE, base::SequencedTaskRunnerHandle::Get(), base::BindOnce(&BackgroundFetchDelegateImpl::RestartPausedDownload, GetDelegate()->GetWeakPtr(), download.guid));
diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc index 1021870..ef3abcf 100644 --- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc
@@ -195,19 +195,19 @@ } #if BUILDFLAG(ENABLE_NACL) -void ClearNaClCacheOnIOThread(const base::Closure& callback) { +void ClearNaClCacheOnIOThread(base::OnceClosure callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - nacl::NaClBrowser::GetInstance()->ClearValidationCache(callback); + nacl::NaClBrowser::GetInstance()->ClearValidationCache(std::move(callback)); } void ClearPnaclCacheOnIOThread(base::Time begin, base::Time end, - const base::Closure& callback) { + base::OnceClosure callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); pnacl::PnaclHost::GetInstance()->ClearTranslationCacheEntriesBetween( - begin, end, callback); + begin, end, std::move(callback)); } #endif @@ -885,16 +885,14 @@ #if BUILDFLAG(ENABLE_NACL) base::PostTaskWithTraits( FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &ClearNaClCacheOnIOThread, - base::AdaptCallbackForRepeating(UIThreadTrampoline( - CreateTaskCompletionClosure(TracingDataType::kNaclCache))))); + base::BindOnce(&ClearNaClCacheOnIOThread, + UIThreadTrampoline(CreateTaskCompletionClosure( + TracingDataType::kNaclCache)))); base::PostTaskWithTraits( FROM_HERE, {BrowserThread::IO}, - base::BindOnce( - &ClearPnaclCacheOnIOThread, delete_begin_, delete_end_, - base::AdaptCallbackForRepeating(UIThreadTrampoline( - CreateTaskCompletionClosure(TracingDataType::kPnaclCache))))); + base::BindOnce(&ClearPnaclCacheOnIOThread, delete_begin_, delete_end_, + UIThreadTrampoline(CreateTaskCompletionClosure( + TracingDataType::kPnaclCache)))); #endif // The PrerenderManager may have a page actively being prerendered, which
diff --git a/chrome/browser/browsing_data/counters/browsing_data_counter_utils_browsertest.cc b/chrome/browser/browsing_data/counters/browsing_data_counter_utils_browsertest.cc index 05a3849..8b871a37 100644 --- a/chrome/browser/browsing_data/counters/browsing_data_counter_utils_browsertest.cc +++ b/chrome/browser/browsing_data/counters/browsing_data_counter_utils_browsertest.cc
@@ -11,8 +11,8 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/unified_consent/unified_consent_service_factory.h" #include "chrome/test/base/in_process_browser_test.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/signin/core/browser/signin_buildflags.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/test/fake_server/fake_server_network_resources.h" #include "components/unified_consent/feature.h" #include "components/unified_consent/scoped_unified_consent.h" @@ -70,7 +70,7 @@ ShouldShowCookieException) { Profile* profile = browser()->profile(); - browser_sync::ProfileSyncService* sync_service = + syncer::ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetAsProfileSyncServiceForProfile(profile); sync_service->OverrideNetworkResourcesForTest(
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 2922947..b32fecd7 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -89,7 +89,6 @@ "//chromeos/dbus", "//chromeos/dbus:authpolicy_proto", "//chromeos/dbus:login_manager_proto", - "//chromeos/dbus:media_perception_proto", "//chromeos/dbus:metrics_event_proto", "//chromeos/dbus:oobe_config_proto", "//chromeos/dbus:plugin_vm_service_proto", @@ -101,6 +100,8 @@ "//chromeos/dbus/cryptohome:cryptohome_signkey_proto", "//chromeos/dbus/kerberos", "//chromeos/dbus/machine_learning", + "//chromeos/dbus/media_analytics", + "//chromeos/dbus/media_analytics:media_perception_proto", "//chromeos/dbus/services:services", "//chromeos/dbus/system_clock", "//chromeos/disks", @@ -1311,9 +1312,6 @@ "login/screens/update_screen.cc", "login/screens/update_screen.h", "login/screens/update_view.h", - "login/screens/user_image_screen.cc", - "login/screens/user_image_screen.h", - "login/screens/user_image_view.h", "login/screens/user_selection_screen.cc", "login/screens/user_selection_screen.h", "login/screens/welcome_screen.cc",
diff --git a/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.cc b/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.cc index 361a87f..066d453 100644 --- a/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.cc +++ b/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.cc
@@ -116,6 +116,11 @@ StopObserveNetwork(); } +KerberosFilesHandler* +AuthPolicyCredentialsManager::GetKerberosFilesHandlerForTesting() { + return &kerberos_files_handler_; +} + void AuthPolicyCredentialsManager::GetUserStatus() { DCHECK(!is_get_status_in_progress_); is_get_status_in_progress_ = true;
diff --git a/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.h b/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.h index a4e98a49f..389f7f99 100644 --- a/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.h +++ b/chrome/browser/chromeos/authpolicy/auth_policy_credentials_manager.h
@@ -53,6 +53,8 @@ const chromeos::NetworkState* network) override; void OnShuttingDown() override; + KerberosFilesHandler* GetKerberosFilesHandlerForTesting(); + private: friend class AuthPolicyCredentialsManagerTest; // Calls AuthPolicyClient::GetUserStatus method. @@ -128,6 +130,7 @@ friend struct base::DefaultSingletonTraits< AuthPolicyCredentialsManagerFactory>; friend class AuthPolicyCredentialsManagerTest; + friend class ExistingUserControllerActiveDirectoryTest; AuthPolicyCredentialsManagerFactory(); ~AuthPolicyCredentialsManagerFactory() override;
diff --git a/chrome/browser/chromeos/authpolicy/kerberos_files_handler.cc b/chrome/browser/chromeos/authpolicy/kerberos_files_handler.cc index 939febf6..d847d9b 100644 --- a/chrome/browser/chromeos/authpolicy/kerberos_files_handler.cc +++ b/chrome/browser/chromeos/authpolicy/kerberos_files_handler.cc
@@ -41,7 +41,17 @@ // Writes |blob| into file <UserPath>/kerberos/|file_name|. First writes into // temporary file and then replaces existing one. -void WriteFile(const std::string& file_name, const std::string& blob) { +void WriteFile(const base::FilePath& path, base::Optional<std::string> blob) { + if (!blob.has_value()) + return; + if (!base::ImportantFileWriter::WriteFileAtomically(path, blob.value())) + LOG(ERROR) << "Failed to write file " << path.value(); +} + +// Writes |krb5cc| to <DIR_HOME>/kerberos/krb5cc and |krb5config| to +// <DIR_HOME>/kerberos/krb5.conf if set. Creates directories if necessary. +void WriteFiles(base::Optional<std::string> krb5cc, + base::Optional<std::string> krb5config) { base::FilePath dir; base::PathService::Get(base::DIR_HOME, &dir); dir = dir.Append(kKrb5Directory); @@ -51,19 +61,22 @@ << "' directory: " << base::File::ErrorToString(error); return; } - base::FilePath dest_file = dir.Append(file_name); - if (!base::ImportantFileWriter::WriteFileAtomically(dest_file, blob)) { - LOG(ERROR) << "Failed to write file " << dest_file.value(); - } + + WriteFile(dir.Append(kKrb5CCFile), std::move(krb5cc)); + WriteFile(dir.Append(kKrb5ConfFile), std::move(krb5config)); } -// Put canonicalization settings first depending on user policy. Whatever -// setting comes first wins, so even if krb5.conf sets rdns or -// dns_canonicalize_hostname below, it would get overridden. -std::string AdjustConfig(const std::string& config, bool is_dns_cname_enabled) { +// If |config| has a value, puts canonicalization settings first depending on +// user policy. Whatever setting comes first wins, so even if krb5.conf sets +// rdns or dns_canonicalize_hostname below, it would get overridden. +base::Optional<std::string> MaybeAdjustConfig( + base::Optional<std::string> config, + bool is_dns_cname_enabled) { + if (!config.has_value()) + return base::nullopt; std::string adjusted_config = base::StringPrintf( kKrb5CnameSettings, is_dns_cname_enabled ? "true" : "false"); - adjusted_config.append(config); + adjusted_config.append(config.value()); return adjusted_config; } @@ -112,23 +125,20 @@ void KerberosFilesHandler::SetFiles(base::Optional<std::string> krb5cc, base::Optional<std::string> krb5conf) { - if (krb5cc.has_value()) { - base::PostTaskWithTraits( - FROM_HERE, - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce(&WriteFile, kKrb5CCFile, krb5cc.value())); - } - if (krb5conf.has_value()) { - base::PostTaskWithTraits( - FROM_HERE, - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, - base::BindOnce( - &WriteFile, kKrb5ConfFile, - AdjustConfig(krb5conf.value(), - !negotiate_disable_cname_lookup_.GetValue()))); - } + krb5conf = + MaybeAdjustConfig(krb5conf, !negotiate_disable_cname_lookup_.GetValue()); + base::PostTaskWithTraitsAndReply( + FROM_HERE, + {base::MayBlock(), base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, + base::BindOnce(&WriteFiles, std::move(krb5cc), std::move(krb5conf)), + base::BindOnce(&KerberosFilesHandler::OnFilesChanged, + weak_factory_.GetWeakPtr())); +} + +void KerberosFilesHandler::SetFilesChangedForTesting( + base::OnceClosure callback) { + files_changed_for_testing_ = std::move(callback); } void KerberosFilesHandler::OnDisabledAuthNegotiateCnameLookupChanged() { @@ -136,4 +146,9 @@ get_kerberos_files_.Run(); } +void KerberosFilesHandler::OnFilesChanged() { + if (files_changed_for_testing_) + std::move(files_changed_for_testing_).Run(); +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/authpolicy/kerberos_files_handler.h b/chrome/browser/chromeos/authpolicy/kerberos_files_handler.h index 2f93805..df223e2d 100644 --- a/chrome/browser/chromeos/authpolicy/kerberos_files_handler.h +++ b/chrome/browser/chromeos/authpolicy/kerberos_files_handler.h
@@ -30,15 +30,24 @@ void SetFiles(base::Optional<std::string> krb5cc, base::Optional<std::string> krb5conf); + // Sets a callback for when disk IO task posted by SetFiles has finished. + void SetFilesChangedForTesting(base::OnceClosure callback); + private: // Called whenever prefs::kDisableAuthNegotiateCnameLookup is changed. void OnDisabledAuthNegotiateCnameLookupChanged(); + // Forwards to |files_changed_for_testing_| if set. + void OnFilesChanged(); + PrefMember<bool> negotiate_disable_cname_lookup_; // Triggers a fetch of Kerberos files. Called when the watched pref changes. base::RepeatingClosure get_kerberos_files_; + // Called when disk IO queued by SetFiles has finished. + base::OnceClosure files_changed_for_testing_; + base::WeakPtrFactory<KerberosFilesHandler> weak_factory_{this}; DISALLOW_COPY_AND_ASSIGN(KerberosFilesHandler); };
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index 4ab89cd..9dbb61b 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -151,13 +151,13 @@ #include "chromeos/tpm/tpm_token_loader.h" #include "components/account_id/account_id.h" #include "components/arc/arc_util.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/device_event_log/device_event_log.h" #include "components/metrics/metrics_service.h" #include "components/ownership/owner_key_util.h" #include "components/prefs/pref_service.h" #include "components/quirks/quirks_manager.h" #include "components/session_manager/core/session_manager.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "components/user_manager/user_names.h"
diff --git a/chrome/browser/chromeos/dbus/dbus_helper.cc b/chrome/browser/chromeos/dbus/dbus_helper.cc index 024272b2..05f6612 100644 --- a/chrome/browser/chromeos/dbus/dbus_helper.cc +++ b/chrome/browser/chromeos/dbus/dbus_helper.cc
@@ -16,6 +16,7 @@ #include "chromeos/dbus/hammerd/hammerd_client.h" #include "chromeos/dbus/kerberos/kerberos_client.h" #include "chromeos/dbus/machine_learning/machine_learning_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include "chromeos/dbus/permission_broker/permission_broker_client.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/system_clock/system_clock_client.h" @@ -56,6 +57,7 @@ CryptohomeClient::Initialize(bus); KerberosClient::Initialize(bus); MachineLearningClient::Initialize(bus); + MediaAnalyticsClient::Initialize(bus); PermissionBrokerClient::Initialize(bus); PowerManagerClient::Initialize(bus); SystemClockClient::Initialize(bus); @@ -66,6 +68,7 @@ CryptohomeClient::InitializeFake(); KerberosClient::InitializeFake(); MachineLearningClient::InitializeFake(); + MediaAnalyticsClient::InitializeFake(); PermissionBrokerClient::InitializeFake(); PowerManagerClient::InitializeFake(); SystemClockClient::InitializeFake(); @@ -84,6 +87,7 @@ SystemClockClient::Shutdown(); PowerManagerClient::Shutdown(); PermissionBrokerClient::Shutdown(); + MediaAnalyticsClient::Shutdown(); MachineLearningClient::Shutdown(); KerberosClient::Shutdown(); CryptohomeClient::Shutdown();
diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc index b23a7821..ebf830d 100644 --- a/chrome/browser/chromeos/drive/file_system_util.cc +++ b/chrome/browser/chromeos/drive/file_system_util.cc
@@ -32,13 +32,13 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths_internal.h" #include "chromeos/constants/chromeos_constants.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/drive/chromeos/file_system_interface.h" #include "components/drive/drive.pb.h" #include "components/drive/drive_pref_names.h" #include "components/drive/file_system_core_util.h" #include "components/drive/job_list.h" #include "components/prefs/pref_service.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/user_manager/user_manager.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/network_service_instance.h"
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc index 3ad634f3..fad5b49cb 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_strings.cc
@@ -49,6 +49,9 @@ Profile::FromBrowserContext(browser_context()))); dict->SetBoolean("DRIVE_FS_ENABLED", base::FeatureList::IsEnabled(chromeos::features::kDriveFs)); + dict->SetBoolean("FEEDBACK_PANEL_ENABLED", + base::FeatureList::IsEnabled( + chromeos::features::kEnableFileManagerFeedbackPanel)); dict->SetBoolean( "MY_FILES_VOLUME_ENABLED", base::FeatureList::IsEnabled(chromeos::features::kMyFilesVolume));
diff --git a/chrome/browser/chromeos/kiosk_next_home/app_controller_service.cc b/chrome/browser/chromeos/kiosk_next_home/app_controller_service.cc index 8e56d9f9..c8540af 100644 --- a/chrome/browser/chromeos/kiosk_next_home/app_controller_service.cc +++ b/chrome/browser/chromeos/kiosk_next_home/app_controller_service.cc
@@ -21,6 +21,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" +#include "chrome/common/extensions/extension_constants.h" #include "chrome/services/app_service/public/mojom/types.mojom.h" #include "chromeos/constants/chromeos_switches.h" #include "components/arc/arc_service_manager.h" @@ -70,7 +71,9 @@ // be consumed. Refer to AppRegistryCache::ForEachApp for more information. app_service_proxy_->AppRegistryCache().ForEachApp( [this, &app_list](const apps::AppUpdate& update) { - app_list.push_back(CreateAppPtr(update)); + // Only include relevant apps. + if (AppIsRelevantForKioskNextHome(update)) + app_list.push_back(CreateAppPtr(update)); }); std::move(callback).Run(std::move(app_list)); } @@ -87,6 +90,10 @@ display::kDefaultDisplayId); } +void AppControllerService::UninstallApp(const std::string& app_id) { + app_service_proxy_->Uninstall(app_id); +} + void AppControllerService::GetArcAndroidId( mojom::AppController::GetArcAndroidIdCallback callback) { arc::GetAndroidId(base::BindOnce( @@ -129,12 +136,17 @@ } void AppControllerService::OnAppUpdate(const apps::AppUpdate& update) { - // Skip this event if no relevant fields have changed. + // Skip this event if there were no changes to the fields that we are + // interested in. if (!update.StateIsNull() && !update.NameChanged() && - !update.ReadinessChanged()) { + !update.ReadinessChanged() && !update.ShowInLauncherChanged()) { return; } + // Skip this app if it's not relevant. + if (!AppIsRelevantForKioskNextHome(update)) + return; + if (client_) { client_->OnAppChanged(CreateAppPtr(update)); } @@ -154,6 +166,19 @@ return app; } +bool AppControllerService::AppIsRelevantForKioskNextHome( + const apps::AppUpdate& update) { + // The Kiosk Next Home app should never be returned since it's considered an + // implementation detail. + if (update.AppId() == extension_misc::kKioskNextHomeAppId) { + return false; + } + + // We only consider relevant apps that can be shown in the launcher. + // This skips hidden apps like Galery, Web store, Welcome app, etc. + return update.ShowInLauncher() == apps::mojom::OptionalBool::kTrue; +} + const std::string& AppControllerService::MaybeGetAndroidPackageName( const std::string& app_id) { // Try to find a cached package name for this app.
diff --git a/chrome/browser/chromeos/kiosk_next_home/app_controller_service.h b/chrome/browser/chromeos/kiosk_next_home/app_controller_service.h index 8f4b00b..614ae4df 100644 --- a/chrome/browser/chromeos/kiosk_next_home/app_controller_service.h +++ b/chrome/browser/chromeos/kiosk_next_home/app_controller_service.h
@@ -49,6 +49,7 @@ void GetApps(mojom::AppController::GetAppsCallback callback) override; void SetClient(mojom::AppControllerClientPtr client) override; void LaunchApp(const std::string& app_id) override; + void UninstallApp(const std::string& app_id) override; void GetArcAndroidId( mojom::AppController::GetArcAndroidIdCallback callback) override; void LaunchHomeUrl(const std::string& suffix, @@ -62,6 +63,8 @@ // AppServiceProxy. mojom::AppPtr CreateAppPtr(const apps::AppUpdate& update); + bool AppIsRelevantForKioskNextHome(const apps::AppUpdate& update); + // Tries to get the Android package name for this app from ARC++. // If we can't find the package name or this is not an Android app we return // an empty string.
diff --git a/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom b/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom index 3422b63..64acad32 100644 --- a/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom +++ b/chrome/browser/chromeos/kiosk_next_home/mojom/app_controller.mojom
@@ -50,6 +50,9 @@ // Launches the app with the given app_id. LaunchApp(string app_id); + // Shows a prompt to uninstall the app with the given app_id. + UninstallApp(string app_id); + // Gets the Android ID for the ARC container. GetArcAndroidId() => (bool success, string android_id);
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc index 4befc6e..3fc1429 100644 --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
@@ -19,6 +19,7 @@ #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" +#include "chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/browser_shutdown.h" @@ -392,6 +393,13 @@ void EnrollmentScreen::OnDeviceEnrolled() { enrollment_succeeded_ = true; enrollment_helper_->GetDeviceAttributeUpdatePermission(); + + // Evaluates device policy TPMFirmwareUpdateSettings and updates the TPM if + // the policy is set to auto-update vulnerable TPM firmware at enrollment. + g_browser_process->platform_part() + ->browser_policy_connector_chromeos() + ->GetTPMAutoUpdateModePolicyHandler() + ->UpdateOnEnrollmentIfNeeded(); } void EnrollmentScreen::OnActiveDirectoryCredsProvided(
diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc index 81d363c2..a23083a 100644 --- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc
@@ -5,15 +5,14 @@ #include <string> #include <vector> -#include "base/barrier_closure.h" #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/files/file_path_watcher.h" #include "base/location.h" #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/threading/thread_restrictions.h" @@ -36,6 +35,8 @@ #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/browser.h" #include "chrome/grit/generated_resources.h" #include "chrome/test/base/testing_browser_process.h" #include "chromeos/constants/chromeos_switches.h" @@ -69,13 +70,13 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +using ::testing::_; using ::testing::AnyNumber; using ::testing::Invoke; using ::testing::InvokeWithoutArgs; using ::testing::Return; using ::testing::ReturnNull; using ::testing::WithArg; -using ::testing::_; namespace em = enterprise_management; @@ -90,7 +91,6 @@ const char kSupervisedUserID[] = "supervised_user@locally-managed.localhost"; const char kPassword[] = "test_password"; const char kActiveDirectoryRealm[] = "active.directory.realm"; -const char kKrb5CCFilePrefix[] = "FILE:"; const char kPublicSessionUserEmail[] = "public_session_user@localhost"; const int kAutoLoginNoDelay = 0; @@ -116,78 +116,18 @@ } } -std::string GetKerberosConfigFileName() { - std::unique_ptr<base::Environment> env(base::Environment::Create()); - std::string config_file; - EXPECT_TRUE(env->GetVar("KRB5_CONFIG", &config_file)); - return config_file; +base::FilePath GetKerberosConfigPath() { + base::FilePath path; + EXPECT_TRUE(base::PathService::Get(base::DIR_HOME, &path)); + return path.Append("kerberos").Append("krb5.conf"); } -std::string GetKerberosCredentialsCacheFileName() { - std::unique_ptr<base::Environment> env(base::Environment::Create()); - std::string creds_file; - EXPECT_TRUE(env->GetVar("KRB5CCNAME", &creds_file)); - EXPECT_EQ(kKrb5CCFilePrefix, creds_file.substr(0, strlen(kKrb5CCFilePrefix))); - return creds_file.substr(strlen(kKrb5CCFilePrefix)); +base::FilePath GetKerberosCredentialsCachePath() { + base::FilePath path; + EXPECT_TRUE(base::PathService::Get(base::DIR_HOME, &path)); + return path.Append("kerberos").Append("krb5cc"); } -// Helper class to wait when both Kerberos credentials cache and config file -// changed. -class KerberosFilesChangeWaiter { - public: - // If |files_must_exist| is true and a file already exists the class does not - // wait when it changes. - explicit KerberosFilesChangeWaiter(bool files_must_exist) { - barrier_closure_ = base::BarrierClosure(2, loop_.QuitClosure()); - - watch_callback_ = base::BindRepeating( - [](const base::RepeatingClosure& barrier_closure, - const base::FilePath& path, bool error) -> void { - EXPECT_FALSE(error); - barrier_closure.Run(); - }, - barrier_closure_); - - config_watcher_ = std::make_unique<base::FilePathWatcher>(); - MaybeStartWatch(&config_watcher_, - base::FilePath(GetKerberosConfigFileName()), - files_must_exist); - - creds_watcher_ = std::make_unique<base::FilePathWatcher>(); - MaybeStartWatch(&creds_watcher_, - base::FilePath(GetKerberosCredentialsCacheFileName()), - files_must_exist); - } - - // Should be called once. - void Wait() { - base::ScopedAllowBlockingForTesting allow_io; - loop_.Run(); - config_watcher_.reset(); - creds_watcher_.reset(); - } - - private: - void MaybeStartWatch(std::unique_ptr<base::FilePathWatcher>* watcher, - const base::FilePath& path, - bool files_must_exist) { - base::ScopedAllowBlockingForTesting allow_io; - (*watcher)->Watch(path, false /* recursive */, watch_callback_); - if (!files_must_exist && base::PathExists(path)) { - watch_callback_.Run(path, false /* error */); - watcher->reset(); - } - } - base::RunLoop loop_; - base::RepeatingClosure barrier_closure_; - - base::RepeatingCallback<void(const base::FilePath& path, bool error)> - watch_callback_; - - std::unique_ptr<base::FilePathWatcher> config_watcher_; - std::unique_ptr<base::FilePathWatcher> creds_watcher_; -}; - } // namespace class ExistingUserControllerTest : public policy::DevicePolicyCrosBrowserTest { @@ -855,6 +795,18 @@ } protected: + // Needs to be a member because this class is a friend of + // AuthPolicyCredentialsManagerFactory to access GetServiceForBrowserContext. + KerberosFilesHandler* GetKerberosFilesHandler() { + auto* auth_policy_credentials_manager = + static_cast<AuthPolicyCredentialsManager*>( + AuthPolicyCredentialsManagerFactory::GetInstance() + ->GetServiceForBrowserContext( + ProfileManager::GetLastUsedProfile(), false /* create */)); + EXPECT_TRUE(auth_policy_credentials_manager); + return auth_policy_credentials_manager->GetKerberosFilesHandlerForTesting(); + } + void LoginAdOnline() { ExpectLoginSuccess(); UserContext user_context(user_manager::UserType::USER_TYPE_ACTIVE_DIRECTORY, @@ -870,8 +822,15 @@ existing_user_controller()->CompleteLogin(user_context); profile_prepared_observer.Wait(); - KerberosFilesChangeWaiter files_change_waiter(false /* files_must_exist */); - files_change_waiter.Wait(); + + // This only works if no RunLoop::Run() call is made after the Kerberos file + // writer task has been posted. Ideally, SetFilesChangedForTesting() should + // be called before the task is posted, but we don't have a profile yet at + // that point, so we can't get the files handler. + base::RunLoop run_loop; + GetKerberosFilesHandler()->SetFilesChangedForTesting( + run_loop.QuitClosure()); + run_loop.Run(); CheckKerberosFiles(true /* enable_dns_cname_lookup */); } @@ -909,28 +868,30 @@ void CheckKerberosFiles(bool enable_dns_cname_lookup) { base::ScopedAllowBlockingForTesting allow_io; std::string file_contents; - EXPECT_TRUE(base::ReadFileToString( - base::FilePath(GetKerberosConfigFileName()), &file_contents)); + EXPECT_TRUE( + base::ReadFileToString(GetKerberosConfigPath(), &file_contents)); EXPECT_EQ(GetExpectedKerberosConfig(enable_dns_cname_lookup), file_contents); - EXPECT_TRUE(base::ReadFileToString( - base::FilePath(GetKerberosCredentialsCacheFileName()), &file_contents)); + EXPECT_TRUE(base::ReadFileToString(GetKerberosCredentialsCachePath(), + &file_contents)); EXPECT_EQ(file_contents, FakeAuthPolicyClient::Get()->user_kerberos_creds()); } // Applies policy and waits until both config and credentials files changed. void ApplyPolicyAndWaitFilesChanged(bool enable_dns_cname_lookup) { - KerberosFilesChangeWaiter files_change_waiter(true /* files_must_exist */); policy::PolicyMap policies; policies.Set(policy::key::kDisableAuthNegotiateCnameLookup, policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, std::make_unique<base::Value>(!enable_dns_cname_lookup), nullptr); + base::RunLoop run_loop; + GetKerberosFilesHandler()->SetFilesChangedForTesting( + run_loop.QuitClosure()); UpdateProviderPolicy(policies); - files_change_waiter.Wait(); + run_loop.Run(); } private: @@ -972,9 +933,8 @@ // Tests if DisabledAuthNegotiateCnameLookup changes trigger updating user // Kerberos files. -// Disabled due to flakiness, see https://crbug.com/865206. IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, - DISABLED_PolicyChangeTriggersFileUpdate) { + PolicyChangeTriggersFileUpdate) { LoginAdOnline(); ApplyPolicyAndWaitFilesChanged(false /* enable_dns_cname_lookup */); @@ -986,15 +946,17 @@ // Tests if user Kerberos files changed D-Bus signal triggers updating user // Kerberos files. -// Disabled due to flakiness, see https://crbug.com/865206. -IN_PROC_BROWSER_TEST_F( - ExistingUserControllerActiveDirectoryTest, - DISABLED_UserKerberosFilesChangedSignalTriggersFileUpdate) { +IN_PROC_BROWSER_TEST_F(ExistingUserControllerActiveDirectoryTest, + UserKerberosFilesChangedSignalTriggersFileUpdate) { LoginAdOnline(); - KerberosFilesChangeWaiter files_change_waiter(true /* files_must_exist */); + + // Set authpolicyd's copy of the Kerberos files and wait until Chrome's copy + // has updated. + base::RunLoop run_loop; + GetKerberosFilesHandler()->SetFilesChangedForTesting(run_loop.QuitClosure()); FakeAuthPolicyClient::Get()->SetUserKerberosFiles("new_kerberos_creds", "new_kerberos_config"); - files_change_waiter.Wait(); + run_loop.Run(); CheckKerberosFiles(true /* enable_dns_cname_lookup */); } @@ -1015,8 +977,11 @@ content::NotificationService::AllSources()); existing_user_controller()->Login(user_context, SigninSpecifics()); profile_prepared_observer.Wait(); - KerberosFilesChangeWaiter files_change_waiter(false /* files_must_exist */); - files_change_waiter.Wait(); + + // Note: Can't call SetFilesChangedForTesting() earlier, see LoginAdOnline(). + base::RunLoop run_loop; + GetKerberosFilesHandler()->SetFilesChangedForTesting(run_loop.QuitClosure()); + run_loop.Run(); CheckKerberosFiles(true /* enable_dns_cname_lookup */); }
diff --git a/chrome/browser/chromeos/login/kiosk_browsertest.cc b/chrome/browser/chromeos/login/kiosk_browsertest.cc index 6bea896..a5c06389 100644 --- a/chrome/browser/chromeos/login/kiosk_browsertest.cc +++ b/chrome/browser/chromeos/login/kiosk_browsertest.cc
@@ -30,6 +30,7 @@ #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/test/fake_gaia_mixin.h" #include "chrome/browser/chromeos/login/test/js_checker.h" +#include "chrome/browser/chromeos/login/test/network_portal_detector_mixin.h" #include "chrome/browser/chromeos/login/test/oobe_base_test.h" #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" #include "chrome/browser/chromeos/login/test/test_condition_waiter.h" @@ -600,12 +601,11 @@ apps_loaded_signal.Wait(); } - void StartAppLaunchFromLoginScreen(const base::Closure& network_setup_cb) { + void StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CaptivePortalStatus network_status) { PrepareAppLaunch(); - if (!network_setup_cb.is_null()) - network_setup_cb.Run(); - + network_portal_detector_.SimulateDefaultNetworkState(network_status); EXPECT_TRUE(LaunchApp(test_app_id(), false)); } @@ -730,7 +730,8 @@ ScopedCanConfigureNetwork can_configure_network(true, true); // Start app launch and wait for network connectivity timeout. - StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE); OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); splash_waiter.Wait(); WaitForAppLaunchNetworkTimeout(); @@ -791,6 +792,16 @@ return base::Value(); } + void SimulateNetworkOnline() { + network_portal_detector_.SimulateDefaultNetworkState( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); + } + + void SimulateNetworkOffline() { + network_portal_detector_.SimulateDefaultNetworkState( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE); + } + AppLaunchController* GetAppLaunchController() { return LoginDisplayHost::default_host()->GetAppLaunchController(); } @@ -819,6 +830,8 @@ const AccountId test_owner_account_id_ = AccountId::FromUserEmail(kTestOwnerEmail); + NetworkPortalDetectorMixin network_portal_detector_{&mixin_host_}; + private: bool use_consumer_kiosk_mode_ = true; std::string test_app_id_; @@ -831,7 +844,8 @@ }; IN_PROC_BROWSER_TEST_F(KioskTest, InstallAndLaunchApp) { - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); WaitForAppLaunchSuccess(); KioskAppManager::App app; ASSERT_TRUE(KioskAppManager::Get()->GetApp(test_app_id(), &app)); @@ -842,7 +856,8 @@ IN_PROC_BROWSER_TEST_F(KioskTest, ZoomSupport) { ExtensionTestMessageListener app_window_loaded_listener("appWindowLoaded", false); - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); EXPECT_TRUE(app_window_loaded_listener.WaitUntilSatisfied()); Profile* app_profile = ProfileManager::GetPrimaryUserProfile(); @@ -914,7 +929,8 @@ IN_PROC_BROWSER_TEST_F(KioskTest, NotSignedInWithGAIAAccount) { // Tests that the kiosk session is not considered to be logged in with a GAIA // account. - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); WaitForAppLaunchSuccess(); EXPECT_EQ(extensions::Manifest::EXTERNAL_PREF, GetInstalledAppLocation()); @@ -942,7 +958,8 @@ AppLaunchController::SetBlockAppLaunchForTesting(true); // Start app launch and wait for network connectivity timeout. - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); splash_waiter.Wait(); @@ -971,7 +988,8 @@ ScopedCanConfigureNetwork can_configure_network(false, true); // Start app launch and wait for network connectivity timeout. - StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE); OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); splash_waiter.Wait(); WaitForAppLaunchNetworkTimeout(); @@ -989,7 +1007,8 @@ ScopedCanConfigureNetwork can_configure_network(true, false); // Start app launch with network portal state. - StartAppLaunchFromLoginScreen(SimulateNetworkPortalClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL); OobeScreenWaiter app_splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); app_splash_waiter.set_no_assert_last_screen(); @@ -1010,7 +1029,8 @@ // Make fake_cws_ return empty update response. set_test_app_version(""); OobeScreenWaiter splash_waiter(OobeScreen::SCREEN_APP_LAUNCH_SPLASH); - StartAppLaunchFromLoginScreen(SimulateNetworkOfflineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE); splash_waiter.Wait(); settings_helper_.SetBoolean( @@ -1313,7 +1333,8 @@ set_test_crx_file(test_app_id() + ".crx"); extensions::ResultCatcher catcher; - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); } @@ -1903,7 +1924,8 @@ set_test_crx_file(test_app_id() + ".crx"); extensions::ResultCatcher catcher; - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); WaitForAppLaunchWithOptions(true /* check_launch_data */, false /* terminate_app */); ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); @@ -1916,7 +1938,8 @@ set_test_app_version("2.0.0"); set_test_crx_file(test_app_id() + "_v2_read_and_verify_data.crx"); extensions::ResultCatcher catcher; - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); WaitForAppLaunchWithOptions(true /* check_launch_data */, false /* terminate_app */); @@ -1974,6 +1997,7 @@ StartUIForAppLaunch(); SimulateNetworkOnline(); + EXPECT_TRUE(LaunchApp(test_app_id(), false)); WaitForAppLaunchSuccess(); @@ -2425,7 +2449,8 @@ set_test_crx_file(test_app_id() + ".crx"); extensions::ResultCatcher catcher; - StartAppLaunchFromLoginScreen(SimulateNetworkOnlineClosure()); + StartAppLaunchFromLoginScreen( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); }
diff --git a/chrome/browser/chromeos/login/lock/views_screen_locker.cc b/chrome/browser/chromeos/login/lock/views_screen_locker.cc index 53115e5..4c43776 100644 --- a/chrome/browser/chromeos/login/lock/views_screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/views_screen_locker.cc
@@ -31,7 +31,6 @@ #include "chrome/browser/ui/ash/wallpaper_controller_client.h" #include "chrome/common/pref_names.h" #include "chromeos/components/proximity_auth/screenlock_bridge.h" -#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/media_perception/media_perception.pb.h" #include "components/user_manager/known_user.h" #include "components/user_manager/user_manager.h" @@ -78,8 +77,7 @@ ViewsScreenLocker::ViewsScreenLocker(ScreenLocker* screen_locker) : screen_locker_(screen_locker), system_info_updater_(std::make_unique<MojoSystemInfoDispatcher>()), - media_analytics_client_( - chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient()) { + media_analytics_client_(chromeos::MediaAnalyticsClient::Get()) { LoginScreenClient::Get()->SetDelegate(this); user_board_view_mojo_ = std::make_unique<UserBoardViewMojo>(); user_selection_screen_ =
diff --git a/chrome/browser/chromeos/login/lock/views_screen_locker.h b/chrome/browser/chromeos/login/lock/views_screen_locker.h index 2e2f1d00..4e00bdf 100644 --- a/chrome/browser/chromeos/login/lock/views_screen_locker.h +++ b/chrome/browser/chromeos/login/lock/views_screen_locker.h
@@ -12,7 +12,7 @@ #include "chrome/browser/chromeos/login/lock/screen_locker.h" #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/ui/ash/login_screen_client.h" -#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include "chromeos/dbus/media_perception/media_perception.pb.h" #include "chromeos/dbus/power/power_manager_client.h"
diff --git a/chrome/browser/chromeos/login/login_ui_browsertest.cc b/chrome/browser/chromeos/login/login_ui_browsertest.cc index 43ffb79a..8fa449a3 100644 --- a/chrome/browser/chromeos/login/login_ui_browsertest.cc +++ b/chrome/browser/chromeos/login/login_ui_browsertest.cc
@@ -8,8 +8,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/login/login_manager_test.h" -#include "chrome/browser/chromeos/login/screenshot_testing/login_screen_areas.h" -#include "chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.h" #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/test/js_checker.h" #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" @@ -42,18 +40,12 @@ test_users_.emplace_back(AccountId::FromUserEmailGaiaId( kTestUsers[i].email, kTestUsers[i].gaia_id)); } - - screenshot_testing_.IgnoreArea(areas::kClockArea); - screenshot_testing_.IgnoreArea(areas::kFirstUserpod); - screenshot_testing_.IgnoreArea(areas::kSecondUserpod); } ~LoginUITest() override {} protected: std::vector<AccountId> test_users_; - ScreenshotTestingMixin screenshot_testing_{&mixin_host_}; - DISALLOW_COPY_AND_ASSIGN(LoginUITest); }; @@ -78,7 +70,6 @@ "document.querySelectorAll('.pod:not(#user-pod-template)')[1]" ".user.emailAddress == '" + test_users_[1].GetUserEmail() + "'"); - screenshot_testing_.RunScreenshotTesting("LoginUITest-LoginUIVisible"); } IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_InterruptedAutoStartEnrollment) {
diff --git a/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc b/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc index f7a68a7..77ee8c1 100644 --- a/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc +++ b/chrome/browser/chromeos/login/oobe_interactive_ui_test.cc
@@ -323,11 +323,6 @@ LOG(INFO) << "OobeInteractiveUITest: 'discover' screen done."; } - void WaitForUserImageScreen() { - test::CreateOobeScreenWaiter("user-image")->Wait(); - LOG(INFO) << "OobeInteractiveUITest: Switched to 'user-image' screen."; - } - void SimpleEndToEnd(); base::Optional<std::string> quick_unlock_private_get_auth_token_password_;
diff --git a/chrome/browser/chromeos/login/oobe_screen.cc b/chrome/browser/chromeos/login/oobe_screen.cc index b4d4d271..db69921 100644 --- a/chrome/browser/chromeos/login/oobe_screen.cc +++ b/chrome/browser/chromeos/login/oobe_screen.cc
@@ -31,7 +31,6 @@ "autolaunch", // SCREEN_KIOSK_AUTOLAUNCH "kiosk-enable", // SCREEN_KIOSK_ENABLE "error-message", // SCREEN_ERROR_MESSAGE - "user-image", // SCREEN_USER_IMAGE_PICKER "tpm-error-message", // SCREEN_TPM_ERROR "password-changed", // SCREEN_PASSWORD_CHANGED "supervised-user-creation", // SCREEN_CREATE_SUPERVISED_USER_FLOW
diff --git a/chrome/browser/chromeos/login/oobe_screen.h b/chrome/browser/chromeos/login/oobe_screen.h index 20354bc..3beb845 100644 --- a/chrome/browser/chromeos/login/oobe_screen.h +++ b/chrome/browser/chromeos/login/oobe_screen.h
@@ -28,7 +28,6 @@ SCREEN_KIOSK_AUTOLAUNCH, SCREEN_KIOSK_ENABLE, SCREEN_ERROR_MESSAGE, - SCREEN_USER_IMAGE_PICKER, SCREEN_TPM_ERROR, SCREEN_PASSWORD_CHANGED, SCREEN_CREATE_SUPERVISED_USER_FLOW_DEPRECATED,
diff --git a/chrome/browser/chromeos/login/screens/user_image_screen.cc b/chrome/browser/chromeos/login/screens/user_image_screen.cc deleted file mode 100644 index cae8f03..0000000 --- a/chrome/browser/chromeos/login/screens/user_image_screen.cc +++ /dev/null
@@ -1,354 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/login/screens/user_image_screen.h" - -#include <string> - -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/compiler_specific.h" -#include "base/location.h" -#include "base/logging.h" -#include "base/metrics/histogram_macros.h" -#include "base/threading/thread_task_runner_handle.h" -#include "base/timer/timer.h" -#include "base/values.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" -#include "chrome/browser/chromeos/camera_presence_notifier.h" -#include "chrome/browser/chromeos/login/screen_manager.h" -#include "chrome/browser/chromeos/login/screens/user_image_view.h" -#include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" -#include "chrome/browser/chromeos/login/users/chrome_user_manager.h" -#include "chrome/browser/chromeos/login/users/chrome_user_manager_util.h" -#include "chrome/browser/chromeos/login/users/default_user_image/default_user_images.h" -#include "chrome/browser/chromeos/login/wizard_controller.h" -#include "chrome/browser/chromeos/profiles/profile_helper.h" -#include "chrome/browser/policy/profile_policy_connector.h" -#include "chrome/browser/policy/profile_policy_connector_factory.h" -#include "chrome/browser/profiles/profile.h" -#include "components/policy/core/common/policy_map.h" -#include "components/policy/core/common/policy_namespace.h" -#include "components/policy/core/common/policy_service.h" -#include "components/policy/policy_constants.h" -#include "components/user_manager/user.h" -#include "components/user_manager/user_image/user_image.h" -#include "components/user_manager/user_manager.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "ui/base/webui/web_ui_util.h" -#include "ui/gfx/image/image_skia.h" - -using content::BrowserThread; - -namespace chromeos { - -namespace { - -// Time histogram suffix for profile image download. -const char kProfileDownloadReason[] = "OOBE"; - -// Maximum amount of time to wait for the user image to sync. -// The screen is shown iff sync failed or time limit exceeded. -const int kSyncTimeoutSeconds = 10; - -} // namespace - -UserImageScreen::UserImageScreen(UserImageView* view) - : BaseScreen(OobeScreen::SCREEN_USER_IMAGE_PICKER), view_(view) { - if (view_) { - view_->Bind(this); - view_->SetProfilePictureDataURL(std::string()); - } - user_manager::UserManager::Get()->AddObserver(this); -} - -UserImageScreen::~UserImageScreen() { - user_manager::UserManager::Get()->RemoveObserver(this); - CameraPresenceNotifier::GetInstance()->RemoveObserver(this); - if (view_) - view_->Unbind(); -} - -void UserImageScreen::OnScreenReady() { - is_screen_ready_ = true; - if (!IsWaitingForSync()) - HideCurtain(); -} - -void UserImageScreen::OnPhotoTaken(const std::string& raw_data) { - DCHECK_CURRENTLY_ON(BrowserThread::UI); - user_photo_ = gfx::ImageSkia(); - std::vector<unsigned char> photo_data(raw_data.begin(), raw_data.end()); - user_photo_data_ = base::RefCountedBytes::TakeVector(&photo_data); - ImageDecoder::Cancel(this); - ImageDecoder::Start(this, raw_data); -} - -void UserImageScreen::OnImageSelected(const std::string& image_type, - const std::string& image_url, - bool is_user_selection) { - if (is_user_selection) - user_has_selected_image_ = true; - - if (image_type == "default") { - int user_image_index = user_manager::User::USER_IMAGE_INVALID; - if (image_url.empty() || - !default_user_image::IsDefaultImageUrl(image_url, &user_image_index)) { - LOG(ERROR) << "Unexpected default image url: " << image_url; - return; - } - selected_image_ = user_image_index; - } else if (image_type == "camera" || image_type == "old") { - selected_image_ = user_manager::User::USER_IMAGE_EXTERNAL; - } else if (image_type == "profile") { - selected_image_ = user_manager::User::USER_IMAGE_PROFILE; - } else { - NOTREACHED() << "Unexpected image type: " << image_type; - } -} - -void UserImageScreen::OnImageAccepted() { - UserImageManager* image_manager = GetUserImageManager(); - int uma_index = 0; - switch (selected_image_) { - case user_manager::User::USER_IMAGE_EXTERNAL: { - // Photo decoding may not have been finished yet. - if (user_photo_.isNull()) { - accept_photo_after_decoding_ = true; - return; - } - std::unique_ptr<user_manager::UserImage> user_image = - std::make_unique<user_manager::UserImage>( - user_photo_, user_photo_data_.get(), - user_manager::UserImage::FORMAT_PNG); - user_image->MarkAsSafe(); - image_manager->SaveUserImage(std::move(user_image)); - uma_index = default_user_image::kHistogramImageFromCamera; - } break; - case user_manager::User::USER_IMAGE_PROFILE: - image_manager->SaveUserImageFromProfileImage(); - uma_index = default_user_image::kHistogramImageFromProfile; - break; - default: - DCHECK(default_user_image::IsValidIndex(selected_image_)); - image_manager->SaveUserDefaultImageIndex(selected_image_); - uma_index = - default_user_image::GetDefaultImageHistogramValue(selected_image_); - break; - } - if (user_has_selected_image_) { - UMA_HISTOGRAM_EXACT_LINEAR("UserImage.FirstTimeChoice", uma_index, - default_user_image::kHistogramImagesCount); - } - ExitScreen(); -} - -void UserImageScreen::OnViewDestroyed(UserImageView* view) { - if (view_ == view) - view_ = nullptr; -} - -void UserImageScreen::Show() { - if (!view_) - return; - - if (chrome_user_manager_util::IsPublicSessionOrEphemeralLogin()) { - ExitScreen(); - return; - } - DCHECK(!policy_registrar_); - if (Profile* profile = ProfileHelper::Get()->GetProfileByUser(GetUser())) { - policy::PolicyService* policy_service = - policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) - ->policy_service(); - if (policy_service - ->GetPolicies(policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, - std::string())) - .Get(policy::key::kUserAvatarImage)) { - // If the user image is managed by policy, skip the screen because the - // user is not allowed to override a policy-set image. - ExitScreen(); - return; - } - - // Listen for policy changes. If at any point, the user image becomes - // managed by policy, the screen will close. - policy_registrar_.reset(new policy::PolicyChangeRegistrar( - policy_service, - policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string()))); - policy_registrar_->Observe( - policy::key::kUserAvatarImage, - base::Bind(&UserImageScreen::OnUserImagePolicyChanged, - base::Unretained(this))); - } else { - NOTREACHED(); - } - - // If we have a synced image then we will exit this screen, so do not check - // for a synced image if we are force showing the screen for testing. - if (!ForceShowOobeScreen(OobeScreen::SCREEN_USER_IMAGE_PICKER) && - GetUser()->CanSyncImage()) { - if (UserImageSyncObserver* sync_observer = GetSyncObserver()) { - sync_waiting_start_time_ = base::Time::Now(); - // We have synced image already. - if (sync_observer->is_synced()) { - ReportSyncResult(SyncResult::SUCCEEDED); - ExitScreen(); - return; - } - sync_observer->AddObserver(this); - sync_timer_.reset(new base::OneShotTimer()); - sync_timer_->Start( - FROM_HERE, base::TimeDelta::FromSeconds(kSyncTimeoutSeconds), - base::Bind(&UserImageScreen::OnSyncTimeout, base::Unretained(this))); - } - } - CameraPresenceNotifier::GetInstance()->AddObserver(this); - view_->Show(); - - selected_image_ = GetUser()->image_index(); - - view_->SetSelectedImageIndex(selected_image_); - view_->SetSelectedImageURL( - default_user_image::GetDefaultImageUrl(selected_image_)); - - const user_manager::User* user = GetUser(); - // Active Directory accounts do not use a profile image so skip the download - // and inform the UI that no profile image exists. - if (user && user->IsActiveDirectoryUser()) { - view_->SetIsProfilePictureAvailable(false); - } else { - // Start fetching the profile image. - GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason); - } -} - -void UserImageScreen::Hide() { - CameraPresenceNotifier::GetInstance()->RemoveObserver(this); - user_manager::UserManager::Get()->RemoveObserver(this); - policy_registrar_.reset(); - sync_timer_.reset(); - if (UserImageSyncObserver* sync_observer = GetSyncObserver()) - sync_observer->RemoveObserver(this); - if (view_) - view_->Hide(); -} - -void UserImageScreen::OnCameraPresenceCheckDone(bool is_camera_present) { - if (view_) - view_->SetIsCameraPresent(is_camera_present); -} - -void UserImageScreen::OnImageDecoded(const SkBitmap& decoded_image) { - user_photo_ = gfx::ImageSkia::CreateFrom1xBitmap(decoded_image); - if (accept_photo_after_decoding_) - OnImageAccepted(); -} - -void UserImageScreen::OnDecodeImageFailed() { - NOTREACHED() << "Failed to decode PNG image from WebUI"; -} - -void UserImageScreen::OnUserImageChanged(const user_manager::User& user) { - if (view_) { - view_->SetSelectedImageIndex(GetUser()->image_index()); - view_->SetSelectedImageURL( - default_user_image::GetDefaultImageUrl(GetUser()->image_index())); - } -} - -void UserImageScreen::OnUserProfileImageUpdateFailed( - const user_manager::User& user) { - if (view_) { - // User has a default profile image or fetching profile image has failed. - view_->SetProfilePictureDataURL(std::string()); - } -} - -void UserImageScreen::OnUserProfileImageUpdated( - const user_manager::User& user, - const gfx::ImageSkia& profile_image) { - if (view_) { - // We've got a new profile image. - view_->SetProfilePictureDataURL( - webui::GetBitmapDataUrl(*profile_image.bitmap())); - } -} - -void UserImageScreen::OnInitialSync(bool local_image_updated) { - DCHECK(sync_timer_); - ReportSyncResult(SyncResult::SUCCEEDED); - if (!local_image_updated) { - sync_timer_.reset(); - GetSyncObserver()->RemoveObserver(this); - if (is_screen_ready_) - HideCurtain(); - return; - } - ExitScreen(); -} - -void UserImageScreen::OnSyncTimeout() { - ReportSyncResult(SyncResult::TIMED_OUT); - sync_timer_.reset(); - GetSyncObserver()->RemoveObserver(this); - if (is_screen_ready_) - HideCurtain(); -} - -bool UserImageScreen::IsWaitingForSync() const { - return sync_timer_.get() && sync_timer_->IsRunning(); -} - -void UserImageScreen::OnUserImagePolicyChanged(const base::Value* previous, - const base::Value* current) { - if (current) { - base::ThreadTaskRunnerHandle::Get()->DeleteSoon( - FROM_HERE, policy_registrar_.release()); - ExitScreen(); - } -} - -const user_manager::User* UserImageScreen::GetUser() { - return user_manager::UserManager::Get()->GetActiveUser(); -} - -UserImageManager* UserImageScreen::GetUserImageManager() { - return ChromeUserManager::Get()->GetUserImageManager( - GetUser()->GetAccountId()); -} - -UserImageSyncObserver* UserImageScreen::GetSyncObserver() { - return GetUserImageManager()->GetSyncObserver(); -} - -void UserImageScreen::HideCurtain() { - // Skip user image selection for ephemeral users. - if (user_manager::UserManager::Get()->IsUserNonCryptohomeDataEphemeral( - GetUser()->GetAccountId())) { - ExitScreen(); - } - if (view_) - view_->HideCurtain(); -} - -void UserImageScreen::ExitScreen() { - policy_registrar_.reset(); - sync_timer_.reset(); - if (UserImageSyncObserver* sync_observer = GetSyncObserver()) - sync_observer->RemoveObserver(this); -} - -void UserImageScreen::ReportSyncResult(SyncResult timed_out) const { - base::TimeDelta duration = base::Time::Now() - sync_waiting_start_time_; - UMA_HISTOGRAM_TIMES("Login.NewUserPriorityPrefsSyncTime", duration); - UMA_HISTOGRAM_ENUMERATION("Login.NewUserPriorityPrefsSyncResult", - static_cast<int>(timed_out), - static_cast<int>(SyncResult::COUNT)); -} - -} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screens/user_image_screen.h b/chrome/browser/chromeos/login/screens/user_image_screen.h deleted file mode 100644 index de1b17d6..0000000 --- a/chrome/browser/chromeos/login/screens/user_image_screen.h +++ /dev/null
@@ -1,157 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_ - -#include <memory> - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "base/time/time.h" -#include "chrome/browser/chromeos/camera_presence_notifier.h" -#include "chrome/browser/chromeos/login/screens/base_screen.h" -#include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h" -#include "chrome/browser/image_decoder.h" -#include "components/user_manager/user.h" -#include "components/user_manager/user_manager.h" - -namespace base { -class OneShotTimer; -class Value; -} // namespace base - -namespace policy { -class PolicyChangeRegistrar; -} - -namespace chromeos { - -class UserImageManager; -class UserImageView; - -class UserImageScreen : public BaseScreen, - public CameraPresenceNotifier::Observer, - public ImageDecoder::ImageRequest, - public user_manager::UserManager::Observer, - public UserImageSyncObserver::Observer { - public: - explicit UserImageScreen(UserImageView* view); - ~UserImageScreen() override; - - // Called when the UI ready to be shown. - void OnScreenReady(); - - // Called when the user accepts a photo as their login user image. - void OnPhotoTaken(const std::string& raw_data); - - // Called when some image was selected. |is_user_selection| indicates if - // it was user selection or image was selected programmatically. - void OnImageSelected(const std::string& image_type, - const std::string& image_url, - bool is_user_selection); - - // Called when user accepts currently selected image. - void OnImageAccepted(); - - // Called when |view| is being destroyed. - void OnViewDestroyed(UserImageView* view); - - bool user_selected_image() const { return user_has_selected_image_; } - - private: - // Must be kept synced with |NewUserPriorityPrefsSyncResult| enum from - // histograms.xml. - enum class SyncResult { - SUCCEEDED, - TIMED_OUT, - // Keeps a number of different sync results. Should be the last in the list. - COUNT - }; - - // BaseScreen implementation: - void Show() override; - void Hide() override; - - // CameraPresenceNotifier::Observer implementation: - void OnCameraPresenceCheckDone(bool is_camera_present) override; - - // ImageDecoder::ImageRequest implementation: - void OnImageDecoded(const SkBitmap& decoded_image) override; - void OnDecodeImageFailed() override; - - // user_manager::UserManager::Observer implementation: - void OnUserImageChanged(const user_manager::User& user) override; - void OnUserProfileImageUpdateFailed(const user_manager::User& user) override; - void OnUserProfileImageUpdated(const user_manager::User& user, - const gfx::ImageSkia& profile_image) override; - - // UserImageSyncObserver::Observer implementation: - void OnInitialSync(bool local_image_updated) override; - - // Called when whaiting for sync timed out. - void OnSyncTimeout(); - - bool IsWaitingForSync() const; - - // Called when the policy::key::kUserAvatarImage policy changes while the - // screen is being shown. If the policy is set, closes the screen because the - // user is not allowed to override a policy-set image. - void OnUserImagePolicyChanged(const base::Value* previous, - const base::Value* current); - - // Returns current user. - const user_manager::User* GetUser(); - - // Returns UserImageManager for the current user. - UserImageManager* GetUserImageManager(); - - // Returns UserImageSyncObserver for the current user. - UserImageSyncObserver* GetSyncObserver(); - - // Called when it's decided not to skip the screen. - void HideCurtain(); - - // Closes the screen. - void ExitScreen(); - - // Reports sync duration and result to UMA. - void ReportSyncResult(SyncResult timed_out) const; - - std::unique_ptr<policy::PolicyChangeRegistrar> policy_registrar_; - - UserImageView* view_ = nullptr; - - // Last user photo, if taken. - gfx::ImageSkia user_photo_; - - // Data for |user_photo_|. - scoped_refptr<base::RefCountedBytes> user_photo_data_; - - // If |true|, decoded photo should be immediately accepted (i.e., both - // HandleTakePhoto and HandleImageAccepted have already been called but we're - // still waiting for photo image decoding to finish. - bool accept_photo_after_decoding_ = false; - - // Index of the selected user image. - int selected_image_ = user_manager::User::USER_IMAGE_INVALID; - - // If screen ready to be shown. - bool is_screen_ready_ = false; - - // True if user has explicitly selected some image. - bool user_has_selected_image_ = false; - - // Timer used for waiting for user image sync. - std::unique_ptr<base::OneShotTimer> sync_timer_; - - // The time when we started wait for user image sync. - base::Time sync_waiting_start_time_; - - DISALLOW_COPY_AND_ASSIGN(UserImageScreen); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_SCREEN_H_
diff --git a/chrome/browser/chromeos/login/screens/user_image_view.h b/chrome/browser/chromeos/login/screens/user_image_view.h deleted file mode 100644 index e36221e..0000000 --- a/chrome/browser/chromeos/login/screens/user_image_view.h +++ /dev/null
@@ -1,48 +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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_VIEW_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_VIEW_H_ - -#include "chrome/browser/chromeos/login/oobe_screen.h" - -namespace chromeos { - -class UserImageScreen; - -// Interface for dependency injection between UserImageScreen and its actual -// representation, either views based or WebUI. -class UserImageView { - public: - constexpr static OobeScreen kScreenId = OobeScreen::SCREEN_USER_IMAGE_PICKER; - - virtual ~UserImageView() {} - - virtual void Bind(UserImageScreen* screen) = 0; - - virtual void Unbind() = 0; - - // Shows the contents of the screen. - virtual void Show() = 0; - - // Hides the contents of the screen. - virtual void Hide() = 0; - - // Hides curtain with spinner. - virtual void HideCurtain() = 0; - - virtual void SetIsCameraPresent(bool value) = 0; - - virtual void SetProfilePictureDataURL(const std::string& value) = 0; - - virtual void SetIsProfilePictureAvailable(bool value) = 0; - - virtual void SetSelectedImageIndex(int value) = 0; - - virtual void SetSelectedImageURL(const std::string& value) = 0; -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_USER_IMAGE_VIEW_H_
diff --git a/chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h b/chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h deleted file mode 100644 index 2fa280f4..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h +++ /dev/null
@@ -1,28 +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. - -// WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly -// modified to be compilable outside Skia and suit chromium style. Some comments -// can make no sense. -// TODO(elizavetai): remove this file and reuse the original one in Skia - -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKDIFFPIXELSMETRIC_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKDIFFPIXELSMETRIC_H_ - -#include "chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h" - -/** - * A differ that measures the percentage of different corresponding pixels. If - * the two images are - * not the same size or have no pixels, the result will always be zero. - */ -class SkDifferentPixelsMetric { - public: - virtual bool diff(SkBitmap* baseline, - SkBitmap* test, - const SkImageDiffer::BitmapsToCreate& bitmapsToCreate, - SkImageDiffer::Result* result); -}; - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKDIFFPIXELSMETRIC_H_
diff --git a/chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric_cpu.cpp b/chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric_cpu.cpp deleted file mode 100644 index b77a3bc..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric_cpu.cpp +++ /dev/null
@@ -1,112 +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. - -// WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly -// modified to be compilable outside Skia and suit chromium style. Some comments -// can make no sense. -// TODO(elizavetai): remove this file and reuse the original one in Skia - -#include <stdint.h> - -#include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h" -#include "third_party/skia/include/core/SkBitmap.h" - -bool SkDifferentPixelsMetric::diff( - SkBitmap* baseline, - SkBitmap* test, - const SkImageDiffer::BitmapsToCreate& bitmapsToCreate, - SkImageDiffer::Result* result) { - // Ensure the images are comparable - if (baseline->width() != test->width() || - baseline->height() != test->height() || baseline->width() <= 0 || - baseline->height() <= 0 || baseline->colorType() != test->colorType()) { - DCHECK(baseline->width() == test->width()); - DCHECK(baseline->height() == test->height()); - DCHECK(baseline->width() > 0); - DCHECK(baseline->height() > 0); - DCHECK(baseline->colorType() == test->colorType()); - return false; - } - - int width = baseline->width(); - int height = baseline->height(); - int maxRedDiff = 0; - int maxGreenDiff = 0; - int maxBlueDiff = 0; - - // Prepare any bitmaps we will be filling in - if (bitmapsToCreate.alphaMask) { - result->poiAlphaMask.allocPixels(SkImageInfo::MakeA8(width, height)); - result->poiAlphaMask.eraseARGB(SK_AlphaOPAQUE, 0, 0, 0); - } - if (bitmapsToCreate.rgbDiff) { - result->rgbDiffBitmap.allocPixels(SkImageInfo::Make( - width, height, baseline->colorType(), kPremul_SkAlphaType)); - result->rgbDiffBitmap.eraseARGB(SK_AlphaTRANSPARENT, 0, 0, 0); - } - if (bitmapsToCreate.whiteDiff) { - result->whiteDiffBitmap.allocPixels( - SkImageInfo::MakeN32Premul(width, height)); - result->whiteDiffBitmap.eraseARGB(SK_AlphaOPAQUE, 0, 0, 0); - } - - // Prepare the pixels for comparison - result->poiCount = 0; - for (int y = 0; y < height; y++) { - // Grab a row from each image for easy comparison - // TODO(epoger): The code below already assumes 4 bytes per pixel, so I - // think - // we could just call getAddr32() to save a little time. - // OR, if we want to play it safe, call ComputeBytesPerPixel instead - // of assuming 4 bytes per pixel. - uint32_t* baselineRow = static_cast<uint32_t*>(baseline->getAddr(0, y)); - uint32_t* testRow = static_cast<uint32_t*>(test->getAddr(0, y)); - for (int x = 0; x < width; x++) { - // Compare one pixel at a time so each differing pixel can be noted - // TODO(epoger): This loop looks like a good place to work on performance, - // but we should run the code through a profiler to be sure. - uint32_t baselinePixel = baselineRow[x]; - uint32_t testPixel = testRow[x]; - if (baselinePixel != testPixel) { - result->poiCount++; - - int redDiff = abs(static_cast<int>(SkColorGetR(baselinePixel) - - SkColorGetR(testPixel))); - if (redDiff > maxRedDiff) { - maxRedDiff = redDiff; - } - int greenDiff = abs(static_cast<int>(SkColorGetG(baselinePixel) - - SkColorGetG(testPixel))); - if (greenDiff > maxGreenDiff) { - maxGreenDiff = greenDiff; - } - int blueDiff = abs(static_cast<int>(SkColorGetB(baselinePixel) - - SkColorGetB(testPixel))); - if (blueDiff > maxBlueDiff) { - maxBlueDiff = blueDiff; - } - - if (bitmapsToCreate.alphaMask) { - *result->poiAlphaMask.getAddr8(x, y) = SK_AlphaTRANSPARENT; - } - if (bitmapsToCreate.rgbDiff) { - *result->rgbDiffBitmap.getAddr32(x, y) = - SkColorSetRGB(redDiff, greenDiff, blueDiff); - } - if (bitmapsToCreate.whiteDiff) { - *result->whiteDiffBitmap.getAddr32(x, y) = SK_ColorWHITE; - } - } - } - } - - result->maxRedDiff = maxRedDiff; - result->maxGreenDiff = maxGreenDiff; - result->maxBlueDiff = maxBlueDiff; - - // Calculates the percentage of identical pixels - result->result = 1.0 - ((double)result->poiCount / (width * height)); - - return true; -}
diff --git a/chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.cpp b/chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.cpp deleted file mode 100644 index 94b0f7d..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.cpp +++ /dev/null
@@ -1,23 +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. - -// WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly -// modified to be compilable outside Skia and suit chromium style. Some comments -// can make no sense. -// TODO(elizavetai): remove this file and reuse the original one in Skia - -#include "base/compiler_specific.h" -#include "chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h" - -const double SkImageDiffer::RESULT_CORRECT = 1.0f; -const double SkImageDiffer::RESULT_INCORRECT = 0.0f; - -SkImageDiffer::SkImageDiffer() { -} - -SkImageDiffer::~SkImageDiffer() { -} - -SkImageDiffer::Result::Result() { -} \ No newline at end of file
diff --git a/chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h b/chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h deleted file mode 100644 index 052c6fe8..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h +++ /dev/null
@@ -1,59 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly -// modified to be compilable outside Skia and suit chromium style. Some comments -// can make no sense. -// TODO(elizavetai): remove this file and reuse the original one in Skia - -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKIMAGEDIFFER_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKIMAGEDIFFER_H_ - -#include "base/logging.h" -#include "third_party/skia/include/core/SkBitmap.h" - -/** - * Encapsulates an image difference metric algorithm that can be potentially run - * asynchronously. - */ -class SkImageDiffer { - public: - SkImageDiffer(); - virtual ~SkImageDiffer(); - - static const double RESULT_CORRECT; - static const double RESULT_INCORRECT; - - struct Result { - double result; - int poiCount; - // TODO(djsollen): Figure out a way that the differ can report which of the - // optional fields it has filled in. See http://skbug.com/2712 ('allow - // skpdiff to report different sets of result fields for different - // comparison algorithms') - SkBitmap poiAlphaMask; // optional - SkBitmap rgbDiffBitmap; // optional - SkBitmap whiteDiffBitmap; // optional - int maxRedDiff; // optional - int maxGreenDiff; // optional - int maxBlueDiff; // optional - double timeElapsed; // optional - - Result(); - }; - - // A bitfield indicating which bitmap types we want a differ to create. - // - // TODO(epoger): Remove whiteDiffBitmap, because alphaMask can provide - // the same functionality and more. - // It will be a little bit tricky, because the rebaseline_server client - // and server side code will both need to change to use the alphaMask. - struct BitmapsToCreate { - bool alphaMask; - bool rgbDiff; - bool whiteDiff; - }; -}; - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKIMAGEDIFFER_H_
diff --git a/chrome/browser/chromeos/login/screenshot_testing/SkPMetric.cpp b/chrome/browser/chromeos/login/screenshot_testing/SkPMetric.cpp deleted file mode 100644 index acc684b..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/SkPMetric.cpp +++ /dev/null
@@ -1,481 +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. - -// WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly -// modified to be compilable outside Skia and suit chromium style. Some comments -// can make no sense. -// TODO(elizavetai): remove this file and reuse the original one in Skia - -#include <cmath> -#include <math.h> - -#include "chrome/browser/chromeos/login/screenshot_testing/SkPMetric.h" -#include "chrome/browser/chromeos/login/screenshot_testing/SkPMetricUtil_gen.h" -#include "third_party/skia/include/core/SkBitmap.h" - -struct RGB { - float r, g, b; -}; - -struct LAB { - float l, a, b; -}; - -template <class T> -struct Image2D { - int width; - int height; - T* image; - - Image2D(int w, int h) : width(w), height(h) { - DCHECK(w > 0); - DCHECK(h > 0); - image = new T[w * h]; - } - - ~Image2D() { delete[] image; } - - void readPixel(int x, int y, T* pixel) const { - DCHECK(x >= 0); - DCHECK(y >= 0); - DCHECK(x < width); - DCHECK(y < height); - *pixel = image[y * width + x]; - } - - T* getRow(int y) const { return &image[y * width]; } - - void writePixel(int x, int y, const T& pixel) { - DCHECK(x >= 0); - DCHECK(y >= 0); - DCHECK(x < width); - DCHECK(y < height); - image[y * width + x] = pixel; - } -}; - -typedef Image2D<float> ImageL; -typedef Image2D<RGB> ImageRGB; -typedef Image2D<LAB> ImageLAB; - -template <class T> -struct ImageArray { - int slices; - Image2D<T>** image; - - ImageArray(int w, int h, int s) : slices(s) { - DCHECK(s > 0); - image = new Image2D<T>*[s]; - for (int sliceIndex = 0; sliceIndex < slices; sliceIndex++) { - image[sliceIndex] = new Image2D<T>(w, h); - } - } - - ~ImageArray() { - for (int sliceIndex = 0; sliceIndex < slices; sliceIndex++) { - delete image[sliceIndex]; - } - delete[] image; - } - - Image2D<T>* getLayer(int z) const { - DCHECK(z >= 0); - DCHECK(z < slices); - return image[z]; - } -}; - -typedef ImageArray<float> ImageL3D; - -#define MAT_ROW_MULT(rc, gc, bc) r* rc + g* gc + b* bc - -static void adobergb_to_cielab(float r, float g, float b, LAB* lab) { - // Conversion of Adobe RGB to XYZ taken from from "Adobe RGB (1998) ColorImage - // Encoding" - // URL:http://www.adobe.com/digitalimag/pdfs/AdobeRGB1998.pdf - // Section: 4.3.5.3 - // See Also: http://en.wikipedia.org/wiki/Adobe_rgb - float x = MAT_ROW_MULT(0.57667f, 0.18556f, 0.18823f); - float y = MAT_ROW_MULT(0.29734f, 0.62736f, 0.07529f); - float z = MAT_ROW_MULT(0.02703f, 0.07069f, 0.99134f); - - // The following is the white point in XYZ, so it's simply the row wise - // addition of the above - // matrix. - const float xw = 0.5767f + 0.185556f + 0.188212f; - const float yw = 0.297361f + 0.627355f + 0.0752847f; - const float zw = 0.0270328f + 0.0706879f + 0.991248f; - - // This is the XYZ color point relative to the white point - float f[3] = {x / xw, y / yw, z / zw}; - - // Conversion from XYZ to LAB taken from - // http://en.wikipedia.org/wiki/CIELAB#Forward_transformation - for (int i = 0; i < 3; i++) { - if (f[i] >= 0.008856f) { - f[i] = SkPMetricUtil::get_cube_root(f[i]); - } else { - f[i] = 7.787f * f[i] + 4.0f / 29.0f; - } - } - lab->l = 116.0f * f[1] - 16.0f; - lab->a = 500.0f * (f[0] - f[1]); - lab->b = 200.0f * (f[1] - f[2]); -} - -/// Converts a 8888 bitmap to LAB color space and puts it into the output -static bool bitmap_to_cielab(const SkBitmap* bitmap, ImageLAB* outImageLAB) { - SkBitmap bm8888; - if (bitmap->colorType() != kN32_SkColorType) { - SkImageInfo info8888 = bitmap->info().makeColorType(kN32_SkColorType); - if (!bm8888.tryAllocPixels(info8888) || - !bitmap->readPixels(info8888, bm8888.getPixels(), bm8888.rowBytes(), 0, - 0)) { - return false; - } - bitmap = &bm8888; - } - - int width = bitmap->width(); - int height = bitmap->height(); - DCHECK(outImageLAB->width == width); - DCHECK(outImageLAB->height == height); - - RGB rgb; - LAB lab; - for (int y = 0; y < height; y++) { - unsigned char* row = (unsigned char*)bitmap->getAddr(0, y); - for (int x = 0; x < width; x++) { - // Perform gamma correction which is assumed to be 2.2 - rgb.r = SkPMetricUtil::get_gamma(row[x * 4 + 2]); - rgb.g = SkPMetricUtil::get_gamma(row[x * 4 + 1]); - rgb.b = SkPMetricUtil::get_gamma(row[x * 4 + 0]); - adobergb_to_cielab(rgb.r, rgb.g, rgb.b, &lab); - outImageLAB->writePixel(x, y, lab); - } - } - return true; -} - -// From Barten SPIE 1989 -static float contrast_sensitivity(float cyclesPerDegree, float luminance) { - float a = 440.0f * powf(1.0f + 0.7f / luminance, -0.2f); - float b = 0.3f * powf(1.0f + 100.0f / luminance, 0.15f); - float exp = expf(-b * cyclesPerDegree); - float root = sqrtf(1.0f + 0.06f * expf(b * cyclesPerDegree)); - if (!SkScalarIsFinite(exp) || !SkScalarIsFinite(root)) { - return 0; - } - return a * cyclesPerDegree * exp * root; -} - -#if 0 -// We're keeping these around for reference and in case -// the lookup tables are no longer desired. -// They are no longer called by any code in this file. - -// From Daly 1993 - static float visual_mask(float contrast) { - float x = powf(392.498f * contrast, 0.7f); - x = powf(0.0153f * x, 4.0f); - return powf(1.0f + x, 0.25f); -} - -// From Ward Larson Siggraph 1997 -static float threshold_vs_intensity(float adaptationLuminance) { - float logLum = log10f(adaptationLuminance); - float x; - if (logLum < -3.94f) { - x = -2.86f; - } else if (logLum < -1.44f) { - x = powf(0.405f * logLum + 1.6f, 2.18) - 2.86f; - } else if (logLum < -0.0184f) { - x = logLum - 0.395f; - } else if (logLum < 1.9f) { - x = powf(0.249f * logLum + 0.65f, 2.7f) - 0.72f; - } else { - x = logLum - 1.255f; - } - return powf(10.0f, x); -} - -#endif - -/// Simply takes the L channel from the input and puts it into the output -static void lab_to_l(const ImageLAB* imageLAB, ImageL* outImageL) { - for (int y = 0; y < imageLAB->height; y++) { - for (int x = 0; x < imageLAB->width; x++) { - LAB lab; - imageLAB->readPixel(x, y, &lab); - outImageL->writePixel(x, y, lab.l); - } - } -} - -/// Convolves an image with the given filter in one direction and saves it to -/// the output image -static void convolve(const ImageL* imageL, bool vertical, ImageL* outImageL) { - DCHECK(imageL->width == outImageL->width); - DCHECK(imageL->height == outImageL->height); - - const float matrix[] = {0.05f, 0.25f, 0.4f, 0.25f, 0.05f}; - const int matrixCount = sizeof(matrix) / sizeof(float); - const int radius = matrixCount / 2; - - // Keep track of what rows are being operated on for quick access. - float* rowPtrs[matrixCount]; // Because matrixCount is constant, this won't - // create a VLA - for (int y = radius; y < matrixCount; y++) { - rowPtrs[y] = imageL->getRow(y - radius); - } - float* writeRow = outImageL->getRow(0); - - for (int y = 0; y < imageL->height; y++) { - for (int x = 0; x < imageL->width; x++) { - float lSum = 0.0f; - for (int xx = -radius; xx <= radius; xx++) { - int nx = x; - int ny = y; - - // We mirror at edges so that edge pixels that the filter weighting - // still makes - // sense. - if (vertical) { - ny += xx; - if (ny < 0) { - ny = -ny; - } - if (ny >= imageL->height) { - ny = imageL->height + (imageL->height - ny - 1); - } - } else { - nx += xx; - if (nx < 0) { - nx = -nx; - } - if (nx >= imageL->width) { - nx = imageL->width + (imageL->width - nx - 1); - } - } - - float weight = matrix[xx + radius]; - lSum += rowPtrs[ny - y + radius][nx] * weight; - } - writeRow[x] = lSum; - } - // As we move down, scroll the row pointers down with us - for (int y = 0; y < matrixCount - 1; y++) { - rowPtrs[y] = rowPtrs[y + 1]; - } - rowPtrs[matrixCount - 1] += imageL->width; - writeRow += imageL->width; - } -} - -static double pmetric(const ImageLAB* baselineLAB, - const ImageLAB* testLAB, - int* poiCount) { - DCHECK(baselineLAB); - DCHECK(testLAB); - DCHECK(poiCount); - - int width = baselineLAB->width; - int height = baselineLAB->height; - int maxLevels = 0; - - // Calculates how many levels to make by how many times the image can be - // divided in two - int smallerDimension = width < height ? width : height; - for (; smallerDimension > 1; smallerDimension /= 2) { - maxLevels++; - } - - // We'll be creating new arrays with maxLevels - 2, and ImageL3D requires - // maxLevels > 0, - // so just return failure if we're less than 3. - if (maxLevels <= 2) { - return 0.0; - } - - const float fov = SK_ScalarPI / 180.0f * 45.0f; - float contrastSensitivityMax = contrast_sensitivity(3.248f, 100.0f); - float pixelsPerDegree = - width / (2.0f * tanf(fov * 0.5f) * 180.0f / SK_ScalarPI); - - ImageL3D baselineL(width, height, maxLevels); - ImageL3D testL(width, height, maxLevels); - ImageL scratchImageL(width, height); - float* cyclesPerDegree = new float[maxLevels]; - float* thresholdFactorFrequency = new float[maxLevels - 2]; - float* contrast = new float[maxLevels - 2]; - - lab_to_l(baselineLAB, baselineL.getLayer(0)); - lab_to_l(testLAB, testL.getLayer(0)); - - // Compute cpd - Cycles per degree on the pyramid - cyclesPerDegree[0] = 0.5f * pixelsPerDegree; - for (int levelIndex = 1; levelIndex < maxLevels; levelIndex++) { - cyclesPerDegree[levelIndex] = cyclesPerDegree[levelIndex - 1] * 0.5f; - } - - // Contrast sensitivity is based on image dimensions. Therefore it cannot be - // statically - // generated. - float* contrastSensitivityTable = new float[maxLevels * 1000]; - for (int levelIndex = 0; levelIndex < maxLevels; levelIndex++) { - for (int csLum = 0; csLum < 1000; csLum++) { - contrastSensitivityTable[levelIndex * 1000 + csLum] = - contrast_sensitivity(cyclesPerDegree[levelIndex], - (float)csLum / 10.0f + 1e-5f); - } - } - - // Compute G - The convolved lum for the baseline - for (int levelIndex = 1; levelIndex < maxLevels; levelIndex++) { - convolve(baselineL.getLayer(levelIndex - 1), false, &scratchImageL); - convolve(&scratchImageL, true, baselineL.getLayer(levelIndex)); - } - for (int levelIndex = 1; levelIndex < maxLevels; levelIndex++) { - convolve(testL.getLayer(levelIndex - 1), false, &scratchImageL); - convolve(&scratchImageL, true, testL.getLayer(levelIndex)); - } - - // Compute F_freq - The elevation f - for (int levelIndex = 0; levelIndex < maxLevels - 2; levelIndex++) { - float cpd = cyclesPerDegree[levelIndex]; - thresholdFactorFrequency[levelIndex] = - contrastSensitivityMax / contrast_sensitivity(cpd, 100.0f); - } - - // Calculate F - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - float lBaseline; - float lTest; - baselineL.getLayer(0)->readPixel(x, y, &lBaseline); - testL.getLayer(0)->readPixel(x, y, &lTest); - - float avgLBaseline; - float avgLTest; - baselineL.getLayer(maxLevels - 1)->readPixel(x, y, &avgLBaseline); - testL.getLayer(maxLevels - 1)->readPixel(x, y, &avgLTest); - - float lAdapt = 0.5f * (avgLBaseline + avgLTest); - if (lAdapt < 1e-5f) { - lAdapt = 1e-5f; - } - - float contrastSum = 0.0f; - for (int levelIndex = 0; levelIndex < maxLevels - 2; levelIndex++) { - float baselineL0, baselineL1, baselineL2; - float testL0, testL1, testL2; - baselineL.getLayer(levelIndex + 0)->readPixel(x, y, &baselineL0); - testL.getLayer(levelIndex + 0)->readPixel(x, y, &testL0); - baselineL.getLayer(levelIndex + 1)->readPixel(x, y, &baselineL1); - testL.getLayer(levelIndex + 1)->readPixel(x, y, &testL1); - baselineL.getLayer(levelIndex + 2)->readPixel(x, y, &baselineL2); - testL.getLayer(levelIndex + 2)->readPixel(x, y, &testL2); - - float baselineContrast1 = fabsf(baselineL0 - baselineL1); - float testContrast1 = fabsf(testL0 - testL1); - float numerator = (baselineContrast1 > testContrast1) - ? baselineContrast1 - : testContrast1; - - float baselineContrast2 = fabsf(baselineL2); - float testContrast2 = fabsf(testL2); - float denominator = (baselineContrast2 > testContrast2) - ? baselineContrast2 - : testContrast2; - - // Avoid divides by close to zero - if (denominator < 1e-5f) { - denominator = 1e-5f; - } - contrast[levelIndex] = numerator / denominator; - contrastSum += contrast[levelIndex]; - } - - if (contrastSum < 1e-5f) { - contrastSum = 1e-5f; - } - - float F = 0.0f; - for (int levelIndex = 0; levelIndex < maxLevels - 2; levelIndex++) { - float contrastSensitivity = - contrastSensitivityTable[levelIndex * 1000 + (int)(lAdapt * 10.0)]; - float mask = SkPMetricUtil::get_visual_mask(contrast[levelIndex] * - contrastSensitivity); - - F += contrast[levelIndex] + - thresholdFactorFrequency[levelIndex] * mask / contrastSum; - } - - if (F < 1.0f) { - F = 1.0f; - } - - if (F > 10.0f) { - F = 10.0f; - } - - bool isFailure = false; - if (fabsf(lBaseline - lTest) > - F * SkPMetricUtil::get_threshold_vs_intensity(lAdapt)) { - isFailure = true; - } else { - LAB baselineColor; - LAB testColor; - baselineLAB->readPixel(x, y, &baselineColor); - testLAB->readPixel(x, y, &testColor); - float contrastA = baselineColor.a - testColor.a; - float contrastB = baselineColor.b - testColor.b; - float colorScale = 1.0f; - if (lAdapt < 10.0f) { - colorScale = lAdapt / 10.0f; - } - colorScale *= colorScale; - - if ((contrastA * contrastA + contrastB * contrastB) * colorScale > F) { - isFailure = true; - } - } - - if (isFailure) { - (*poiCount)++; - } - } - } - - delete[] cyclesPerDegree; - delete[] contrast; - delete[] thresholdFactorFrequency; - delete[] contrastSensitivityTable; - return 1.0 - (double)(*poiCount) / (width * height); -} - -bool SkPMetric::diff(SkBitmap* baseline, - SkBitmap* test, - const SkImageDiffer::BitmapsToCreate& bitmapsToCreate, - SkImageDiffer::Result* result) { - // Ensure the images are comparable - if (baseline->width() != test->width() || - baseline->height() != test->height() || baseline->width() <= 0 || - baseline->height() <= 0) { - return false; - } - - ImageLAB baselineLAB(baseline->width(), baseline->height()); - ImageLAB testLAB(baseline->width(), baseline->height()); - - if (!bitmap_to_cielab(baseline, &baselineLAB) || - !bitmap_to_cielab(test, &testLAB)) { - return true; - } - - result->poiCount = 0; - result->result = pmetric(&baselineLAB, &testLAB, &result->poiCount); - - return true; -}
diff --git a/chrome/browser/chromeos/login/screenshot_testing/SkPMetric.h b/chrome/browser/chromeos/login/screenshot_testing/SkPMetric.h deleted file mode 100644 index b89a82b..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/SkPMetric.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. - -// WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly -// modified to be compilable outside Skia and suit chromium style. Some comments -// can make no sense. -// TODO(elizavetai): remove this file and reuse the original one in Skia - -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKPMETRIC_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKPMETRIC_H_ - -#include "chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h" - -/** - * An image differ that uses the pdiff image metric to compare images. - */ - -class SkPMetric { - public: - virtual bool diff(SkBitmap* baseline, - SkBitmap* test, - const SkImageDiffer::BitmapsToCreate& bitmapsToCreate, - SkImageDiffer::Result* result); - - private: - typedef SkImageDiffer INHERITED; -}; - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKPMETRIC_H_
diff --git a/chrome/browser/chromeos/login/screenshot_testing/SkPMetricUtil_gen.h b/chrome/browser/chromeos/login/screenshot_testing/SkPMetricUtil_gen.h deleted file mode 100644 index f1ce6712..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/SkPMetricUtil_gen.h +++ /dev/null
@@ -1,3303 +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. - -// WARNING! This file is copied from third_party/skia/tools/skpdiff and slightly -// modified to be compilable outside Skia and suit chromium style. Some comments -// can make no sense. - -// To regenerate SkPMetricUtil_generated.h, simply run -// ./generate_pmetric_tables.py -// TODO(elizavetai): remove this file and reuse the original one in Skia -#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKPMETRICUTIL_GEN_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKPMETRICUTIL_GEN_H_ -namespace SkPMetricUtil { -static float gCubeRootTable[] = { - 0.0000000000f, 0.0992125657f, 0.1250000000f, 0.1430892803f, 0.1574901312f, - 0.1696511010f, 0.1802811963f, 0.1897868107f, 0.1984251315f, 0.2063704531f, - 0.2137469933f, 0.2206467710f, 0.2271400741f, 0.2332819473f, 0.2391163978f, - 0.2446792276f, 0.2500000000f, 0.2551034439f, 0.2600104779f, 0.2647389740f, - 0.2693043363f, 0.2737199462f, 0.2779975113f, 0.2821473397f, 0.2861785606f, - 0.2900993021f, 0.2939168360f, 0.2976376972f, 0.3012677830f, 0.3048124351f, - 0.3082765093f, 0.3116644345f, 0.3149802625f, 0.3182277106f, 0.3214101988f, - 0.3245308814f, 0.3275926743f, 0.3305982795f, 0.3335502061f, 0.3364507883f, - 0.3393022021f, 0.3421064797f, 0.3448655220f, 0.3475811104f, 0.3502549163f, - 0.3528885108f, 0.3554833725f, 0.3580408947f, 0.3605623926f, 0.3630491083f, - 0.3655022173f, 0.3679228323f, 0.3703120086f, 0.3726707474f, 0.3750000000f, - 0.3773006710f, 0.3795736215f, 0.3818196715f, 0.3840396032f, 0.3862341629f, - 0.3884040632f, 0.3905499856f, 0.3926725815f, 0.3947724749f, 0.3968502630f, - 0.3989065187f, 0.4009417912f, 0.4029566080f, 0.4049514752f, 0.4069268795f, - 0.4088832888f, 0.4108211532f, 0.4127409061f, 0.4146429648f, 0.4165277315f, - 0.4183955938f, 0.4202469258f, 0.4220820885f, 0.4239014304f, 0.4257052880f, - 0.4274939867f, 0.4292678410f, 0.4310271550f, 0.4327722233f, 0.4345033306f, - 0.4362207529f, 0.4379247575f, 0.4396156035f, 0.4412935419f, 0.4429588163f, - 0.4446116631f, 0.4462523114f, 0.4478809839f, 0.4494978968f, 0.4511032600f, - 0.4526972777f, 0.4542801482f, 0.4558520644f, 0.4574132138f, 0.4589637789f, - 0.4605039373f, 0.4620338620f, 0.4635537212f, 0.4650636788f, 0.4665638946f, - 0.4680545242f, 0.4695357193f, 0.4710076277f, 0.4724703937f, 0.4739241579f, - 0.4753690576f, 0.4768052266f, 0.4782327957f, 0.4796518924f, 0.4810626414f, - 0.4824651643f, 0.4838595801f, 0.4852460048f, 0.4866245520f, 0.4879953326f, - 0.4893584551f, 0.4907140257f, 0.4920621479f, 0.4934029233f, 0.4947364512f, - 0.4960628287f, 0.4973821510f, 0.4986945110f, 0.5000000000f, 0.5012987071f, - 0.5025907198f, 0.5038761237f, 0.5051550026f, 0.5064274387f, 0.5076935126f, - 0.5089533031f, 0.5102068877f, 0.5114543423f, 0.5126957412f, 0.5139311574f, - 0.5151606625f, 0.5163843266f, 0.5176022187f, 0.5188144063f, 0.5200209558f, - 0.5212219322f, 0.5224173995f, 0.5236074205f, 0.5247920567f, 0.5259713687f, - 0.5271454158f, 0.5283142565f, 0.5294779480f, 0.5306365468f, 0.5317901081f, - 0.5329386865f, 0.5340823352f, 0.5352211070f, 0.5363550534f, 0.5374842252f, - 0.5386086725f, 0.5397284443f, 0.5408435889f, 0.5419541538f, 0.5430601857f, - 0.5441617307f, 0.5452588339f, 0.5463515399f, 0.5474398925f, 0.5485239347f, - 0.5496037090f, 0.5506792572f, 0.5517506203f, 0.5528178389f, 0.5538809527f, - 0.5549400011f, 0.5559950226f, 0.5570460554f, 0.5580931369f, 0.5591363041f, - 0.5601755933f, 0.5612110404f, 0.5622426807f, 0.5632705489f, 0.5642946794f, - 0.5653151060f, 0.5663318620f, 0.5673449802f, 0.5683544930f, 0.5693604322f, - 0.5703628294f, 0.5713617156f, 0.5723571213f, 0.5733490767f, 0.5743376115f, - 0.5753227552f, 0.5763045365f, 0.5772829841f, 0.5782581261f, 0.5792299904f, - 0.5801986042f, 0.5811639947f, 0.5821261885f, 0.5830852119f, 0.5840410910f, - 0.5849938514f, 0.5859435185f, 0.5868901171f, 0.5878336719f, 0.5887742074f, - 0.5897117475f, 0.5906463161f, 0.5915779364f, 0.5925066317f, 0.5934324248f, - 0.5943553383f, 0.5952753945f, 0.5961926153f, 0.5971070226f, 0.5980186378f, - 0.5989274821f, 0.5998335765f, 0.6007369417f, 0.6016375981f, 0.6025355660f, - 0.6034308654f, 0.6043235159f, 0.6052135371f, 0.6061009482f, 0.6069857684f, - 0.6078680164f, 0.6087477108f, 0.6096248701f, 0.6104995125f, 0.6113716558f, - 0.6122413179f, 0.6131085164f, 0.6139732687f, 0.6148355918f, 0.6156955028f, - 0.6165530186f, 0.6174081556f, 0.6182609304f, 0.6191113592f, 0.6199594580f, - 0.6208052427f, 0.6216487292f, 0.6224899328f, 0.6233288690f, 0.6241655531f, - 0.6250000000f, 0.6258322247f, 0.6266622419f, 0.6274900661f, 0.6283157119f, - 0.6291391935f, 0.6299605249f, 0.6307797203f, 0.6315967934f, 0.6324117579f, - 0.6332246274f, 0.6340354152f, 0.6348441348f, 0.6356507991f, 0.6364554212f, - 0.6372580140f, 0.6380585903f, 0.6388571625f, 0.6396537434f, 0.6404483451f, - 0.6412409800f, 0.6420316602f, 0.6428203977f, 0.6436072043f, 0.6443920919f, - 0.6451750722f, 0.6459561565f, 0.6467353565f, 0.6475126834f, 0.6482881485f, - 0.6490617627f, 0.6498335373f, 0.6506034829f, 0.6513716105f, 0.6521379308f, - 0.6529024543f, 0.6536651915f, 0.6544261528f, 0.6551853486f, 0.6559427889f, - 0.6566984841f, 0.6574524439f, 0.6582046785f, 0.6589551976f, 0.6597040110f, - 0.6604511283f, 0.6611965591f, 0.6619403129f, 0.6626823990f, 0.6634228269f, - 0.6641616057f, 0.6648987446f, 0.6656342527f, 0.6663681389f, 0.6671004122f, - 0.6678310813f, 0.6685601552f, 0.6692876423f, 0.6700135514f, 0.6707378909f, - 0.6714606694f, 0.6721818951f, 0.6729015765f, 0.6736197217f, 0.6743363390f, - 0.6750514364f, 0.6757650220f, 0.6764771037f, 0.6771876894f, 0.6778967869f, - 0.6786044041f, 0.6793105487f, 0.6800152282f, 0.6807184502f, 0.6814202223f, - 0.6821205519f, 0.6828194464f, 0.6835169131f, 0.6842129593f, 0.6849075923f, - 0.6856008191f, 0.6862926468f, 0.6869830825f, 0.6876721332f, 0.6883598058f, - 0.6890461072f, 0.6897310441f, 0.6904146234f, 0.6910968517f, 0.6917777357f, - 0.6924572821f, 0.6931354973f, 0.6938123879f, 0.6944879602f, 0.6951622208f, - 0.6958351760f, 0.6965068319f, 0.6971771950f, 0.6978462715f, 0.6985140673f, - 0.6991805888f, 0.6998458419f, 0.7005098327f, 0.7011725671f, 0.7018340510f, - 0.7024942904f, 0.7031532910f, 0.7038110588f, 0.7044675993f, 0.7051229184f, - 0.7057770217f, 0.7064299147f, 0.7070816032f, 0.7077320927f, 0.7083813885f, - 0.7090294963f, 0.7096764214f, 0.7103221691f, 0.7109667450f, 0.7116101541f, - 0.7122524019f, 0.7128934935f, 0.7135334342f, 0.7141722290f, 0.7148098831f, - 0.7154464016f, 0.7160817895f, 0.7167160518f, 0.7173491935f, 0.7179812196f, - 0.7186121349f, 0.7192419442f, 0.7198706526f, 0.7204982646f, 0.7211247852f, - 0.7217502189f, 0.7223745706f, 0.7229978450f, 0.7236200465f, 0.7242411799f, - 0.7248612497f, 0.7254802605f, 0.7260982167f, 0.7267151229f, 0.7273309834f, - 0.7279458028f, 0.7285595854f, 0.7291723356f, 0.7297840576f, 0.7303947558f, - 0.7310044346f, 0.7316130980f, 0.7322207503f, 0.7328273958f, 0.7334330386f, - 0.7340376827f, 0.7346413324f, 0.7352439917f, 0.7358456646f, 0.7364463552f, - 0.7370460675f, 0.7376448054f, 0.7382425730f, 0.7388393740f, 0.7394352125f, - 0.7400300922f, 0.7406240171f, 0.7412169909f, 0.7418090175f, 0.7424001007f, - 0.7429902441f, 0.7435794515f, 0.7441677266f, 0.7447550732f, 0.7453414947f, - 0.7459269950f, 0.7465115775f, 0.7470952459f, 0.7476780037f, 0.7482598545f, - 0.7488408019f, 0.7494208492f, 0.7500000000f, 0.7505782577f, 0.7511556259f, - 0.7517321078f, 0.7523077069f, 0.7528824265f, 0.7534562700f, 0.7540292408f, - 0.7546013421f, 0.7551725772f, 0.7557429495f, 0.7563124621f, 0.7568811183f, - 0.7574489213f, 0.7580158743f, 0.7585819805f, 0.7591472430f, 0.7597116649f, - 0.7602752494f, 0.7608379997f, 0.7613999186f, 0.7619610094f, 0.7625212750f, - 0.7630807186f, 0.7636393430f, 0.7641971514f, 0.7647541466f, 0.7653103316f, - 0.7658657094f, 0.7664202829f, 0.7669740550f, 0.7675270285f, 0.7680792064f, - 0.7686305915f, 0.7691811867f, 0.7697309947f, 0.7702800185f, 0.7708282607f, - 0.7713757241f, 0.7719224115f, 0.7724683257f, 0.7730134694f, 0.7735578453f, - 0.7741014560f, 0.7746443043f, 0.7751863929f, 0.7757277244f, 0.7762683013f, - 0.7768081265f, 0.7773472024f, 0.7778855317f, 0.7784231168f, 0.7789599605f, - 0.7794960653f, 0.7800314336f, 0.7805660681f, 0.7810999712f, 0.7816331454f, - 0.7821655932f, 0.7826973171f, 0.7832283195f, 0.7837586029f, 0.7842881697f, - 0.7848170223f, 0.7853451631f, 0.7858725945f, 0.7863993189f, 0.7869253387f, - 0.7874506562f, 0.7879752737f, 0.7884991936f, 0.7890224182f, 0.7895449497f, - 0.7900667905f, 0.7905879429f, 0.7911084091f, 0.7916281914f, 0.7921472920f, - 0.7926657132f, 0.7931834571f, 0.7937005260f, 0.7942169220f, 0.7947326475f, - 0.7952477044f, 0.7957620951f, 0.7962758215f, 0.7967888860f, 0.7973012906f, - 0.7978130374f, 0.7983241285f, 0.7988345660f, 0.7993443521f, 0.7998534888f, - 0.8003619781f, 0.8008698221f, 0.8013770229f, 0.8018835825f, 0.8023895029f, - 0.8028947861f, 0.8033994341f, 0.8039034489f, 0.8044068326f, 0.8049095870f, - 0.8054117141f, 0.8059132159f, 0.8064140944f, 0.8069143514f, 0.8074139889f, - 0.8079130088f, 0.8084114130f, 0.8089092034f, 0.8094063819f, 0.8099029503f, - 0.8103989106f, 0.8108942646f, 0.8113890141f, 0.8118831610f, 0.8123767071f, - 0.8128696543f, 0.8133620043f, 0.8138537589f, 0.8143449200f, 0.8148354894f, - 0.8153254688f, 0.8158148599f, 0.8163036646f, 0.8167918846f, 0.8172795217f, - 0.8177665775f, 0.8182530539f, 0.8187389525f, 0.8192242751f, 0.8197090233f, - 0.8201931988f, 0.8206768034f, 0.8211598387f, 0.8216423064f, 0.8221242082f, - 0.8226055457f, 0.8230863205f, 0.8235665343f, 0.8240461888f, 0.8245252855f, - 0.8250038261f, 0.8254818122f, 0.8259592454f, 0.8264361273f, 0.8269124595f, - 0.8273882435f, 0.8278634810f, 0.8283381734f, 0.8288123225f, 0.8292859296f, - 0.8297589964f, 0.8302315244f, 0.8307035152f, 0.8311749701f, 0.8316458909f, - 0.8321162790f, 0.8325861358f, 0.8330554629f, 0.8335242618f, 0.8339925340f, - 0.8344602809f, 0.8349275040f, 0.8353942047f, 0.8358603846f, 0.8363260451f, - 0.8367911876f, 0.8372558136f, 0.8377199244f, 0.8381835216f, 0.8386466065f, - 0.8391091806f, 0.8395712452f, 0.8400328018f, 0.8404938517f, 0.8409543964f, - 0.8414144372f, 0.8418739754f, 0.8423330126f, 0.8427915500f, 0.8432495890f, - 0.8437071309f, 0.8441641771f, 0.8446207289f, 0.8450767877f, 0.8455323548f, - 0.8459874315f, 0.8464420192f, 0.8468961190f, 0.8473497325f, 0.8478028608f, - 0.8482555052f, 0.8487076671f, 0.8491593476f, 0.8496105482f, 0.8500612701f, - 0.8505115145f, 0.8509612827f, 0.8514105760f, 0.8518593955f, 0.8523077427f, - 0.8527556186f, 0.8532030246f, 0.8536499618f, 0.8540964315f, 0.8545424350f, - 0.8549879733f, 0.8554330478f, 0.8558776597f, 0.8563218101f, 0.8567655002f, - 0.8572087313f, 0.8576515045f, 0.8580938210f, 0.8585356819f, 0.8589770885f, - 0.8594180419f, 0.8598585433f, 0.8602985938f, 0.8607381946f, 0.8611773468f, - 0.8616160516f, 0.8620543101f, 0.8624921234f, 0.8629294927f, 0.8633664191f, - 0.8638029038f, 0.8642389477f, 0.8646745521f, 0.8651097180f, 0.8655444466f, - 0.8659787389f, 0.8664125961f, 0.8668460191f, 0.8672790092f, 0.8677115674f, - 0.8681436948f, 0.8685753923f, 0.8690066612f, 0.8694375025f, 0.8698679171f, - 0.8702979063f, 0.8707274710f, 0.8711566122f, 0.8715853311f, 0.8720136286f, - 0.8724415059f, 0.8728689638f, 0.8732960035f, 0.8737226259f, 0.8741488321f, - 0.8745746232f, 0.8750000000f, 0.8754249636f, 0.8758495151f, 0.8762736554f, - 0.8766973854f, 0.8771207063f, 0.8775436190f, 0.8779661244f, 0.8783882235f, - 0.8788099174f, 0.8792312070f, 0.8796520932f, 0.8800725771f, 0.8804926595f, - 0.8809123415f, 0.8813316240f, 0.8817505079f, 0.8821689942f, 0.8825870838f, - 0.8830047777f, 0.8834220768f, 0.8838389821f, 0.8842554944f, 0.8846716147f, - 0.8850873439f, 0.8855026829f, 0.8859176327f, 0.8863321941f, 0.8867463681f, - 0.8871601555f, 0.8875735573f, 0.8879865744f, 0.8883992076f, 0.8888114579f, - 0.8892233261f, 0.8896348131f, 0.8900459199f, 0.8904566472f, 0.8908669959f, - 0.8912769670f, 0.8916865612f, 0.8920957795f, 0.8925046227f, 0.8929130917f, - 0.8933211874f, 0.8937289105f, 0.8941362619f, 0.8945432425f, 0.8949498531f, - 0.8953560946f, 0.8957619678f, 0.8961674735f, 0.8965726125f, 0.8969773858f, - 0.8973817940f, 0.8977858381f, 0.8981895188f, 0.8985928370f, 0.8989957935f, - 0.8993983891f, 0.8998006246f, 0.9002025007f, 0.9006040184f, 0.9010051784f, - 0.9014059814f, 0.9018064284f, 0.9022065200f, 0.9026062571f, 0.9030056405f, - 0.9034046709f, 0.9038033491f, 0.9042016758f, 0.9045996520f, 0.9049972783f, - 0.9053945554f, 0.9057914843f, 0.9061880655f, 0.9065843000f, 0.9069801884f, - 0.9073757315f, 0.9077709300f, 0.9081657847f, 0.9085602964f, 0.9089544658f, - 0.9093482936f, 0.9097417806f, 0.9101349275f, 0.9105277350f, 0.9109202039f, - 0.9113123349f, 0.9117041287f, 0.9120955861f, 0.9124867078f, 0.9128774944f, - 0.9132679468f, 0.9136580655f, 0.9140478514f, 0.9144373052f, 0.9148264275f, - 0.9152152191f, 0.9156036806f, 0.9159918127f, 0.9163796163f, 0.9167670918f, - 0.9171542402f, 0.9175410619f, 0.9179275578f, 0.9183137284f, 0.9186995746f, - 0.9190850969f, 0.9194702961f, 0.9198551727f, 0.9202397276f, 0.9206239614f, - 0.9210078747f, 0.9213914682f, 0.9217747425f, 0.9221576984f, 0.9225403365f, - 0.9229226575f, 0.9233046619f, 0.9236863505f, 0.9240677240f, 0.9244487829f, - 0.9248295279f, 0.9252099596f, 0.9255900788f, 0.9259698860f, 0.9263493819f, - 0.9267285671f, 0.9271074423f, 0.9274860081f, 0.9278642651f, 0.9282422139f, - 0.9286198552f, 0.9289971896f, 0.9293742177f, 0.9297509402f, 0.9301273576f, - 0.9305034706f, 0.9308792798f, 0.9312547858f, 0.9316299892f, 0.9320048907f, - 0.9323794907f, 0.9327537901f, 0.9331277892f, 0.9335014888f, 0.9338748894f, - 0.9342479917f, 0.9346207962f, 0.9349933035f, 0.9353655143f, 0.9357374291f, - 0.9361090484f, 0.9364803729f, 0.9368514032f, 0.9372221399f, 0.9375925834f, - 0.9379627345f, 0.9383325937f, 0.9387021615f, 0.9390714386f, 0.9394404254f, - 0.9398091226f, 0.9401775308f, 0.9405456505f, 0.9409134822f, 0.9412810266f, - 0.9416482841f, 0.9420152554f, 0.9423819410f, 0.9427483415f, 0.9431144574f, - 0.9434802893f, 0.9438458377f, 0.9442111031f, 0.9445760862f, 0.9449407874f, - 0.9453052074f, 0.9456693465f, 0.9460332055f, 0.9463967848f, 0.9467600849f, - 0.9471231065f, 0.9474858499f, 0.9478483159f, 0.9482105048f, 0.9485724172f, - 0.9489340537f, 0.9492954148f, 0.9496565009f, 0.9500173127f, 0.9503778506f, - 0.9507381152f, 0.9510981069f, 0.9514578264f, 0.9518172740f, 0.9521764504f, - 0.9525353560f, 0.9528939913f, 0.9532523569f, 0.9536104532f, 0.9539682808f, - 0.9543258402f, 0.9546831318f, 0.9550401562f, 0.9553969139f, 0.9557534053f, - 0.9561096310f, 0.9564655914f, 0.9568212871f, 0.9571767185f, 0.9575318861f, - 0.9578867905f, 0.9582414321f, 0.9585958113f, 0.9589499288f, 0.9593037849f, - 0.9596573801f, 0.9600107149f, 0.9603637899f, 0.9607166054f, 0.9610691620f, - 0.9614214601f, 0.9617735002f, 0.9621252828f, 0.9624768083f, 0.9628280773f, - 0.9631790901f, 0.9635298473f, 0.9638803492f, 0.9642305965f, 0.9645805895f, - 0.9649303287f, 0.9652798145f, 0.9656290475f, 0.9659780280f, 0.9663267566f, - 0.9666752336f, 0.9670234596f, 0.9673714350f, 0.9677191602f, 0.9680666356f, - 0.9684138619f, 0.9687608393f, 0.9691075683f, 0.9694540494f, 0.9698002830f, - 0.9701462696f, 0.9704920096f, 0.9708375034f, 0.9711827515f, 0.9715277542f, - 0.9718725122f, 0.9722170257f, 0.9725612952f, 0.9729053211f, 0.9732491040f, - 0.9735926441f, 0.9739359420f, 0.9742789980f, 0.9746218126f, 0.9749643862f, - 0.9753067192f, 0.9756488121f, 0.9759906652f, 0.9763322791f, 0.9766736540f, - 0.9770147905f, 0.9773556889f, 0.9776963497f, 0.9780367732f, 0.9783769600f, - 0.9787169103f, 0.9790566246f, 0.9793961034f, 0.9797353469f, 0.9800743557f, - 0.9804131302f, 0.9807516706f, 0.9810899776f, 0.9814280513f, 0.9817658923f, - 0.9821035010f, 0.9824408777f, 0.9827780228f, 0.9831149368f, 0.9834516200f, - 0.9837880729f, 0.9841242958f, 0.9844602891f, 0.9847960532f, 0.9851315885f, - 0.9854668954f, 0.9858019743f, 0.9861368255f, 0.9864714495f, 0.9868058466f, - 0.9871400173f, 0.9874739618f, 0.9878076807f, 0.9881411742f, 0.9884744427f, - 0.9888074867f, 0.9891403065f, 0.9894729024f, 0.9898052749f, 0.9901374244f, - 0.9904693511f, 0.9908010556f, 0.9911325380f, 0.9914637989f, 0.9917948386f, - 0.9921256575f, 0.9924562559f, 0.9927866341f, 0.9931167927f, 0.9934467318f, - 0.9937764520f, 0.9941059535f, 0.9944352367f, 0.9947643020f, 0.9950931497f, - 0.9954217802f, 0.9957501939f, 0.9960783911f, 0.9964063721f, 0.9967341374f, - 0.9970616873f, 0.9973890221f, 0.9977161421f, 0.9980430478f, 0.9983697395f, - 0.9986962176f, 0.9990224823f, 0.9993485340f, 0.9996743731f, -}; -static float get_cube_root(float value) { - DCHECK(value >= 0.0f); - DCHECK(value * 1023.0f < 1024.0f); - return gCubeRootTable[(int)(value * 1023.0f)]; -} - -static float gGammaTable[] = { - 0.0000000000f, 0.0000050771f, 0.0000233280f, 0.0000569218f, 0.0001071874f, - 0.0001751240f, 0.0002615438f, 0.0003671363f, 0.0004925038f, 0.0006381828f, - 0.0008046585f, 0.0009923743f, 0.0012017395f, 0.0014331346f, 0.0016869153f, - 0.0019634162f, 0.0022629532f, 0.0025858256f, 0.0029323183f, 0.0033027030f, - 0.0036972396f, 0.0041161771f, 0.0045597549f, 0.0050282035f, 0.0055217449f, - 0.0060405937f, 0.0065849574f, 0.0071550370f, 0.0077510274f, 0.0083731177f, - 0.0090214919f, 0.0096963287f, 0.0103978023f, 0.0111260824f, 0.0118813344f, - 0.0126637200f, 0.0134733969f, 0.0143105194f, 0.0151752382f, 0.0160677009f, - 0.0169880521f, 0.0179364333f, 0.0189129834f, 0.0199178384f, 0.0209511319f, - 0.0220129949f, 0.0231035562f, 0.0242229421f, 0.0253712769f, 0.0265486828f, - 0.0277552800f, 0.0289911865f, 0.0302565189f, 0.0315513914f, 0.0328759169f, - 0.0342302066f, 0.0356143697f, 0.0370285142f, 0.0384727463f, 0.0399471710f, - 0.0414518916f, 0.0429870102f, 0.0445526273f, 0.0461488424f, 0.0477757536f, - 0.0494334576f, 0.0511220501f, 0.0528416255f, 0.0545922773f, 0.0563740976f, - 0.0581871775f, 0.0600316071f, 0.0619074756f, 0.0638148709f, 0.0657538803f, - 0.0677245897f, 0.0697270844f, 0.0717614488f, 0.0738277663f, 0.0759261195f, - 0.0780565900f, 0.0802192587f, 0.0824142059f, 0.0846415107f, 0.0869012518f, - 0.0891935069f, 0.0915183530f, 0.0938758665f, 0.0962661231f, 0.0986891975f, - 0.1011451642f, 0.1036340967f, 0.1061560678f, 0.1087111500f, 0.1112994148f, - 0.1139209334f, 0.1165757762f, 0.1192640130f, 0.1219857132f, 0.1247409454f, - 0.1275297778f, 0.1303522781f, 0.1332085132f, 0.1360985497f, 0.1390224537f, - 0.1419802907f, 0.1449721256f, 0.1479980230f, 0.1510580469f, 0.1541522608f, - 0.1572807279f, 0.1604435107f, 0.1636406715f, 0.1668722719f, 0.1701383732f, - 0.1734390363f, 0.1767743216f, 0.1801442892f, 0.1835489985f, 0.1869885088f, - 0.1904628788f, 0.1939721670f, 0.1975164314f, 0.2010957296f, 0.2047101188f, - 0.2083596560f, 0.2120443975f, 0.2157643996f, 0.2195197181f, 0.2233104083f, - 0.2271365255f, 0.2309981243f, 0.2348952592f, 0.2388279843f, 0.2427963533f, - 0.2468004196f, 0.2508402364f, 0.2549158566f, 0.2590273325f, 0.2631747164f, - 0.2673580602f, 0.2715774154f, 0.2758328335f, 0.2801243653f, 0.2844520616f, - 0.2888159728f, 0.2932161491f, 0.2976526404f, 0.3021254964f, 0.3066347662f, - 0.3111804991f, 0.3157627437f, 0.3203815488f, 0.3250369625f, 0.3297290330f, - 0.3344578079f, 0.3392233349f, 0.3440256613f, 0.3488648341f, 0.3537409001f, - 0.3586539059f, 0.3636038979f, 0.3685909222f, 0.3736150246f, 0.3786762509f, - 0.3837746465f, 0.3889102565f, 0.3940831261f, 0.3992932999f, 0.4045408226f, - 0.4098257384f, 0.4151480917f, 0.4205079262f, 0.4259052857f, 0.4313402138f, - 0.4368127538f, 0.4423229488f, 0.4478708418f, 0.4534564755f, 0.4590798924f, - 0.4647411350f, 0.4704402453f, 0.4761772654f, 0.4819522371f, 0.4877652019f, - 0.4936162013f, 0.4995052766f, 0.5054324688f, 0.5113978189f, 0.5174013675f, - 0.5234431552f, 0.5295232224f, 0.5356416093f, 0.5417983560f, 0.5479935022f, - 0.5542270878f, 0.5604991522f, 0.5668097349f, 0.5731588751f, 0.5795466118f, - 0.5859729839f, 0.5924380303f, 0.5989417895f, 0.6054842999f, 0.6120655999f, - 0.6186857275f, 0.6253447208f, 0.6320426176f, 0.6387794557f, 0.6455552724f, - 0.6523701054f, 0.6592239918f, 0.6661169688f, 0.6730490733f, 0.6800203422f, - 0.6870308122f, 0.6940805198f, 0.7011695015f, 0.7082977937f, 0.7154654323f, - 0.7226724536f, 0.7299188934f, 0.7372047874f, 0.7445301713f, 0.7518950806f, - 0.7592995507f, 0.7667436169f, 0.7742273142f, 0.7817506778f, 0.7893137424f, - 0.7969165429f, 0.8045591139f, 0.8122414899f, 0.8199637053f, 0.8277257945f, - 0.8355277915f, 0.8433697304f, 0.8512516452f, 0.8591735697f, 0.8671355375f, - 0.8751375824f, 0.8831797377f, 0.8912620368f, 0.8993845130f, 0.9075471995f, - 0.9157501293f, 0.9239933353f, 0.9322768503f, 0.9406007070f, 0.9489649382f, - 0.9573695762f, 0.9658146535f, 0.9743002024f, 0.9828262551f, 0.9913928436f, - 1.0000000000f, -}; -static float get_gamma(unsigned char value) { - return gGammaTable[value]; -} - -static float gTVITable[] = { - 0.0013803843f, 0.0054723435f, 0.0090762146f, 0.0127002285f, 0.0161086814f, - 0.0201358517f, 0.0241630221f, 0.0281901924f, 0.0322173627f, 0.0362445331f, - 0.0402717034f, 0.0442988738f, 0.0483260441f, 0.0523532145f, 0.0563803848f, - 0.0604075551f, 0.0644347255f, 0.0684618958f, 0.0724890662f, 0.0765162365f, - 0.0805434069f, 0.0845705772f, 0.0885977476f, 0.0926249179f, 0.0966520882f, - 0.1006792586f, 0.1047064289f, 0.1087335993f, 0.1127607696f, 0.1167879400f, - 0.1208151103f, 0.1248422806f, 0.1288694510f, 0.1328966213f, 0.1369237917f, - 0.1409509620f, 0.1449781324f, 0.1490053027f, 0.1530324730f, 0.1570596434f, - 0.1610868137f, 0.1651139841f, 0.1691411544f, 0.1731683248f, 0.1771954951f, - 0.1812226654f, 0.1852498358f, 0.1892770061f, 0.1933041765f, 0.1973313468f, - 0.2013585172f, 0.2053856875f, 0.2094128578f, 0.2134400282f, 0.2174671985f, - 0.2214943689f, 0.2255215392f, 0.2295487096f, 0.2335758799f, 0.2376030503f, - 0.2416302206f, 0.2456573909f, 0.2496845613f, 0.2537117316f, 0.2577389020f, - 0.2617660723f, 0.2657932427f, 0.2698204130f, 0.2738475833f, 0.2778747537f, - 0.2819019240f, 0.2859290944f, 0.2899562647f, 0.2939834351f, 0.2980106054f, - 0.3020377757f, 0.3060649461f, 0.3100921164f, 0.3141192868f, 0.3181464571f, - 0.3221736275f, 0.3262007978f, 0.3302279681f, 0.3342551385f, 0.3382823088f, - 0.3423094792f, 0.3463366495f, 0.3503638199f, 0.3543909902f, 0.3584181605f, - 0.3624453309f, 0.3664725012f, 0.3704996716f, 0.3745268419f, 0.3785540123f, - 0.3825811826f, 0.3862015808f, 0.3874843130f, 0.3887618285f, 0.3900342072f, - 0.3913015271f, 0.3925638643f, 0.3938212928f, 0.3950738850f, 0.3963217116f, - 0.3975648414f, 0.3988033417f, 0.4000372783f, 0.4012667154f, 0.4024917157f, - 0.4037123404f, 0.4049286496f, 0.4061407017f, 0.4073485541f, 0.4085522627f, - 0.4097518824f, 0.4109474667f, 0.4121390682f, 0.4133267382f, 0.4145105269f, - 0.4156904836f, 0.4168666565f, 0.4180390927f, 0.4192078385f, 0.4203729393f, - 0.4215344394f, 0.4226923823f, 0.4238468107f, 0.4249977665f, 0.4261452906f, - 0.4272894232f, 0.4284302038f, 0.4295676711f, 0.4307018630f, 0.4318328169f, - 0.4329605692f, 0.4340851559f, 0.4352066122f, 0.4363249726f, 0.4374402712f, - 0.4385525412f, 0.4396618156f, 0.4407681264f, 0.4418715052f, 0.4429719831f, - 0.4440695907f, 0.4451643580f, 0.4462563143f, 0.4473454889f, 0.4484319100f, - 0.4495156058f, 0.4505966038f, 0.4516749311f, 0.4527506143f, 0.4538236798f, - 0.4548941532f, 0.4559620600f, 0.4570274252f, 0.4580902732f, 0.4591506283f, - 0.4602085144f, 0.4612639548f, 0.4623169726f, 0.4633675905f, 0.4644158309f, - 0.4654617159f, 0.4665052671f, 0.4675465059f, 0.4685854533f, 0.4696221301f, - 0.4706565566f, 0.4716887532f, 0.4727187394f, 0.4737465350f, 0.4747721591f, - 0.4757956308f, 0.4768169688f, 0.4778361914f, 0.4788533170f, 0.4798683633f, - 0.4808813482f, 0.4818922891f, 0.4829012030f, 0.4839081071f, 0.4849130180f, - 0.4859159522f, 0.4869169260f, 0.4879159554f, 0.4889130563f, 0.4899082444f, - 0.4909015350f, 0.4918929433f, 0.4928824844f, 0.4938701732f, 0.4948560241f, - 0.4958400518f, 0.4968222703f, 0.4978026939f, 0.4987813364f, 0.4997582115f, - 0.5007333328f, 0.5017067136f, 0.5026783672f, 0.5036483066f, 0.5046165447f, - 0.5055830942f, 0.5065479677f, 0.5075111777f, 0.5084727363f, 0.5094326557f, - 0.5103909478f, 0.5113476246f, 0.5123026977f, 0.5132561786f, 0.5142080788f, - 0.5151584096f, 0.5161071821f, 0.5170544073f, 0.5180000961f, 0.5189442593f, - 0.5198869076f, 0.5208280514f, 0.5217677012f, 0.5227058673f, 0.5236425598f, - 0.5245777888f, 0.5255115642f, 0.5264438959f, 0.5273747936f, 0.5283042669f, - 0.5292323254f, 0.5301589784f, 0.5310842352f, 0.5320081051f, 0.5329305972f, - 0.5338517205f, 0.5347714839f, 0.5356898962f, 0.5366069661f, 0.5375227023f, - 0.5384371133f, 0.5393502076f, 0.5402619936f, 0.5411724795f, 0.5420816735f, - 0.5429895837f, 0.5438962181f, 0.5448015848f, 0.5457056915f, 0.5466085461f, - 0.5475101562f, 0.5484105295f, 0.5493096736f, 0.5502075958f, 0.5511043036f, - 0.5519998044f, 0.5528941054f, 0.5537872138f, 0.5546791367f, 0.5555698811f, - 0.5564594540f, 0.5573478624f, 0.5582351130f, 0.5591212127f, 0.5600061681f, - 0.5608899860f, 0.5617726729f, 0.5626542353f, 0.5635346797f, 0.5644140125f, - 0.5652922401f, 0.5661693686f, 0.5670454044f, 0.5679203536f, 0.5687942223f, - 0.5696670167f, 0.5705387425f, 0.5714094060f, 0.5722790128f, 0.5731475689f, - 0.5740150800f, 0.5748815519f, 0.5757469902f, 0.5766114006f, 0.5774747887f, - 0.5783371600f, 0.5791985199f, 0.5800588740f, 0.5809182275f, 0.5817765859f, - 0.5826339544f, 0.5834903383f, 0.5843457428f, 0.5852001731f, 0.5860536342f, - 0.5869061312f, 0.5877576691f, 0.5886082530f, 0.5894578877f, 0.5903065783f, - 0.5911543294f, 0.5920011460f, 0.5928470329f, 0.5936919946f, 0.5945360361f, - 0.5953791619f, 0.5962213766f, 0.5970626848f, 0.5979030911f, 0.5987426000f, - 0.5995812159f, 0.6004189433f, 0.6012557866f, 0.6020917502f, 0.6029268383f, - 0.6037610553f, 0.6045944054f, 0.6054268928f, 0.6062585218f, 0.6070892966f, - 0.6079192211f, 0.6087482996f, 0.6095765360f, 0.6104039345f, 0.6112304990f, - 0.6120562334f, 0.6128811418f, 0.6137052280f, 0.6145284960f, 0.6153509494f, - 0.6161725922f, 0.6169934282f, 0.6178134611f, 0.6186326946f, 0.6194511325f, - 0.6202687784f, 0.6210856359f, 0.6219017088f, 0.6227170005f, 0.6235315147f, - 0.6243452548f, 0.6251582244f, 0.6259704271f, 0.6267818661f, 0.6275925450f, - 0.6284024673f, 0.6292116362f, 0.6300200551f, 0.6308277274f, 0.6316346564f, - 0.6324408454f, 0.6332462976f, 0.6340510163f, 0.6348550047f, 0.6356582660f, - 0.6364608033f, 0.6372626199f, 0.6380637188f, 0.6388641032f, 0.6396637761f, - 0.6404627406f, 0.6412609997f, 0.6420585565f, 0.6428554140f, 0.6436515750f, - 0.6444470427f, 0.6452418199f, 0.6460359096f, 0.6468293146f, 0.6476220378f, - 0.6484140821f, 0.6492054503f, 0.6499961452f, 0.6507861697f, 0.6515755264f, - 0.6523642183f, 0.6531522479f, 0.6539396181f, 0.6547263316f, 0.6555123910f, - 0.6562977990f, 0.6570825582f, 0.6578666713f, 0.6586501410f, 0.6594329698f, - 0.6602151602f, 0.6609967149f, 0.6617776365f, 0.6625579273f, 0.6633375901f, - 0.6641166272f, 0.6648950411f, 0.6656728344f, 0.6664500094f, 0.6672265686f, - 0.6680025145f, 0.6687778494f, 0.6695525757f, 0.6703266958f, 0.6711002120f, - 0.6718731268f, 0.6726454424f, 0.6734171611f, 0.6741882853f, 0.6749588172f, - 0.6757287592f, 0.6764981134f, 0.6772668821f, 0.6780350675f, 0.6788026719f, - 0.6795696975f, 0.6803361464f, 0.6811020209f, 0.6818673230f, 0.6826320549f, - 0.6833962189f, 0.6841598169f, 0.6849228512f, 0.6856853237f, 0.6864472367f, - 0.6872085921f, 0.6879693920f, 0.6887296385f, 0.6894893336f, 0.6902484794f, - 0.6910070778f, 0.6917651308f, 0.6925226404f, 0.6932796087f, 0.6940360375f, - 0.6947919289f, 0.6955472847f, 0.6963021069f, 0.6970563974f, 0.6978101581f, - 0.6985633910f, 0.6993160978f, 0.7000682805f, 0.7008199410f, 0.7015710810f, - 0.7023217025f, 0.7030718072f, 0.7038213970f, 0.7045704738f, 0.7053190392f, - 0.7060670951f, 0.7068146432f, 0.7075616854f, 0.7083082234f, 0.7090542590f, - 0.7097997938f, 0.7105448296f, 0.7112893682f, 0.7120334112f, 0.7127769604f, - 0.7135200174f, 0.7142625840f, 0.7150046617f, 0.7157462523f, 0.7164873574f, - 0.7172279787f, 0.7179681178f, 0.7187077763f, 0.7194469559f, 0.7201856581f, - 0.7209238845f, 0.7216616368f, 0.7223989166f, 0.7231357254f, 0.7238720647f, - 0.7246079362f, 0.7253433413f, 0.7260782817f, 0.7268127589f, 0.7275467743f, - 0.7282803296f, 0.7290134261f, 0.7297460655f, 0.7304782492f, 0.7312099786f, - 0.7319412554f, 0.7326720809f, 0.7334024566f, 0.7341323839f, 0.7348618644f, - 0.7355908994f, 0.7363194903f, 0.7370476387f, 0.7377753459f, 0.7385026133f, - 0.7392294424f, 0.7399558344f, 0.7406817909f, 0.7414073132f, 0.7421324026f, - 0.7428570606f, 0.7435812885f, 0.7443050876f, 0.7450284593f, 0.7457514049f, - 0.7464739258f, 0.7471960233f, 0.7479176987f, 0.7486389533f, 0.7493597885f, - 0.7500802055f, 0.7508002056f, 0.7515197900f, 0.7522389602f, 0.7529577174f, - 0.7536760627f, 0.7543939976f, 0.7551115232f, 0.7558286407f, 0.7565453515f, - 0.7572616568f, 0.7579775578f, 0.7586930557f, 0.7594081517f, 0.7601228471f, - 0.7608371430f, 0.7615510407f, 0.7622645414f, 0.7629776462f, 0.7636903563f, - 0.7644026729f, 0.7651145972f, 0.7658261304f, 0.7665372735f, 0.7672480278f, - 0.7679583944f, 0.7686683744f, 0.7693779691f, 0.7700871794f, 0.7707960066f, - 0.7715044518f, 0.7722125160f, 0.7729202005f, 0.7736275063f, 0.7743344344f, - 0.7750409861f, 0.7757471624f, 0.7764529643f, 0.7771583930f, 0.7778634496f, - 0.7785681350f, 0.7792724504f, 0.7799763969f, 0.7806799755f, 0.7813831871f, - 0.7820860330f, 0.7827885141f, 0.7834906315f, 0.7841923862f, 0.7848937792f, - 0.7855948115f, 0.7862954843f, 0.7869957984f, 0.7876957549f, 0.7883953547f, - 0.7890945990f, 0.7897934887f, 0.7904920247f, 0.7911902081f, 0.7918880398f, - 0.7925855209f, 0.7932826523f, 0.7939794349f, 0.7946758698f, 0.7953719578f, - 0.7960677000f, 0.7967630973f, 0.7974581506f, 0.7981528610f, 0.7988472292f, - 0.7995412563f, 0.8002349432f, 0.8009282908f, 0.8016213001f, 0.8023139719f, - 0.8030063072f, 0.8036983069f, 0.8043899718f, 0.8050813030f, 0.8057723013f, - 0.8064629675f, 0.8071533026f, 0.8078433075f, 0.8085329830f, 0.8092223301f, - 0.8099113495f, 0.8106000423f, 0.8112884091f, 0.8119764510f, 0.8126641688f, - 0.8133515632f, 0.8140386353f, 0.8147253858f, 0.8154118155f, 0.8160979254f, - 0.8167837163f, 0.8174691889f, 0.8181543441f, 0.8188391829f, 0.8195237058f, - 0.8202079139f, 0.8208918079f, 0.8215753887f, 0.8222586569f, 0.8229416136f, - 0.8236242594f, 0.8243065951f, 0.8249886216f, 0.8256703397f, 0.8263517501f, - 0.8270328536f, 0.8277136511f, 0.8283941432f, 0.8290743309f, 0.8297542147f, - 0.8304337956f, 0.8311130743f, 0.8317920516f, 0.8324707281f, 0.8331491048f, - 0.8338271823f, 0.8345049614f, 0.8351824428f, 0.8358596273f, 0.8365365157f, - 0.8372131086f, 0.8378894068f, 0.8385654111f, 0.8392411222f, 0.8399165407f, - 0.8405916676f, 0.8412665033f, 0.8419410488f, 0.8426153047f, 0.8432892716f, - 0.8439629504f, 0.8446363418f, 0.8453094464f, 0.8459822649f, 0.8466547981f, - 0.8473270466f, 0.8479990112f, 0.8486706925f, 0.8493420912f, 0.8500132081f, - 0.8506840438f, 0.8513545989f, 0.8520248742f, 0.8526948703f, 0.8533645880f, - 0.8540340278f, 0.8547031905f, 0.8553720767f, 0.8560406871f, 0.8567090223f, - 0.8573770831f, 0.8580448700f, 0.8587123837f, 0.8593796249f, 0.8600465942f, - 0.8607132923f, 0.8613797197f, 0.8620458772f, 0.8627117654f, 0.8633773850f, - 0.8640427364f, 0.8647078205f, 0.8653726378f, 0.8660371889f, 0.8667014745f, - 0.8673654952f, 0.8680292516f, 0.8686927443f, 0.8693559740f, 0.8700189412f, - 0.8706816466f, 0.8713440908f, 0.8720062744f, 0.8726681979f, 0.8733298621f, - 0.8739912674f, 0.8746524145f, 0.8753133040f, 0.8759739365f, 0.8766343125f, - 0.8772944327f, 0.8779542976f, 0.8786139079f, 0.8792732640f, 0.8799323667f, - 0.8805912164f, 0.8812498137f, 0.8819081593f, 0.8825662536f, 0.8832240973f, - 0.8838816909f, 0.8845390350f, 0.8851961302f, 0.8858529770f, 0.8865095759f, - 0.8871659276f, 0.8878220326f, 0.8884778913f, 0.8891335045f, 0.8897888727f, - 0.8904439963f, 0.8910988759f, 0.8917535121f, 0.8924079054f, 0.8930620564f, - 0.8937159656f, 0.8943696335f, 0.8950230607f, 0.8956762476f, 0.8963291949f, - 0.8969819031f, 0.8976343726f, 0.8982866040f, 0.8989385979f, 0.8995903547f, - 0.9002418749f, 0.9008931592f, 0.9015442079f, 0.9021950217f, 0.9028456010f, - 0.9034959463f, 0.9041460582f, 0.9047959371f, 0.9054455836f, 0.9060949981f, - 0.9067441812f, 0.9073931334f, 0.9080418551f, 0.9086903468f, 0.9093386091f, - 0.9099866425f, 0.9106344474f, 0.9112820243f, 0.9119293737f, 0.9125764961f, - 0.9132233920f, 0.9138700618f, 0.9145165061f, 0.9151627253f, 0.9158087199f, - 0.9164544904f, 0.9171000373f, 0.9177453609f, 0.9183904619f, 0.9190353406f, - 0.9196799976f, 0.9203244333f, 0.9209686481f, 0.9216126425f, 0.9222564171f, - 0.9228999722f, 0.9235433083f, 0.9241864259f, 0.9248293254f, 0.9254720073f, - 0.9261144720f, 0.9267567200f, 0.9273987517f, 0.9280405676f, 0.9286821682f, - 0.9293235538f, 0.9299647249f, 0.9306056820f, 0.9312464255f, 0.9318869558f, - 0.9325272734f, 0.9331673788f, 0.9338072722f, 0.9344469543f, 0.9350864254f, - 0.9357256859f, 0.9363647363f, 0.9370035770f, 0.9376422085f, 0.9382806311f, - 0.9389188453f, 0.9395568515f, 0.9401946501f, 0.9408322416f, 0.9414696263f, - 0.9421068047f, 0.9427437773f, 0.9433805443f, 0.9440171063f, 0.9446534636f, - 0.9452896166f, 0.9459255658f, 0.9465613116f, 0.9471968544f, 0.9478321945f, - 0.9484673324f, 0.9491022685f, 0.9497370032f, 0.9503715369f, 0.9510058700f, - 0.9516400028f, 0.9522739359f, 0.9529076695f, 0.9535412041f, 0.9541745400f, - 0.9548076778f, 0.9554406176f, 0.9560733600f, 0.9567059053f, 0.9573382540f, - 0.9579704063f, 0.9586023627f, 0.9592341236f, 0.9598656893f, 0.9604970603f, - 0.9611282369f, 0.9617592194f, 0.9623900083f, 0.9630206040f, 0.9636510067f, - 0.9642812170f, 0.9649112351f, 0.9655410614f, 0.9661706964f, 0.9668001403f, - 0.9674293936f, 0.9680584565f, 0.9686873296f, 0.9693160130f, 0.9699445073f, - 0.9705728128f, 0.9712009297f, 0.9718288586f, 0.9724565997f, 0.9730841534f, - 0.9737115200f, 0.9743387000f, 0.9749656936f, 0.9755925013f, 0.9762191234f, - 0.9768455601f, 0.9774718120f, 0.9780978793f, 0.9787237623f, 0.9793494615f, - 0.9799749772f, 0.9806003097f, 0.9812254593f, 0.9818504265f, 0.9824752115f, - 0.9830998147f, 0.9837242364f, 0.9843484770f, 0.9849725368f, 0.9855964161f, - 0.9862201153f, 0.9868436347f, 0.9874669747f, 0.9880901356f, 0.9887131177f, - 0.9893359213f, 0.9899585468f, 0.9905809946f, 0.9912032648f, 0.9918253579f, - 0.9924472742f, 0.9930690141f, 0.9936905777f, 0.9943119656f, 0.9949331779f, - 0.9955542150f, 0.9961750773f, 0.9967957650f, 0.9974162785f, 0.9980366181f, - 0.9986567840f, 0.9992767767f, 0.9998965965f, 1.0005162436f, 1.0011357183f, - 1.0017550210f, 1.0023741520f, 1.0029931117f, 1.0036119002f, 1.0042305179f, - 1.0048489652f, 1.0054672423f, 1.0060853496f, 1.0067032873f, 1.0073210557f, - 1.0079386552f, 1.0085560861f, 1.0091733486f, 1.0097904431f, 1.0104073699f, - 1.0110241292f, 1.0116407213f, 1.0122571467f, 1.0128734055f, 1.0134894980f, - 1.0141054246f, 1.0147211855f, 1.0153367811f, 1.0159522116f, 1.0165674773f, - 1.0171825786f, 1.0177975156f, 1.0184122888f, 1.0190268983f, 1.0196413445f, - 1.0202556276f, 1.0208697480f, 1.0214837059f, 1.0220975016f, 1.0227111355f, - 1.0233246077f, 1.0239379185f, 1.0245510684f, 1.0251640574f, 1.0257768860f, - 1.0263895543f, 1.0270020627f, 1.0276144115f, 1.0282266008f, 1.0288386311f, - 1.0294505026f, 1.0300622154f, 1.0306737701f, 1.0312851667f, 1.0318964055f, - 1.0325074870f, 1.0331184112f, 1.0337291785f, 1.0343397891f, 1.0349502434f, - 1.0355605416f, 1.0361706839f, 1.0367806707f, 1.0373905021f, 1.0380001785f, - 1.0386097001f, 1.0392190672f, 1.0398282800f, 1.0404373389f, 1.0410462440f, - 1.0416549956f, 1.0422635941f, 1.0428720396f, 1.0434803324f, 1.0440884727f, - 1.0446964609f, 1.0453042972f, 1.0459119818f, 1.0465195150f, 1.0471268971f, - 1.0477341283f, 1.0483412088f, 1.0489481389f, 1.0495549189f, 1.0501615490f, - 1.0507680295f, 1.0513743606f, 1.0519805426f, 1.0525865757f, 1.0531924601f, - 1.0537981962f, 1.0544037841f, 1.0550092241f, 1.0556145164f, 1.0562196614f, - 1.0568246592f, 1.0574295101f, 1.0580342143f, 1.0586387721f, 1.0592431836f, - 1.0598474493f, 1.0604515692f, 1.0610555437f, 1.0616593729f, 1.0622630571f, - 1.0628665966f, 1.0634699916f, 1.0640732423f, 1.0646763490f, 1.0652793118f, - 1.0658821311f, 1.0664848070f, 1.0670873399f, 1.0676897299f, 1.0682919772f, - 1.0688940822f, 1.0694960449f, 1.0700978658f, 1.0706995449f, 1.0713010825f, - 1.0719024789f, 1.0725037343f, 1.0731048488f, 1.0737058228f, 1.0743066565f, - 1.0749073500f, 1.0755079037f, 1.0761083177f, 1.0767085922f, 1.0773087275f, - 1.0779087239f, 1.0785085815f, 1.0791083005f, 1.0797078812f, 1.0803073238f, - 1.0809066285f, 1.0815057956f, 1.0821048252f, 1.0827037176f, 1.0833024729f, - 1.0839010915f, 1.0844995735f, 1.0850979192f, 1.0856961287f, 1.0862942023f, - 1.0868921402f, 1.0874899426f, 1.0880876098f, 1.0886851418f, 1.0892825391f, - 1.0898798016f, 1.0904769298f, 1.0910739237f, 1.0916707836f, 1.0922675098f, - 1.0928641023f, 1.0934605615f, 1.0940568875f, 1.0946530806f, 1.0952491409f, - 1.0958450686f, 1.0964408640f, 1.0970365273f, 1.0976320587f, 1.0982274584f, - 1.0988227265f, 1.0994178634f, 1.1000128691f, 1.1006077439f, 1.1012024881f, - 1.1017971017f, 1.1023915850f, 1.1029859383f, 1.1035801616f, 1.1041742553f, - 1.1047682195f, 1.1053620544f, 1.1059557602f, 1.1065493371f, 1.1071427853f, - 1.1077361050f, 1.1083292964f, 1.1089223597f, 1.1095152951f, 1.1101081027f, - 1.1107007829f, 1.1112933357f, 1.1118857614f, 1.1124780602f, 1.1130702322f, - 1.1136622777f, 1.1142541968f, 1.1148459898f, 1.1154376568f, 1.1160291980f, - 1.1166206136f, 1.1172119038f, 1.1178030688f, 1.1183941088f, 1.1189850239f, - 1.1195758144f, 1.1201664805f, 1.1207570223f, 1.1213474399f, 1.1219377337f, - 1.1225279038f, 1.1231179504f, 1.1237078736f, 1.1242976737f, 1.1248873508f, - 1.1254769051f, 1.1260663368f, 1.1266556461f, 1.1272448332f, 1.1278338982f, - 1.1284228413f, 1.1290116627f, 1.1296003627f, 1.1301889413f, 1.1307773987f, - 1.1313657352f, 1.1319539509f, 1.1325420460f, 1.1331300207f, 1.1337178751f, - 1.1343056094f, 1.1348932238f, 1.1354807185f, 1.1360680937f, 1.1366553495f, - 1.1372424860f, 1.1378295036f, 1.1384164024f, 1.1390031824f, 1.1395898440f, - 1.1401763872f, 1.1407628123f, 1.1413491194f, 1.1419353088f, 1.1425213805f, - 1.1431073347f, 1.1436931716f, 1.1442788914f, 1.1448644943f, 1.1454499804f, - 1.1460353499f, 1.1466206030f, 1.1472057398f, 1.1477907605f, 1.1483756652f, - 1.1489604542f, 1.1495451276f, 1.1501296856f, 1.1507141283f, 1.1512984559f, - 1.1518826686f, 1.1524667665f, 1.1530507498f, 1.1536346187f, 1.1542183733f, - 1.1548020138f, 1.1553855404f, 1.1559689532f, 1.1565522524f, 1.1571354381f, - 1.1577185105f, 1.1583014698f, 1.1588843162f, 1.1594670497f, 1.1600496706f, - 1.1606321790f, 1.1612145751f, 1.1617968590f, 1.1623790309f, 1.1629610909f, - 1.1635430393f, 1.1641248762f, 1.1647066016f, 1.1652882159f, 1.1658697191f, - 1.1664511114f, 1.1670323930f, 1.1676135639f, 1.1681946245f, 1.1687755748f, - 1.1693564149f, 1.1699371451f, 1.1705177655f, 1.1710982762f, 1.1716786775f, - 1.1722589693f, 1.1728391520f, 1.1734192257f, 1.1739991904f, 1.1745790465f, - 1.1751587939f, 1.1757384329f, 1.1763179636f, 1.1768973862f, 1.1774767008f, - 1.1780559076f, 1.1786350067f, 1.1792139983f, 1.1797928825f, 1.1803716594f, - 1.1809503293f, 1.1815288922f, 1.1821073484f, 1.1826856979f, 1.1832639409f, - 1.1838420776f, 1.1844201081f, 1.1849980325f, 1.1855758511f, 1.1861535638f, - 1.1867311710f, 1.1873086727f, 1.1878860690f, 1.1884633602f, 1.1890405464f, - 1.1896176276f, 1.1901946041f, 1.1907714761f, 1.1913482435f, 1.1919249066f, - 1.1925014656f, 1.1930779205f, 1.1936542715f, 1.1942305188f, 1.1948066625f, - 1.1953827027f, 1.1959586396f, 1.1965344733f, 1.1971102039f, 1.1976858317f, - 1.1982613567f, 1.1988367790f, 1.1994120989f, 1.1999873164f, 1.2005624317f, - 1.2011374449f, 1.2017123562f, 1.2022871657f, 1.2028618735f, 1.2034364798f, - 1.2040109847f, 1.2045853884f, 1.2051596910f, 1.2057338925f, 1.2063079933f, - 1.2068819933f, 1.2074558927f, 1.2080296917f, 1.2086033904f, 1.2091769890f, - 1.2097504875f, 1.2103238861f, 1.2108971849f, 1.2114703841f, 1.2120434838f, - 1.2126164841f, 1.2131893851f, 1.2137621871f, 1.2143348901f, 1.2149074942f, - 1.2154799996f, 1.2160524065f, 1.2166247149f, 1.2171969249f, 1.2177690368f, - 1.2183410506f, 1.2189129665f, 1.2194847846f, 1.2200565050f, 1.2206281278f, - 1.2211996533f, 1.2217710814f, 1.2223424124f, 1.2229136464f, 1.2234847834f, - 1.2240558237f, 1.2246267673f, 1.2251976144f, 1.2257683651f, 1.2263390195f, - 1.2269095777f, 1.2274800400f, 1.2280504063f, 1.2286206769f, 1.2291908518f, - 1.2297609312f, 1.2303309153f, 1.2309008040f, 1.2314705976f, 1.2320402961f, - 1.2326098998f, 1.2331794087f, 1.2337488229f, 1.2343181426f, 1.2348873679f, - 1.2354564989f, 1.2360255357f, 1.2365944784f, 1.2371633273f, 1.2377320823f, - 1.2383007437f, 1.2388693115f, 1.2394377859f, 1.2400061669f, 1.2405744547f, - 1.2411426495f, 1.2417107513f, 1.2422787602f, 1.2428466764f, 1.2434145001f, - 1.2439822312f, 1.2445498700f, 1.2451174165f, 1.2456848709f, 1.2462522332f, - 1.2468195037f, 1.2473866824f, 1.2479537694f, 1.2485207649f, 1.2490876689f, - 1.2496544817f, 1.2502212032f, 1.2507878337f, 1.2513543732f, 1.2519208218f, - 1.2524871797f, 1.2530534470f, 1.2536196238f, 1.2541857101f, 1.2547517062f, - 1.2553176122f, 1.2558834281f, 1.2564491540f, 1.2570147902f, 1.2575803366f, - 1.2581457934f, 1.2587111607f, 1.2592764387f, 1.2598416274f, 1.2604067270f, - 1.2609717375f, 1.2615366591f, 1.2621014919f, 1.2626662360f, 1.2632308915f, - 1.2637954585f, 1.2643599371f, 1.2649243275f, 1.2654886297f, 1.2660528439f, - 1.2666169702f, 1.2671810087f, 1.2677449594f, 1.2683088225f, 1.2688725982f, - 1.2694362864f, 1.2699998874f, 1.2705634012f, 1.2711268280f, 1.2716901678f, - 1.2722534207f, 1.2728165870f, 1.2733796666f, 1.2739426596f, 1.2745055663f, - 1.2750683866f, 1.2756311208f, 1.2761937688f, 1.2767563309f, 1.2773188070f, - 1.2778811974f, 1.2784435022f, 1.2790057213f, 1.2795678550f, 1.2801299033f, - 1.2806918664f, 1.2812537443f, 1.2818155372f, 1.2823772451f, 1.2829388682f, - 1.2835004066f, 1.2840618603f, 1.2846232295f, 1.2851845143f, 1.2857457148f, - 1.2863068310f, 1.2868678631f, 1.2874288113f, 1.2879896755f, 1.2885504559f, - 1.2891111525f, 1.2896717656f, 1.2902322952f, 1.2907927413f, 1.2913531042f, - 1.2919133839f, 1.2924735804f, 1.2930336940f, 1.2935937246f, 1.2941536725f, - 1.2947135376f, 1.2952733202f, 1.2958330202f, 1.2963926379f, 1.2969521732f, - 1.2975116264f, 1.2980709974f, 1.2986302864f, 1.2991894935f, 1.2997486188f, - 1.3003076624f, 1.3008666244f, 1.3014255049f, 1.3019843039f, 1.3025430216f, - 1.3031016581f, 1.3036602135f, 1.3042186878f, 1.3047770812f, 1.3053353937f, - 1.3058936255f, 1.3064517767f, 1.3070098473f, 1.3075678375f, 1.3081257473f, - 1.3086835768f, 1.3092413262f, 1.3097989955f, 1.3103565848f, 1.3109140942f, - 1.3114715239f, 1.3120288738f, 1.3125861442f, 1.3131433350f, 1.3137004464f, - 1.3142574786f, 1.3148144314f, 1.3153713052f, 1.3159280999f, 1.3164848157f, - 1.3170414526f, 1.3175980107f, 1.3181544902f, 1.3187108911f, 1.3192672135f, - 1.3198234576f, 1.3203796233f, 1.3209357108f, 1.3214917202f, 1.3220476516f, - 1.3226035050f, 1.3231592806f, 1.3237149785f, 1.3242705987f, 1.3248261413f, - 1.3253816064f, 1.3259369942f, 1.3264923046f, 1.3270475378f, 1.3276026939f, - 1.3281577730f, 1.3287127752f, 1.3292677005f, 1.3298225490f, 1.3303773208f, - 1.3309320161f, 1.3314866349f, 1.3320411772f, 1.3325956433f, 1.3331500331f, - 1.3337043467f, 1.3342585843f, 1.3348127460f, 1.3353668317f, 1.3359208417f, - 1.3364747760f, 1.3370286346f, 1.3375824177f, 1.3381361254f, 1.3386897577f, - 1.3392433147f, 1.3397967965f, 1.3403502033f, 1.3409035350f, 1.3414567918f, - 1.3420099738f, 1.3425630810f, 1.3431161135f, 1.3436690715f, 1.3442219549f, - 1.3447747640f, 1.3453274987f, 1.3458801591f, 1.3464327454f, 1.3469852576f, - 1.3475376959f, 1.3480900602f, 1.3486423507f, 1.3491945674f, 1.3497467105f, - 1.3502987800f, 1.3508507761f, 1.3514026987f, 1.3519545480f, 1.3525063240f, - 1.3530580269f, 1.3536096568f, 1.3541612136f, 1.3547126975f, 1.3552641086f, - 1.3558154470f, 1.3563667127f, 1.3569179058f, 1.3574690264f, 1.3580200745f, - 1.3585710504f, 1.3591219540f, 1.3596727854f, 1.3602235447f, 1.3607742320f, - 1.3613248474f, 1.3618753909f, 1.3624258627f, 1.3629762627f, 1.3635265912f, - 1.3640768481f, 1.3646270336f, 1.3651771477f, 1.3657271905f, 1.3662771621f, - 1.3668270625f, 1.3673768919f, 1.3679266504f, 1.3684763379f, 1.3690259546f, - 1.3695755006f, 1.3701249759f, 1.3706743807f, 1.3712237149f, 1.3717729787f, - 1.3723221722f, 1.3728712954f, 1.3734203484f, 1.3739693313f, 1.3745182442f, - 1.3750670871f, 1.3756158601f, 1.3761645634f, 1.3767131969f, 1.3772617607f, - 1.3778102550f, 1.3783586797f, 1.3789070351f, 1.3794553211f, 1.3800035379f, - 1.3805516854f, 1.3810997639f, 1.3816477733f, 1.3821957137f, 1.3827435853f, - 1.3832913880f, 1.3838391220f, 1.3843867873f, 1.3849343841f, 1.3854819123f, - 1.3860293721f, 1.3865767636f, 1.3871240867f, 1.3876713417f, 1.3882185285f, - 1.3887656472f, 1.3893126980f, 1.3898596808f, 1.3904065958f, 1.3909534430f, - 1.3915002225f, 1.3920469345f, 1.3925935788f, 1.3931401557f, 1.3936866652f, - 1.3942331073f, 1.3947794822f, 1.3953257900f, 1.3958720306f, 1.3964182041f, - 1.3969643107f, 1.3975103504f, 1.3980563233f, 1.3986022295f, 1.3991480689f, - 1.3996938418f, 1.4002395481f, 1.4007851880f, 1.4013307615f, 1.4018762686f, - 1.4024217095f, 1.4029670843f, 1.4035123929f, 1.4040576355f, 1.4046028121f, - 1.4051479229f, 1.4056929678f, 1.4062379470f, 1.4067828605f, 1.4073277083f, - 1.4078724907f, 1.4084172075f, 1.4089618590f, 1.4095064452f, 1.4100509660f, - 1.4105954217f, 1.4111398123f, 1.4116841378f, 1.4122283983f, 1.4127725939f, - 1.4133167247f, 1.4138607907f, 1.4144047919f, 1.4149487286f, 1.4154926007f, - 1.4160364082f, 1.4165801514f, 1.4171238301f, 1.4176674446f, 1.4182109949f, - 1.4187544809f, 1.4192979029f, 1.4198412609f, 1.4203845549f, 1.4209277850f, - 1.4214709513f, 1.4220140539f, 1.4225570927f, 1.4231000679f, 1.4236429796f, - 1.4241858278f, 1.4247286125f, 1.4252713340f, 1.4258139921f, 1.4263565870f, - 1.4268991187f, 1.4274415874f, 1.4279839930f, 1.4285263357f, 1.4290686155f, - 1.4296108324f, 1.4301529866f, 1.4306950781f, 1.4312371070f, 1.4317790733f, - 1.4323209771f, 1.4328628185f, 1.4334045976f, 1.4339463143f, 1.4344879687f, - 1.4350295611f, 1.4355710913f, 1.4361125594f, 1.4366539656f, 1.4371953098f, - 1.4377365923f, 1.4382778129f, 1.4388189718f, 1.4393600690f, 1.4399011047f, - 1.4404420788f, 1.4409829915f, 1.4415238427f, 1.4420646326f, 1.4426053613f, - 1.4431460287f, 1.4436866350f, 1.4442271801f, 1.4447676643f, 1.4453080875f, - 1.4458484498f, 1.4463887513f, 1.4469289920f, 1.4474691720f, 1.4480092913f, - 1.4485493501f, 1.4490893483f, 1.4496292861f, 1.4501691634f, 1.4507089805f, - 1.4512487372f, 1.4517884338f, 1.4523280702f, 1.4528676465f, 1.4534071627f, - 1.4539466191f, 1.4544860155f, 1.4550253520f, 1.4555646288f, 1.4561038458f, - 1.4566430032f, 1.4571821010f, 1.4577211393f, 1.4582601180f, 1.4587990374f, - 1.4593378974f, 1.4598766981f, 1.4604154395f, 1.4609541218f, 1.4614927449f, - 1.4620313090f, 1.4625698141f, 1.4631082603f, 1.4636466476f, 1.4641849761f, - 1.4647232458f, 1.4652614568f, 1.4657996091f, 1.4663377029f, 1.4668757382f, - 1.4674137150f, 1.4679516334f, 1.4684894934f, 1.4690272952f, 1.4695650387f, - 1.4701027241f, 1.4706403514f, 1.4711779206f, 1.4717154318f, 1.4722528850f, - 1.4727902804f, 1.4733276180f, 1.4738648978f, 1.4744021200f, 1.4749392844f, - 1.4754763913f, 1.4760134407f, 1.4765504325f, 1.4770873670f, 1.4776242441f, - 1.4781610639f, 1.4786978265f, 1.4792345319f, 1.4797711801f, 1.4803077713f, - 1.4808443055f, 1.4813807827f, 1.4819172030f, 1.4824535665f, 1.4829898731f, - 1.4835261231f, 1.4840623164f, 1.4845984530f, 1.4851345331f, 1.4856705567f, - 1.4862065238f, 1.4867424346f, 1.4872782890f, 1.4878140871f, 1.4883498290f, - 1.4888855147f, 1.4894211443f, 1.4899567179f, 1.4904922354f, 1.4910276970f, - 1.4915631027f, 1.4920984526f, 1.4926337467f, 1.4931689850f, 1.4937041677f, - 1.4942392947f, 1.4947743662f, 1.4953093822f, 1.4958443427f, 1.4963792479f, - 1.4969140977f, 1.4974488922f, 1.4979836314f, 1.4985183155f, 1.4990529444f, - 1.4995875183f, 1.5001220371f, 1.5006565010f, 1.5011909100f, 1.5017252641f, - 1.5022595634f, 1.5027938080f, 1.5033279978f, 1.5038621330f, 1.5043962137f, - 1.5049302397f, 1.5054642113f, 1.5059981285f, 1.5065319913f, 1.5070657997f, - 1.5075995539f, 1.5081332539f, 1.5086668997f, 1.5092004913f, 1.5097340290f, - 1.5102675126f, 1.5108009422f, 1.5113343180f, 1.5118676399f, 1.5124009080f, - 1.5129341223f, 1.5134672829f, 1.5140003899f, 1.5145334434f, 1.5150664432f, - 1.5155993896f, 1.5161322825f, 1.5166651221f, 1.5171979083f, 1.5177306413f, - 1.5182633210f, 1.5187959475f, 1.5193285209f, 1.5198610412f, 1.5203935085f, - 1.5209259228f, 1.5214582842f, 1.5219905927f, 1.5225228484f, 1.5230550514f, - 1.5235872016f, 1.5241192991f, 1.5246513440f, 1.5251833364f, 1.5257152762f, - 1.5262471635f, 1.5267789985f, 1.5273107810f, 1.5278425113f, 1.5283741893f, - 1.5289058150f, 1.5294373886f, 1.5299689101f, 1.5305003795f, 1.5310317969f, - 1.5315631623f, 1.5320944758f, 1.5326257374f, 1.5331569472f, 1.5336881052f, - 1.5342192115f, 1.5347502662f, 1.5352812692f, 1.5358122206f, 1.5363431205f, - 1.5368739689f, 1.5374047659f, 1.5379355115f, 1.5384662058f, 1.5389968488f, - 1.5395274406f, 1.5400579811f, 1.5405884706f, 1.5411189089f, 1.5416492962f, - 1.5421796326f, 1.5427099179f, 1.5432401524f, 1.5437703360f, 1.5443004689f, - 1.5448305509f, 1.5453605823f, 1.5458905630f, 1.5464204931f, 1.5469503726f, - 1.5474802017f, 1.5480099802f, 1.5485397084f, 1.5490693861f, 1.5495990136f, - 1.5501285907f, 1.5506581177f, 1.5511875944f, 1.5517170210f, 1.5522463976f, - 1.5527757240f, 1.5533050005f, 1.5538342271f, 1.5543634037f, 1.5548925305f, - 1.5554216075f, 1.5559506347f, 1.5564796122f, 1.5570085400f, 1.5575374182f, - 1.5580662468f, 1.5585950259f, 1.5591237555f, 1.5596524357f, 1.5601810664f, - 1.5607096479f, 1.5612381800f, 1.5617666629f, 1.5622950965f, 1.5628234810f, - 1.5633518164f, 1.5638801027f, 1.5644083400f, 1.5649365283f, 1.5654646677f, - 1.5659927582f, 1.5665207998f, 1.5670487926f, 1.5675767367f, 1.5681046321f, - 1.5686324788f, 1.5691602769f, 1.5696880264f, 1.5702157273f, 1.5707433798f, - 1.5712709839f, 1.5717985395f, 1.5723260468f, 1.5728535058f, 1.5733809166f, - 1.5739082791f, 1.5744355934f, 1.5749628596f, 1.5754900777f, 1.5760172478f, - 1.5765443699f, 1.5770714440f, 1.5775984703f, 1.5781254486f, 1.5786523791f, - 1.5791792619f, 1.5797060969f, 1.5802328843f, 1.5807596240f, 1.5812863160f, - 1.5818129606f, 1.5823395576f, 1.5828661071f, 1.5833926092f, 1.5839190639f, - 1.5844454713f, 1.5849718314f, 1.5854981442f, 1.5860244098f, 1.5865506283f, - 1.5870767996f, 1.5876029238f, 1.5881290010f, 1.5886550312f, 1.5891810144f, - 1.5897069507f, 1.5902328402f, 1.5907586828f, 1.5912844786f, 1.5918102277f, - 1.5923359301f, 1.5928615858f, 1.5933871949f, 1.5939127575f, 1.5944382735f, - 1.5949637430f, 1.5954891661f, 1.5960145427f, 1.5965398730f, 1.5970651570f, - 1.5975903947f, 1.5981155861f, 1.5986407314f, 1.5991658305f, 1.5996908835f, - 1.6002158904f, 1.6007408513f, 1.6012657662f, 1.6017906351f, 1.6023154581f, - 1.6028402353f, 1.6033649667f, 1.6038896522f, 1.6044142920f, 1.6049388862f, - 1.6054634346f, 1.6059879375f, 1.6065123947f, 1.6070368065f, 1.6075611727f, - 1.6080854935f, 1.6086097688f, 1.6091339988f, 1.6096581834f, 1.6101823228f, - 1.6107064169f, 1.6112304658f, 1.6117544695f, 1.6122784281f, 1.6128023416f, - 1.6133262100f, 1.6138500335f, 1.6143738119f, 1.6148975454f, 1.6154212341f, - 1.6159448779f, 1.6164684768f, 1.6169920310f, 1.6175155405f, 1.6180390053f, - 1.6185624254f, 1.6190858009f, 1.6196091319f, 1.6201324183f, 1.6206556602f, - 1.6211788576f, 1.6217020107f, 1.6222251193f, 1.6227481836f, 1.6232712037f, - 1.6237941794f, 1.6243171110f, 1.6248399984f, 1.6253628416f, 1.6258856407f, - 1.6264083958f, 1.6269311068f, 1.6274537738f, 1.6279763969f, 1.6284989761f, - 1.6290215115f, 1.6295440030f, 1.6300664507f, 1.6305888546f, 1.6311112148f, - 1.6316335314f, 1.6321558043f, 1.6326780336f, 1.6332002194f, 1.6337223616f, - 1.6342444603f, 1.6347665156f, 1.6352885275f, 1.6358104960f, 1.6363324212f, - 1.6368543031f, 1.6373761417f, 1.6378979371f, 1.6384196893f, 1.6389413984f, - 1.6394630644f, 1.6399846873f, 1.6405062672f, 1.6410278040f, 1.6415492980f, - 1.6420707490f, 1.6425921571f, 1.6431135223f, 1.6436348448f, 1.6441561245f, - 1.6446773615f, 1.6451985557f, 1.6457197074f, 1.6462408163f, 1.6467618827f, - 1.6472829066f, 1.6478038880f, 1.6483248268f, 1.6488457233f, 1.6493665773f, - 1.6498873890f, 1.6504081583f, 1.6509288854f, 1.6514495702f, 1.6519702128f, - 1.6524908132f, 1.6530113715f, 1.6535318876f, 1.6540523617f, 1.6545727938f, - 1.6550931838f, 1.6556135319f, 1.6561338381f, 1.6566541023f, 1.6571743248f, - 1.6576945054f, 1.6582146442f, 1.6587347413f, 1.6592547967f, 1.6597748104f, - 1.6602947824f, 1.6608147129f, 1.6613346018f, 1.6618544491f, 1.6623742550f, - 1.6628940194f, 1.6634137424f, 1.6639334240f, 1.6644530642f, 1.6649726631f, - 1.6654922208f, 1.6660117372f, 1.6665312124f, 1.6670506464f, 1.6675700392f, - 1.6680893910f, 1.6686087017f, 1.6691279714f, 1.6696472000f, 1.6701663877f, - 1.6706855345f, 1.6712046403f, 1.6717237053f, 1.6722427295f, 1.6727617129f, - 1.6732806555f, 1.6737995575f, 1.6743184187f, 1.6748372393f, 1.6753560192f, - 1.6758747586f, 1.6763934574f, 1.6769121157f, 1.6774307335f, 1.6779493109f, - 1.6784678479f, 1.6789863445f, 1.6795048007f, 1.6800232167f, 1.6805415924f, - 1.6810599278f, 1.6815782230f, 1.6820964781f, 1.6826146930f, 1.6831328678f, - 1.6836510025f, 1.6841690972f, 1.6846871519f, 1.6852051667f, 1.6857231415f, - 1.6862410764f, 1.6867589714f, 1.6872768266f, 1.6877946420f, 1.6883124176f, - 1.6888301535f, 1.6893478497f, 1.6898655062f, 1.6903831231f, 1.6909007004f, - 1.6914182381f, 1.6919357363f, 1.6924531950f, 1.6929706142f, 1.6934879940f, - 1.6940053344f, 1.6945226354f, 1.6950398971f, 1.6955571195f, 1.6960743026f, - 1.6965914465f, 1.6971085512f, 1.6976256167f, 1.6981426430f, 1.6986596303f, - 1.6991765785f, 1.6996934877f, 1.7002103578f, 1.7007271890f, 1.7012439812f, - 1.7017607345f, 1.7022774490f, 1.7027941246f, 1.7033107613f, 1.7038273594f, - 1.7043439186f, 1.7048604392f, 1.7053769210f, 1.7058933642f, 1.7064097688f, - 1.7069261348f, 1.7074424623f, 1.7079587512f, 1.7084750016f, 1.7089912136f, - 1.7095073872f, 1.7100235223f, 1.7105396191f, 1.7110556776f, 1.7115716977f, - 1.7120876796f, 1.7126036233f, 1.7131195288f, 1.7136353960f, 1.7141512252f, - 1.7146670162f, 1.7151827692f, 1.7156984841f, 1.7162141610f, 1.7167297999f, - 1.7172454008f, 1.7177609639f, 1.7182764890f, 1.7187919763f, 1.7193074258f, - 1.7198228374f, 1.7203382113f, 1.7208535475f, 1.7213688459f, 1.7218841067f, - 1.7223993299f, 1.7229145154f, 1.7234296634f, 1.7239447738f, 1.7244598467f, - 1.7249748821f, 1.7254898800f, 1.7260048405f, 1.7265197637f, 1.7270346494f, - 1.7275494979f, 1.7280643090f, 1.7285790828f, 1.7290938195f, 1.7296085189f, - 1.7301231811f, 1.7306378062f, 1.7311523941f, 1.7316669450f, 1.7321814588f, - 1.7326959356f, 1.7332103753f, 1.7337247781f, 1.7342391440f, 1.7347534730f, - 1.7352677650f, 1.7357820203f, 1.7362962387f, 1.7368104203f, 1.7373245652f, - 1.7378386733f, 1.7383527448f, 1.7388667795f, 1.7393807777f, 1.7398947392f, - 1.7404086641f, 1.7409225525f, 1.7414364044f, 1.7419502198f, 1.7424639987f, - 1.7429777412f, 1.7434914473f, 1.7440051170f, 1.7445187504f, 1.7450323475f, - 1.7455459083f, 1.7460594328f, 1.7465729211f, 1.7470863732f, 1.7475997891f, - 1.7481131689f, 1.7486265126f, 1.7491398202f, 1.7496530918f, 1.7501663273f, - 1.7506795269f, 1.7511926904f, 1.7517058181f, 1.7522189098f, 1.7527319657f, - 1.7532449857f, 1.7537579699f, 1.7542709184f, 1.7547838310f, 1.7552967079f, - 1.7558095492f, 1.7563223547f, 1.7568351246f, 1.7573478589f, 1.7578605576f, - 1.7583732207f, 1.7588858483f, 1.7593984404f, 1.7599109970f, 1.7604235182f, - 1.7609360040f, 1.7614484543f, 1.7619608693f, 1.7624732490f, 1.7629855934f, - 1.7634979025f, 1.7640101763f, 1.7645224150f, 1.7650346184f, 1.7655467867f, - 1.7660589198f, 1.7665710178f, 1.7670830808f, 1.7675951087f, 1.7681071015f, - 1.7686190594f, 1.7691309823f, 1.7696428703f, 1.7701547234f, 1.7706665415f, - 1.7711783248f, 1.7716900733f, 1.7722017870f, 1.7727134659f, 1.7732251101f, - 1.7737367195f, 1.7742482943f, 1.7747598344f, 1.7752713399f, 1.7757828107f, - 1.7762942470f, 1.7768056487f, 1.7773170159f, 1.7778283486f, 1.7783396468f, - 1.7788509106f, 1.7793621399f, 1.7798733349f, 1.7803844955f, 1.7808956218f, - 1.7814067137f, 1.7819177714f, 1.7824287948f, 1.7829397840f, 1.7834507390f, - 1.7839616599f, 1.7844725465f, 1.7849833991f, 1.7854942176f, 1.7860050020f, - 1.7865157524f, 1.7870264687f, 1.7875371511f, 1.7880477995f, 1.7885584140f, - 1.7890689946f, 1.7895795412f, 1.7900900541f, 1.7906005331f, 1.7911109783f, - 1.7916213898f, 1.7921317675f, 1.7926421115f, 1.7931524218f, 1.7936626984f, - 1.7941729414f, 1.7946831508f, 1.7951933266f, 1.7957034688f, 1.7962135775f, - 1.7967236527f, 1.7972336944f, 1.7977437026f, 1.7982536775f, 1.7987636189f, - 1.7992735269f, 1.7997834016f, 1.8002932430f, 1.8008030510f, 1.8013128258f, - 1.8018225674f, 1.8023322757f, 1.8028419508f, 1.8033515928f, 1.8038612016f, - 1.8043707773f, 1.8048803199f, 1.8053898294f, 1.8058993059f, 1.8064087494f, - 1.8069181599f, 1.8074275374f, 1.8079368820f, 1.8084461937f, 1.8089554725f, - 1.8094647184f, 1.8099739315f, 1.8104831118f, 1.8109922593f, 1.8115013740f, - 1.8120104561f, 1.8125195054f, 1.8130285220f, 1.8135375059f, 1.8140464572f, - 1.8145553760f, 1.8150642621f, 1.8155731157f, 1.8160819367f, 1.8165907253f, - 1.8170994813f, 1.8176082049f, 1.8181168961f, 1.8186255548f, 1.8191341812f, - 1.8196427752f, 1.8201513369f, 1.8206598663f, 1.8211683634f, 1.8216768283f, - 1.8221852609f, 1.8226936613f, 1.8232020295f, 1.8237103656f, 1.8242186695f, - 1.8247269413f, 1.8252351811f, 1.8257433888f, 1.8262515644f, 1.8267597080f, - 1.8272678197f, 1.8277758994f, 1.8282839471f, 1.8287919630f, 1.8292999469f, - 1.8298078990f, 1.8303158193f, 1.8308237077f, 1.8313315644f, 1.8318393893f, - 1.8323471824f, 1.8328549439f, 1.8333626736f, 1.8338703717f, 1.8343780381f, - 1.8348856729f, 1.8353932761f, 1.8359008477f, 1.8364083878f, 1.8369158964f, - 1.8374233735f, 1.8379308191f, 1.8384382332f, 1.8389456159f, 1.8394529672f, - 1.8399602872f, 1.8404675757f, 1.8409748330f, 1.8414820589f, 1.8419892536f, - 1.8424964170f, 1.8430035491f, 1.8435106501f, 1.8440177198f, 1.8445247584f, - 1.8450317658f, 1.8455387422f, 1.8460456874f, 1.8465526016f, 1.8470594847f, - 1.8475663368f, 1.8480731579f, 1.8485799480f, 1.8490867072f, 1.8495934354f, - 1.8501001327f, 1.8506067992f, 1.8511134347f, 1.8516200395f, 1.8521266134f, - 1.8526331566f, 1.8531396690f, 1.8536461506f, 1.8541526015f, 1.8546590217f, - 1.8551654113f, 1.8556717702f, 1.8561780984f, 1.8566843961f, 1.8571906632f, - 1.8576968997f, 1.8582031057f, 1.8587092812f, 1.8592154262f, 1.8597215407f, - 1.8602276248f, 1.8607336784f, 1.8612397017f, 1.8617456946f, 1.8622516571f, - 1.8627575893f, 1.8632634912f, 1.8637693628f, 1.8642752042f, 1.8647810153f, - 1.8652867962f, 1.8657925469f, 1.8662982674f, 1.8668039578f, 1.8673096181f, - 1.8678152482f, 1.8683208483f, 1.8688264184f, 1.8693319583f, 1.8698374683f, - 1.8703429483f, 1.8708483983f, 1.8713538184f, 1.8718592086f, 1.8723645688f, - 1.8728698992f, 1.8733751997f, 1.8738804704f, 1.8743857113f, 1.8748909224f, - 1.8753961037f, 1.8759012553f, 1.8764063771f, 1.8769114693f, 1.8774165318f, - 1.8779215646f, 1.8784265678f, 1.8789315413f, 1.8794364853f, 1.8799413997f, - 1.8804462846f, 1.8809511399f, 1.8814559658f, 1.8819607622f, 1.8824655291f, - 1.8829702665f, 1.8834749746f, 1.8839796533f, 1.8844843025f, 1.8849889225f, - 1.8854935131f, 1.8859980744f, 1.8865026064f, 1.8870071092f, 1.8875115827f, - 1.8880160270f, 1.8885204422f, 1.8890248281f, 1.8895291849f, 1.8900335125f, - 1.8905378111f, 1.8910420805f, 1.8915463209f, 1.8920505322f, 1.8925547145f, - 1.8930588678f, 1.8935629921f, 1.8940670875f, 1.8945711539f, 1.8950751914f, - 1.8955792000f, 1.8960831798f, 1.8965871306f, 1.8970910527f, 1.8975949459f, - 1.8980988104f, 1.8986026460f, 1.8991064530f, 1.8996102312f, 1.9001139807f, - 1.9006177015f, 1.9011213936f, 1.9016250571f, 1.9021286920f, 1.9026322983f, - 1.9031358760f, 1.9036394251f, 1.9041429457f, 1.9046464378f, 1.9051499014f, - 1.9056533365f, 1.9061567432f, 1.9066601214f, 1.9071634712f, 1.9076667926f, - 1.9081700857f, 1.9086733504f, 1.9091765867f, 1.9096797948f, 1.9101829746f, - 1.9106861261f, 1.9111892494f, 1.9116923444f, 1.9121954112f, 1.9126984499f, - 1.9132014603f, 1.9137044427f, 1.9142073969f, 1.9147103230f, 1.9152132210f, - 1.9157160910f, 1.9162189329f, 1.9167217468f, 1.9172245327f, 1.9177272907f, - 1.9182300206f, 1.9187327226f, 1.9192353968f, 1.9197380430f, 1.9202406613f, - 1.9207432518f, 1.9212458144f, 1.9217483492f, 1.9222508562f, 1.9227533355f, - 1.9232557869f, 1.9237582107f, 1.9242606067f, 1.9247629750f, 1.9252653157f, - 1.9257676287f, 1.9262699140f, 1.9267721718f, 1.9272744019f, 1.9277766045f, - 1.9282787795f, 1.9287809270f, 1.9292830469f, 1.9297851394f, 1.9302872044f, - 1.9307892419f, 1.9312912520f, 1.9317932347f, 1.9322951899f, 1.9327971178f, - 1.9332990184f, 1.9338008916f, 1.9343027374f, 1.9348045560f, 1.9353063473f, - 1.9358081114f, 1.9363098482f, 1.9368115577f, 1.9373132401f, 1.9378148953f, - 1.9383165233f, 1.9388181242f, 1.9393196980f, 1.9398212447f, 1.9403227642f, - 1.9408242568f, 1.9413257222f, 1.9418271607f, 1.9423285721f, 1.9428299566f, - 1.9433313141f, 1.9438326446f, 1.9443339482f, 1.9448352249f, 1.9453364747f, - 1.9458376976f, 1.9463388937f, 1.9468400630f, 1.9473412054f, 1.9478423211f, - 1.9483434099f, 1.9488444720f, 1.9493455074f, 1.9498465161f, 1.9503474981f, - 1.9508484533f, 1.9513493820f, 1.9518502839f, 1.9523511593f, 1.9528520081f, - 1.9533528302f, 1.9538536258f, 1.9543543949f, 1.9548551374f, 1.9553558535f, - 1.9558565430f, 1.9563572061f, 1.9568578427f, 1.9573584529f, 1.9578590366f, - 1.9583595940f, 1.9588601250f, 1.9593606296f, 1.9598611079f, 1.9603615599f, - 1.9608619856f, 1.9613623850f, 1.9618627581f, 1.9623631050f, 1.9628634257f, - 1.9633637201f, 1.9638639884f, 1.9643642305f, 1.9648644464f, 1.9653646362f, - 1.9658647999f, 1.9663649375f, 1.9668650490f, 1.9673651344f, 1.9678651939f, - 1.9683652272f, 1.9688652346f, 1.9693652160f, 1.9698651715f, 1.9703651009f, - 1.9708650045f, 1.9713648821f, 1.9718647339f, 1.9723645597f, 1.9728643597f, - 1.9733641339f, 1.9738638822f, 1.9743636048f, 1.9748633015f, 1.9753629725f, - 1.9758626178f, 1.9763622373f, 1.9768618311f, 1.9773613992f, 1.9778609416f, - 1.9783604584f, 1.9788599495f, 1.9793594150f, 1.9798588549f, 1.9803582693f, - 1.9808576580f, 1.9813570212f, 1.9818563589f, 1.9823556711f, 1.9828549577f, - 1.9833542189f, 1.9838534546f, 1.9843526649f, 1.9848518498f, 1.9853510092f, - 1.9858501433f, 1.9863492520f, 1.9868483353f, 1.9873473933f, 1.9878464260f, - 1.9883454334f, 1.9888444155f, 1.9893433723f, 1.9898423039f, 1.9903412102f, - 1.9908400914f, 1.9913389474f, 1.9918377781f, 1.9923365838f, 1.9928353642f, - 1.9933341196f, 1.9938328498f, 1.9943315550f, 1.9948302351f, 1.9953288901f, - 1.9958275201f, 1.9963261251f, 1.9968247051f, 1.9973232601f, 1.9978217901f, - 1.9983202952f, 1.9988187754f, 1.9993172306f, 1.9998156610f, 2.0003140664f, - 2.0008124470f, 2.0013108028f, 2.0018091337f, 2.0023074398f, 2.0028057212f, - 2.0033039777f, 2.0038022095f, 2.0043004166f, 2.0047985989f, 2.0052967565f, - 2.0057948894f, 2.0062929977f, 2.0067910813f, 2.0072891403f, 2.0077871746f, - 2.0082851844f, 2.0087831695f, 2.0092811301f, 2.0097790661f, 2.0102769776f, - 2.0107748646f, 2.0112727271f, 2.0117705651f, 2.0122683786f, 2.0127661677f, - 2.0132639323f, 2.0137616725f, 2.0142593884f, 2.0147570798f, 2.0152547469f, - 2.0157523896f, 2.0162500080f, 2.0167476020f, 2.0172451718f, 2.0177427173f, - 2.0182402385f, 2.0187377355f, 2.0192352082f, 2.0197326568f, 2.0202300811f, - 2.0207274812f, 2.0212248572f, 2.0217222091f, 2.0222195368f, 2.0227168403f, - 2.0232141198f, 2.0237113752f, 2.0242086066f, 2.0247058138f, 2.0252029971f, - 2.0257001563f, 2.0261972916f, 2.0266944028f, 2.0271914901f, 2.0276885535f, - 2.0281855929f, 2.0286826083f, 2.0291795999f, 2.0296765676f, 2.0301735115f, - 2.0306704314f, 2.0311673276f, 2.0316641999f, 2.0321610484f, 2.0326578732f, - 2.0331546741f, 2.0336514514f, 2.0341482048f, 2.0346449346f, 2.0351416406f, - 2.0356383230f, 2.0361349817f, 2.0366316167f, 2.0371282281f, 2.0376248159f, - 2.0381213800f, 2.0386179206f, 2.0391144376f, 2.0396109310f, 2.0401074009f, - 2.0406038472f, 2.0411002701f, 2.0415966694f, 2.0420930453f, 2.0425893977f, - 2.0430857267f, 2.0435820322f, 2.0440783143f, 2.0445745730f, 2.0450708084f, - 2.0455670203f, 2.0460632089f, 2.0465593742f, 2.0470555162f, 2.0475516348f, - 2.0480477302f, 2.0485438023f, 2.0490398511f, 2.0495358767f, 2.0500318791f, - 2.0505278582f, 2.0510238142f, 2.0515197470f, 2.0520156566f, 2.0525115431f, - 2.0530074064f, 2.0535032467f, 2.0539990638f, 2.0544948579f, 2.0549906288f, - 2.0554863768f, 2.0559821017f, 2.0564778035f, 2.0569734824f, 2.0574691383f, - 2.0579647712f, 2.0584603811f, 2.0589559681f, 2.0594515322f, 2.0599470734f, - 2.0604425916f, 2.0609380870f, 2.0614335595f, 2.0619290092f, 2.0624244360f, - 2.0629198400f, 2.0634152213f, 2.0639105797f, 2.0644059153f, 2.0649012282f, - 2.0653965184f, 2.0658917858f, 2.0663870305f, 2.0668822525f, 2.0673774518f, - 2.0678726285f, 2.0683677825f, 2.0688629139f, 2.0693580226f, 2.0698531088f, - 2.0703481723f, 2.0708432133f, 2.0713382318f, 2.0718332276f, 2.0723282010f, - 2.0728231518f, 2.0733180802f, 2.0738129860f, 2.0743078694f, 2.0748027304f, - 2.0752975689f, 2.0757923849f, 2.0762871786f, 2.0767819499f, 2.0772766988f, - 2.0777714253f, 2.0782661295f, 2.0787608113f, 2.0792554709f, 2.0797501081f, - 2.0802447230f, 2.0807393157f, 2.0812338861f, 2.0817284343f, 2.0822229602f, - 2.0827174639f, 2.0832119454f, 2.0837064048f, 2.0842008419f, 2.0846952570f, - 2.0851896498f, 2.0856840206f, 2.0861783692f, 2.0866726958f, 2.0871670002f, - 2.0876612826f, 2.0881555430f, 2.0886497813f, 2.0891439976f, 2.0896381918f, - 2.0901323641f, 2.0906265144f, 2.0911206428f, 2.0916147492f, 2.0921088337f, - 2.0926028962f, 2.0930969368f, 2.0935909556f, 2.0940849525f, 2.0945789275f, - 2.0950728807f, 2.0955668120f, 2.0960607215f, 2.0965546092f, 2.0970484751f, - 2.0975423193f, 2.0980361417f, 2.0985299423f, 2.0990237213f, 2.0995174785f, - 2.1000112140f, 2.1005049278f, 2.1009986199f, 2.1014922904f, 2.1019859392f, - 2.1024795665f, 2.1029731720f, 2.1034667560f, 2.1039603184f, 2.1044538593f, - 2.1049473786f, 2.1054408763f, 2.1059343525f, 2.1064278072f, 2.1069212404f, - 2.1074146521f, 2.1079080423f, 2.1084014110f, 2.1088947584f, 2.1093880843f, - 2.1098813887f, 2.1103746718f, 2.1108679335f, 2.1113611738f, 2.1118543928f, - 2.1123475904f, 2.1128407666f, 2.1133339216f, 2.1138270553f, 2.1143201676f, - 2.1148132587f, 2.1153063286f, 2.1157993771f, 2.1162924045f, 2.1167854106f, - 2.1172783956f, 2.1177713593f, 2.1182643018f, 2.1187572232f, 2.1192501235f, - 2.1197430026f, 2.1202358606f, 2.1207286975f, 2.1212215133f, 2.1217143080f, - 2.1222070816f, 2.1226998342f, 2.1231925658f, 2.1236852763f, 2.1241779658f, - 2.1246706343f, 2.1251632819f, 2.1256559084f, 2.1261485141f, 2.1266410987f, - 2.1271336625f, 2.1276262053f, 2.1281187272f, 2.1286112283f, 2.1291037084f, - 2.1295961677f, 2.1300886062f, 2.1305810238f, 2.1310734206f, 2.1315657967f, - 2.1320581519f, 2.1325504863f, 2.1330428000f, 2.1335350929f, 2.1340273651f, - 2.1345196166f, 2.1350118473f, 2.1355040574f, 2.1359962467f, 2.1364884154f, - 2.1369805635f, 2.1374726909f, 2.1379647977f, 2.1384568838f, 2.1389489494f, - 2.1394409944f, 2.1399330188f, 2.1404250226f, 2.1409170059f, 2.1414089686f, - 2.1419009109f, 2.1423928326f, 2.1428847338f, 2.1433766146f, 2.1438684748f, - 2.1443603147f, 2.1448521341f, 2.1453439330f, 2.1458357115f, 2.1463274697f, - 2.1468192074f, 2.1473109248f, 2.1478026218f, 2.1482942985f, 2.1487859548f, - 2.1492775908f, 2.1497692065f, 2.1502608019f, 2.1507523770f, 2.1512439319f, - 2.1517354665f, 2.1522269808f, 2.1527184749f, 2.1532099488f, 2.1537014025f, - 2.1541928361f, 2.1546842494f, 2.1551756426f, 2.1556670156f, 2.1561583684f, - 2.1566497012f, 2.1571410138f, 2.1576323064f, 2.1581235788f, 2.1586148312f, - 2.1591060635f, 2.1595972758f, 2.1600884680f, 2.1605796403f, 2.1610707925f, - 2.1615619247f, 2.1620530369f, 2.1625441292f, 2.1630352015f, 2.1635262538f, - 2.1640172863f, 2.1645082988f, 2.1649992914f, 2.1654902641f, 2.1659812169f, - 2.1664721499f, 2.1669630630f, 2.1674539563f, 2.1679448297f, 2.1684356833f, - 2.1689265172f, 2.1694173312f, 2.1699081255f, 2.1703989000f, 2.1708896547f, - 2.1713803897f, 2.1718711050f, 2.1723618005f, 2.1728524764f, 2.1733431326f, - 2.1738337691f, 2.1743243859f, 2.1748149831f, 2.1753055606f, 2.1757961185f, - 2.1762866568f, 2.1767771755f, 2.1772676747f, 2.1777581542f, 2.1782486142f, - 2.1787390546f, 2.1792294755f, 2.1797198769f, 2.1802102587f, 2.1807006211f, - 2.1811909639f, 2.1816812873f, 2.1821715913f, 2.1826618758f, 2.1831521408f, - 2.1836423864f, 2.1841326126f, 2.1846228194f, 2.1851130069f, 2.1856031749f, - 2.1860933236f, 2.1865834529f, 2.1870735629f, 2.1875636536f, 2.1880537249f, - 2.1885437770f, 2.1890338097f, 2.1895238232f, 2.1900138175f, 2.1905037924f, - 2.1909937482f, 2.1914836847f, 2.1919736020f, 2.1924635001f, 2.1929533790f, - 2.1934432387f, 2.1939330792f, 2.1944229006f, 2.1949127029f, 2.1954024860f, - 2.1958922500f, 2.1963819949f, 2.1968717207f, 2.1973614275f, 2.1978511151f, - 2.1983407838f, 2.1988304333f, 2.1993200639f, 2.1998096754f, 2.2002992679f, - 2.2007888414f, 2.2012783959f, 2.2017679315f, 2.2022574481f, 2.2027469457f, - 2.2032364244f, 2.2037258842f, 2.2042153251f, 2.2047047471f, 2.2051941501f, - 2.2056835344f, 2.2061728997f, 2.2066622462f, 2.2071515739f, 2.2076408827f, - 2.2081301727f, 2.2086194439f, 2.2091086964f, 2.2095979300f, 2.2100871449f, - 2.2105763410f, 2.2110655184f, 2.2115546770f, 2.2120438169f, 2.2125329381f, - 2.2130220406f, 2.2135111245f, 2.2140001896f, 2.2144892361f, 2.2149782640f, - 2.2154672732f, 2.2159562638f, 2.2164452357f, 2.2169341891f, 2.2174231239f, - 2.2179120401f, 2.2184009377f, 2.2188898168f, 2.2193786773f, 2.2198675193f, - 2.2203563428f, 2.2208451477f, 2.2213339342f, 2.2218227022f, 2.2223114517f, - 2.2228001827f, 2.2232888953f, 2.2237775895f, 2.2242662652f, 2.2247549226f, - 2.2252435615f, 2.2257321820f, 2.2262207841f, 2.2267093679f, 2.2271979333f, - 2.2276864804f, 2.2281750091f, 2.2286635195f, 2.2291520116f, 2.2296404854f, - 2.2301289409f, 2.2306173782f, 2.2311057971f, 2.2315941978f, 2.2320825803f, - 2.2325709446f, 2.2330592906f, 2.2335476184f, 2.2340359280f, 2.2345242194f, - 2.2350124927f, 2.2355007478f, 2.2359889847f, 2.2364772035f, 2.2369654042f, - 2.2374535867f, 2.2379417512f, 2.2384298975f, 2.2389180258f, 2.2394061360f, - 2.2398942282f, 2.2403823023f, 2.2408703583f, 2.2413583963f, 2.2418464163f, - 2.2423344184f, 2.2428224024f, 2.2433103684f, 2.2437983165f, 2.2442862466f, - 2.2447741587f, 2.2452620529f, 2.2457499292f, 2.2462377876f, 2.2467256281f, - 2.2472134507f, 2.2477012554f, 2.2481890422f, 2.2486768112f, 2.2491645623f, - 2.2496522956f, 2.2501400111f, 2.2506277088f, 2.2511153886f, 2.2516030507f, - 2.2520906950f, 2.2525783215f, 2.2530659302f, 2.2535535212f, 2.2540410945f, - 2.2545286500f, 2.2550161879f, 2.2555037080f, 2.2559912104f, 2.2564786952f, - 2.2569661623f, 2.2574536117f, 2.2579410435f, 2.2584284576f, 2.2589158542f, - 2.2594032331f, 2.2598905943f, 2.2603779381f, 2.2608652642f, 2.2613525727f, - 2.2618398637f, 2.2623271372f, 2.2628143931f, 2.2633016314f, 2.2637888523f, - 2.2642760556f, 2.2647632415f, 2.2652504099f, 2.2657375608f, 2.2662246942f, - 2.2667118102f, 2.2671989087f, 2.2676859898f, 2.2681730535f, 2.2686600998f, - 2.2691471287f, 2.2696341402f, 2.2701211343f, 2.2706081111f, 2.2710950705f, - 2.2715820125f, 2.2720689373f, 2.2725558447f, 2.2730427347f, 2.2735296075f, - 2.2740164630f, 2.2745033013f, 2.2749901222f, 2.2754769259f, 2.2759637123f, - 2.2764504816f, 2.2769372335f, 2.2774239683f, 2.2779106859f, 2.2783973862f, - 2.2788840694f, 2.2793707354f, 2.2798573843f, 2.2803440160f, 2.2808306305f, - 2.2813172279f, 2.2818038082f, 2.2822903714f, 2.2827769175f, 2.2832634465f, - 2.2837499584f, 2.2842364533f, 2.2847229311f, 2.2852093919f, 2.2856958356f, - 2.2861822623f, 2.2866686719f, 2.2871550646f, 2.2876414403f, 2.2881277990f, - 2.2886141407f, 2.2891004655f, 2.2895867733f, 2.2900730641f, 2.2905593381f, - 2.2910455951f, 2.2915318352f, 2.2920180584f, 2.2925042647f, 2.2929904541f, - 2.2934766267f, 2.2939627824f, 2.2944489212f, 2.2949350432f, 2.2954211484f, - 2.2959072368f, 2.2963933083f, 2.2968793631f, 2.2973654011f, 2.2978514223f, - 2.2983374267f, 2.2988234144f, 2.2993093853f, 2.2997953395f, 2.3002812770f, - 2.3007671977f, 2.3012531018f, 2.3017389891f, 2.3022248598f, 2.3027107138f, - 2.3031965512f, 2.3036823718f, 2.3041681759f, 2.3046539633f, 2.3051397341f, - 2.3056254882f, 2.3061112258f, 2.3065969468f, 2.3070826512f, 2.3075683390f, - 2.3080540102f, 2.3085396650f, 2.3090253031f, 2.3095109247f, 2.3099965299f, - 2.3104821185f, 2.3109676906f, 2.3114532462f, 2.3119387853f, 2.3124243079f, - 2.3129098141f, 2.3133953039f, 2.3138807772f, 2.3143662340f, 2.3148516745f, - 2.3153370985f, 2.3158225062f, 2.3163078974f, 2.3167932723f, 2.3172786307f, - 2.3177639729f, 2.3182492987f, 2.3187346081f, 2.3192199012f, 2.3197051780f, - 2.3201904384f, 2.3206756826f, 2.3211609105f, 2.3216461221f, 2.3221313174f, - 2.3226164965f, 2.3231016593f, 2.3235868059f, 2.3240719362f, 2.3245570503f, - 2.3250421482f, 2.3255272299f, 2.3260122954f, 2.3264973447f, 2.3269823779f, - 2.3274673949f, 2.3279523957f, 2.3284373804f, 2.3289223489f, 2.3294073013f, - 2.3298922377f, 2.3303771579f, 2.3308620620f, 2.3313469500f, 2.3318318220f, - 2.3323166778f, 2.3328015177f, 2.3332863415f, 2.3337711492f, 2.3342559409f, - 2.3347407166f, 2.3352254763f, 2.3357102200f, 2.3361949477f, 2.3366796595f, - 2.3371643552f, 2.3376490350f, 2.3381336989f, 2.3386183468f, 2.3391029788f, - 2.3395875948f, 2.3400721950f, 2.3405567792f, 2.3410413476f, 2.3415259001f, - 2.3420104367f, 2.3424949574f, 2.3429794623f, 2.3434639514f, 2.3439484246f, - 2.3444328819f, 2.3449173235f, 2.3454017493f, 2.3458861592f, 2.3463705534f, - 2.3468549318f, 2.3473392945f, 2.3478236413f, 2.3483079725f, 2.3487922879f, - 2.3492765875f, 2.3497608715f, 2.3502451397f, 2.3507293922f, 2.3512136291f, - 2.3516978502f, 2.3521820557f, 2.3526662455f, 2.3531504197f, 2.3536345782f, - 2.3541187211f, 2.3546028483f, 2.3550869600f, 2.3555710560f, 2.3560551364f, - 2.3565392013f, 2.3570232506f, 2.3575072843f, 2.3579913024f, 2.3584753050f, - 2.3589592920f, 2.3594432636f, 2.3599272196f, 2.3604111600f, 2.3608950850f, - 2.3613789945f, 2.3618628885f, 2.3623467670f, 2.3628306301f, 2.3633144777f, - 2.3637983098f, 2.3642821265f, 2.3647659278f, 2.3652497136f, 2.3657334841f, - 2.3662172391f, 2.3667009788f, 2.3671847030f, 2.3676684119f, 2.3681521055f, - 2.3686357836f, 2.3691194465f, 2.3696030939f, 2.3700867261f, 2.3705703429f, - 2.3710539445f, 2.3715375307f, 2.3720211016f, 2.3725046573f, 2.3729881976f, - 2.3734717228f, 2.3739552326f, 2.3744387272f, 2.3749222066f, 2.3754056707f, - 2.3758891197f, 2.3763725534f, 2.3768559719f, 2.3773393752f, 2.3778227634f, - 2.3783061363f, 2.3787894941f, 2.3792728368f, 2.3797561643f, 2.3802394766f, - 2.3807227739f, 2.3812060560f, 2.3816893230f, 2.3821725749f, 2.3826558117f, - 2.3831390334f, 2.3836222401f, 2.3841054317f, 2.3845886082f, 2.3850717697f, - 2.3855549162f, 2.3860380476f, 2.3865211640f, 2.3870042653f, 2.3874873517f, - 2.3879704231f, 2.3884534795f, 2.3889365209f, 2.3894195474f, 2.3899025589f, - 2.3903855555f, 2.3908685371f, 2.3913515038f, 2.3918344555f, 2.3923173924f, - 2.3928003143f, 2.3932832213f, 2.3937661135f, 2.3942489908f, 2.3947318532f, - 2.3952147007f, 2.3956975334f, 2.3961803513f, 2.3966631543f, 2.3971459425f, - 2.3976287159f, 2.3981114744f, 2.3985942182f, 2.3990769472f, 2.3995596614f, - 2.4000423608f, 2.4005250455f, 2.4010077154f, 2.4014903705f, 2.4019730109f, - 2.4024556366f, 2.4029382476f, 2.4034208439f, 2.4039034254f, 2.4043859923f, - 2.4048685445f, 2.4053510820f, 2.4058336048f, 2.4063161130f, 2.4067986065f, - 2.4072810854f, 2.4077635496f, 2.4082459992f, 2.4087284343f, 2.4092108547f, - 2.4096932605f, 2.4101756517f, 2.4106580283f, 2.4111403903f, 2.4116227378f, - 2.4121050708f, 2.4125873892f, 2.4130696930f, 2.4135519823f, 2.4140342571f, - 2.4145165174f, 2.4149987632f, 2.4154809945f, 2.4159632113f, 2.4164454136f, - 2.4169276014f, 2.4174097748f, 2.4178919338f, 2.4183740783f, 2.4188562083f, - 2.4193383239f, 2.4198204251f, 2.4203025119f, 2.4207845843f, 2.4212666423f, - 2.4217486860f, 2.4222307152f, 2.4227127301f, 2.4231947306f, 2.4236767167f, - 2.4241586886f, 2.4246406460f, 2.4251225892f, 2.4256045180f, 2.4260864326f, - 2.4265683328f, 2.4270502187f, 2.4275320904f, 2.4280139478f, 2.4284957909f, - 2.4289776197f, 2.4294594344f, 2.4299412347f, 2.4304230208f, 2.4309047927f, - 2.4313865504f, 2.4318682939f, 2.4323500232f, 2.4328317383f, 2.4333134392f, - 2.4337951259f, 2.4342767985f, 2.4347584569f, 2.4352401011f, 2.4357217312f, - 2.4362033472f, 2.4366849491f, 2.4371665368f, 2.4376481104f, 2.4381296700f, - 2.4386112154f, 2.4390927467f, 2.4395742640f, 2.4400557672f, 2.4405372564f, - 2.4410187315f, 2.4415001925f, 2.4419816395f, 2.4424630725f, 2.4429444915f, - 2.4434258965f, 2.4439072874f, 2.4443886644f, 2.4448700274f, 2.4453513764f, - 2.4458327114f, 2.4463140325f, 2.4467953396f, 2.4472766328f, 2.4477579121f, - 2.4482391774f, 2.4487204288f, 2.4492016663f, 2.4496828899f, 2.4501640995f, - 2.4506452953f, 2.4511264773f, 2.4516076453f, 2.4520887995f, 2.4525699398f, - 2.4530510663f, 2.4535321789f, 2.4540132778f, 2.4544943627f, 2.4549754339f, - 2.4554564913f, 2.4559375349f, 2.4564185646f, 2.4568995806f, 2.4573805829f, - 2.4578615713f, 2.4583425460f, 2.4588235070f, 2.4593044542f, 2.4597853876f, - 2.4602663074f, 2.4607472134f, 2.4612281057f, 2.4617089843f, 2.4621898493f, - 2.4626707005f, 2.4631515380f, 2.4636323619f, 2.4641131721f, 2.4645939687f, - 2.4650747516f, 2.4655555209f, 2.4660362766f, 2.4665170186f, 2.4669977470f, - 2.4674784618f, 2.4679591630f, 2.4684398506f, 2.4689205247f, 2.4694011851f, - 2.4698818320f, 2.4703624653f, 2.4708430851f, 2.4713236913f, 2.4718042840f, - 2.4722848632f, 2.4727654288f, 2.4732459810f, 2.4737265196f, 2.4742070447f, - 2.4746875564f, 2.4751680546f, 2.4756485392f, 2.4761290105f, 2.4766094682f, - 2.4770899126f, 2.4775703434f, 2.4780507609f, 2.4785311649f, 2.4790115555f, - 2.4794919327f, 2.4799722964f, 2.4804526468f, 2.4809329838f, 2.4814133075f, - 2.4818936177f, 2.4823739146f, 2.4828541981f, 2.4833344683f, 2.4838147251f, - 2.4842949686f, 2.4847751988f, 2.4852554156f, 2.4857356192f, 2.4862158094f, - 2.4866959864f, 2.4871761501f, 2.4876563004f, 2.4881364375f, 2.4886165614f, - 2.4890966720f, 2.4895767693f, 2.4900568534f, 2.4905369243f, 2.4910169819f, - 2.4914970263f, 2.4919770576f, 2.4924570756f, 2.4929370804f, 2.4934170720f, - 2.4938970504f, 2.4943770157f, 2.4948569678f, 2.4953369068f, 2.4958168326f, - 2.4962967452f, 2.4967766447f, 2.4972565311f, 2.4977364044f, 2.4982162646f, - 2.4986961116f, 2.4991759456f, 2.4996557665f, 2.5001355743f, 2.5006153690f, - 2.5010951506f, 2.5015749192f, 2.5020546748f, 2.5025344172f, 2.5030141467f, - 2.5034938631f, 2.5039735665f, 2.5044532569f, 2.5049329343f, 2.5054125987f, - 2.5058922501f, 2.5063718885f, 2.5068515140f, 2.5073311264f, 2.5078107259f, - 2.5082903125f, 2.5087698861f, 2.5092494467f, 2.5097289945f, 2.5102085293f, - 2.5106880512f, 2.5111675601f, 2.5116470562f, 2.5121265394f, 2.5126060097f, - 2.5130854671f, 2.5135649117f, 2.5140443433f, 2.5145237622f, 2.5150031681f, - 2.5154825613f, 2.5159619415f, 2.5164413090f, 2.5169206636f, 2.5174000055f, - 2.5178793345f, 2.5183586507f, 2.5188379541f, 2.5193172448f, 2.5197965227f, - 2.5202757878f, 2.5207550401f, 2.5212342797f, 2.5217135065f, 2.5221927206f, - 2.5226719220f, 2.5231511106f, 2.5236302865f, 2.5241094497f, 2.5245886002f, - 2.5250677380f, 2.5255468631f, 2.5260259756f, 2.5265050753f, 2.5269841624f, - 2.5274632368f, 2.5279422986f, 2.5284213477f, 2.5289003842f, 2.5293794081f, - 2.5298584193f, 2.5303374180f, 2.5308164040f, 2.5312953774f, 2.5317743382f, - 2.5322532864f, 2.5327322220f, 2.5332111451f, 2.5336900556f, 2.5341689536f, - 2.5346478389f, 2.5351267118f, 2.5356055721f, 2.5360844199f, 2.5365632551f, - 2.5370420779f, 2.5375208881f, 2.5379996858f, 2.5384784711f, 2.5389572438f, - 2.5394360041f, 2.5399147518f, 2.5403934872f, 2.5408722100f, 2.5413509204f, - 2.5418296184f, 2.5423083039f, 2.5427869770f, 2.5432656377f, 2.5437442859f, - 2.5442229218f, 2.5447015452f, 2.5451801563f, 2.5456587549f, 2.5461373412f, - 2.5466159151f, 2.5470944767f, 2.5475730258f, 2.5480515626f, 2.5485300871f, - 2.5490085993f, 2.5494870991f, 2.5499655865f, 2.5504440617f, 2.5509225245f, - 2.5514009751f, 2.5518794133f, 2.5523578393f, 2.5528362530f, 2.5533146544f, - 2.5537930435f, 2.5542714204f, 2.5547497850f, 2.5552281373f, 2.5557064775f, - 2.5561848053f, 2.5566631210f, 2.5571414244f, 2.5576197157f, 2.5580979947f, - 2.5585762615f, 2.5590545161f, 2.5595327586f, 2.5600109888f, 2.5604892069f, - 2.5609674129f, 2.5614456066f, 2.5619237882f, 2.5624019577f, 2.5628801150f, - 2.5633582602f, 2.5638363933f, 2.5643145143f, 2.5647926231f, 2.5652707199f, - 2.5657488045f, 2.5662268771f, 2.5667049376f, 2.5671829860f, 2.5676610223f, - 2.5681390466f, 2.5686170588f, 2.5690950590f, 2.5695730471f, 2.5700510232f, - 2.5705289873f, 2.5710069393f, 2.5714848794f, 2.5719628074f, 2.5724407234f, - 2.5729186274f, 2.5733965195f, 2.5738743995f, 2.5743522676f, 2.5748301238f, - 2.5753079679f, 2.5757858001f, 2.5762636204f, 2.5767414287f, 2.5772192251f, - 2.5776970096f, 2.5781747821f, 2.5786525427f, 2.5791302915f, 2.5796080283f, - 2.5800857532f, 2.5805634663f, 2.5810411674f, 2.5815188567f, 2.5819965342f, - 2.5824741997f, 2.5829518535f, 2.5834294953f, 2.5839071254f, 2.5843847436f, - 2.5848623500f, 2.5853399445f, 2.5858175273f, 2.5862950982f, 2.5867726574f, - 2.5872502047f, 2.5877277403f, 2.5882052641f, 2.5886827761f, 2.5891602763f, - 2.5896377648f, 2.5901152415f, 2.5905927065f, 2.5910701598f, 2.5915476013f, - 2.5920250311f, 2.5925024492f, 2.5929798555f, 2.5934572502f, 2.5939346332f, - 2.5944120044f, 2.5948893640f, 2.5953667119f, 2.5958440481f, 2.5963213727f, - 2.5967986856f, 2.5972759868f, 2.5977532764f, 2.5982305544f, 2.5987078207f, - 2.5991850754f, 2.5996623185f, 2.6001395500f, 2.6006167698f, 2.6010939781f, - 2.6015711747f, 2.6020483598f, 2.6025255333f, 2.6030026952f, 2.6034798456f, - 2.6039569844f, 2.6044341116f, 2.6049112273f, 2.6053883314f, 2.6058654240f, - 2.6063425051f, 2.6068195746f, 2.6072966327f, 2.6077736792f, 2.6082507142f, - 2.6087277377f, 2.6092047498f, 2.6096817503f, 2.6101587394f, 2.6106357170f, - 2.6111126831f, 2.6115896378f, 2.6120665810f, 2.6125435128f, 2.6130204332f, - 2.6134973421f, 2.6139742396f, 2.6144511256f, 2.6149280003f, 2.6154048635f, - 2.6158817154f, 2.6163585558f, 2.6168353849f, 2.6173122025f, 2.6177890088f, - 2.6182658038f, 2.6187425873f, 2.6192193596f, 2.6196961204f, 2.6201728699f, - 2.6206496081f, 2.6211263350f, 2.6216030505f, 2.6220797547f, 2.6225564476f, - 2.6230331292f, 2.6235097995f, 2.6239864585f, 2.6244631062f, 2.6249397427f, - 2.6254163678f, 2.6258929817f, 2.6263695844f, 2.6268461758f, 2.6273227559f, - 2.6277993248f, 2.6282758824f, 2.6287524289f, 2.6292289641f, 2.6297054881f, - 2.6301820008f, 2.6306585024f, 2.6311349928f, 2.6316114720f, 2.6320879399f, - 2.6325643968f, 2.6330408424f, 2.6335172769f, 2.6339937002f, 2.6344701124f, - 2.6349465134f, 2.6354229032f, 2.6358992820f, 2.6363756496f, 2.6368520061f, - 2.6373283514f, 2.6378046857f, 2.6382810088f, 2.6387573209f, 2.6392336218f, - 2.6397099117f, 2.6401861905f, 2.6406624582f, 2.6411387149f, 2.6416149604f, - 2.6420911950f, 2.6425674185f, 2.6430436309f, 2.6435198323f, 2.6439960227f, - 2.6444722020f, 2.6449483704f, 2.6454245277f, 2.6459006740f, 2.6463768093f, - 2.6468529336f, 2.6473290470f, 2.6478051493f, 2.6482812407f, 2.6487573211f, - 2.6492333905f, 2.6497094490f, 2.6501854966f, 2.6506615332f, 2.6511375588f, - 2.6516135735f, 2.6520895773f, 2.6525655702f, 2.6530415521f, 2.6535175232f, - 2.6539934833f, 2.6544694326f, 2.6549453710f, 2.6554212984f, 2.6558972150f, - 2.6563731208f, 2.6568490156f, 2.6573248996f, 2.6578007728f, 2.6582766351f, - 2.6587524865f, 2.6592283271f, 2.6597041569f, 2.6601799759f, 2.6606557840f, - 2.6611315814f, 2.6616073679f, 2.6620831437f, 2.6625589086f, 2.6630346627f, - 2.6635104061f, 2.6639861387f, 2.6644618605f, 2.6649375716f, 2.6654132719f, - 2.6658889614f, 2.6663646403f, 2.6668403083f, 2.6673159657f, 2.6677916123f, - 2.6682672481f, 2.6687428733f, 2.6692184878f, 2.6696940915f, 2.6701696846f, - 2.6706452669f, 2.6711208386f, 2.6715963996f, 2.6720719499f, 2.6725474896f, - 2.6730230186f, 2.6734985369f, 2.6739740446f, 2.6744495416f, 2.6749250280f, - 2.6754005038f, 2.6758759689f, 2.6763514234f, 2.6768268673f, 2.6773023006f, - 2.6777777233f, 2.6782531354f, 2.6787285369f, 2.6792039278f, 2.6796793081f, - 2.6801546779f, 2.6806300371f, 2.6811053857f, 2.6815807238f, 2.6820560513f, - 2.6825313683f, 2.6830066747f, 2.6834819706f, 2.6839572560f, 2.6844325308f, - 2.6849077951f, 2.6853830490f, 2.6858582923f, 2.6863335251f, 2.6868087474f, - 2.6872839593f, 2.6877591606f, 2.6882343515f, 2.6887095319f, 2.6891847019f, - 2.6896598614f, 2.6901350104f, 2.6906101490f, 2.6910852772f, 2.6915603949f, - 2.6920355022f, 2.6925105991f, 2.6929856855f, 2.6934607615f, 2.6939358272f, - 2.6944108824f, 2.6948859272f, 2.6953609617f, 2.6958359858f, 2.6963109995f, - 2.6967860028f, 2.6972609957f, 2.6977359783f, 2.6982109505f, 2.6986859124f, - 2.6991608640f, 2.6996358052f, 2.7001107361f, 2.7005856566f, 2.7010605668f, - 2.7015354667f, 2.7020103564f, 2.7024852357f, 2.7029601047f, 2.7034349634f, - 2.7039098118f, 2.7043846499f, 2.7048594778f, 2.7053342954f, 2.7058091028f, - 2.7062838998f, 2.7067586867f, 2.7072334632f, 2.7077082296f, 2.7081829857f, - 2.7086577316f, 2.7091324672f, 2.7096071927f, 2.7100819079f, 2.7105566129f, - 2.7110313077f, 2.7115059923f, 2.7119806668f, 2.7124553310f, 2.7129299851f, - 2.7134046290f, 2.7138792627f, 2.7143538862f, 2.7148284996f, 2.7153031029f, - 2.7157776960f, 2.7162522790f, 2.7167268518f, 2.7172014145f, 2.7176759671f, - 2.7181505095f, 2.7186250419f, 2.7190995641f, 2.7195740763f, 2.7200485783f, - 2.7205230703f, 2.7209975522f, 2.7214720240f, 2.7219464857f, 2.7224209374f, - 2.7228953789f, 2.7233698105f, 2.7238442320f, 2.7243186434f, 2.7247930448f, - 2.7252674362f, 2.7257418175f, 2.7262161888f, 2.7266905501f, 2.7271649014f, - 2.7276392427f, 2.7281135740f, 2.7285878952f, 2.7290622065f, 2.7295365078f, - 2.7300107992f, 2.7304850805f, 2.7309593519f, 2.7314336133f, 2.7319078648f, - 2.7323821063f, 2.7328563379f, 2.7333305595f, 2.7338047712f, 2.7342789729f, - 2.7347531648f, 2.7352273467f, 2.7357015187f, 2.7361756808f, 2.7366498329f, - 2.7371239752f, 2.7375981076f, 2.7380722301f, 2.7385463428f, 2.7390204455f, - 2.7394945384f, 2.7399686214f, 2.7404426946f, 2.7409167579f, 2.7413908113f, - 2.7418648549f, 2.7423388887f, 2.7428129127f, 2.7432869268f, 2.7437609311f, - 2.7442349255f, 2.7447089102f, 2.7451828850f, 2.7456568501f, 2.7461308054f, - 2.7466047508f, 2.7470786865f, 2.7475526124f, 2.7480265286f, 2.7485004349f, - 2.7489743315f, 2.7494482184f, 2.7499220955f, 2.7503959628f, 2.7508698204f, - 2.7513436683f, 2.7518175064f, 2.7522913348f, 2.7527651535f, 2.7532389625f, - 2.7537127618f, 2.7541865513f, 2.7546603312f, 2.7551341014f, 2.7556078619f, - 2.7560816127f, 2.7565553538f, 2.7570290852f, 2.7575028070f, 2.7579765191f, - 2.7584502216f, 2.7589239144f, 2.7593975976f, 2.7598712711f, 2.7603449350f, - 2.7608185892f, 2.7612922339f, 2.7617658689f, 2.7622394943f, 2.7627131101f, - 2.7631867162f, 2.7636603128f, 2.7641338998f, 2.7646074772f, 2.7650810450f, - 2.7655546033f, 2.7660281520f, 2.7665016911f, 2.7669752206f, 2.7674487406f, - 2.7679222510f, 2.7683957519f, 2.7688692432f, 2.7693427251f, 2.7698161973f, - 2.7702896601f, 2.7707631133f, 2.7712365570f, 2.7717099912f, 2.7721834159f, - 2.7726568311f, 2.7731302368f, 2.7736036330f, 2.7740770198f, 2.7745503970f, - 2.7750237648f, 2.7754971231f, 2.7759704720f, 2.7764438114f, 2.7769171413f, - 2.7773904618f, 2.7778637728f, 2.7783370744f, 2.7788103666f, 2.7792836493f, - 2.7797569227f, 2.7802301866f, 2.7807034411f, 2.7811766862f, 2.7816499218f, - 2.7821231481f, 2.7825963650f, 2.7830695725f, 2.7835427707f, 2.7840159594f, - 2.7844891388f, 2.7849623088f, 2.7854354695f, 2.7859086208f, 2.7863817627f, - 2.7868548953f, 2.7873280186f, 2.7878011325f, 2.7882742371f, 2.7887473324f, - 2.7892204183f, 2.7896934949f, 2.7901665623f, 2.7906396203f, 2.7911126690f, - 2.7915857084f, 2.7920587386f, 2.7925317594f, 2.7930047710f, 2.7934777733f, - 2.7939507663f, 2.7944237501f, 2.7948967246f, 2.7953696898f, 2.7958426458f, - 2.7963155925f, 2.7967885301f, 2.7972614583f, 2.7977343774f, 2.7982072872f, - 2.7986801878f, 2.7991530792f, 2.7996259614f, 2.8000988344f, 2.8005716981f, - 2.8010445527f, 2.8015173981f, 2.8019902343f, 2.8024630613f, 2.8029358792f, - 2.8034086879f, 2.8038814874f, 2.8043542778f, 2.8048270590f, 2.8052998310f, - 2.8057725939f, 2.8062453477f, 2.8067180923f, 2.8071908278f, 2.8076635542f, - 2.8081362715f, 2.8086089796f, 2.8090816787f, 2.8095543686f, 2.8100270494f, - 2.8104997212f, 2.8109723838f, 2.8114450374f, 2.8119176819f, 2.8123903173f, - 2.8128629436f, 2.8133355609f, 2.8138081691f, 2.8142807682f, 2.8147533583f, - 2.8152259394f, 2.8156985114f, 2.8161710744f, 2.8166436283f, 2.8171161732f, - 2.8175887091f, 2.8180612360f, 2.8185337539f, 2.8190062628f, 2.8194787626f, - 2.8199512535f, 2.8204237354f, 2.8208962083f, 2.8213686722f, 2.8218411271f, - 2.8223135731f, 2.8227860100f, 2.8232584381f, 2.8237308571f, 2.8242032672f, - 2.8246756684f, 2.8251480606f, 2.8256204439f, 2.8260928183f, 2.8265651837f, - 2.8270375402f, 2.8275098877f, 2.8279822264f, 2.8284545562f, 2.8289268770f, - 2.8293991890f, 2.8298714920f, 2.8303437862f, 2.8308160714f, 2.8312883478f, - 2.8317606154f, 2.8322328740f, 2.8327051238f, 2.8331773647f, 2.8336495968f, - 2.8341218200f, 2.8345940343f, 2.8350662399f, 2.8355384365f, 2.8360106244f, - 2.8364828034f, 2.8369549736f, 2.8374271350f, 2.8378992876f, 2.8383714313f, - 2.8388435663f, 2.8393156924f, 2.8397878098f, 2.8402599184f, 2.8407320181f, - 2.8412041092f, 2.8416761914f, 2.8421482648f, 2.8426203295f, 2.8430923855f, - 2.8435644326f, 2.8440364711f, 2.8445085007f, 2.8449805217f, 2.8454525338f, - 2.8459245373f, 2.8463965320f, 2.8468685181f, 2.8473404953f, 2.8478124639f, - 2.8482844238f, 2.8487563749f, 2.8492283174f, 2.8497002512f, 2.8501721762f, - 2.8506440926f, 2.8511160003f, 2.8515878994f, 2.8520597897f, 2.8525316714f, - 2.8530035444f, 2.8534754088f, 2.8539472645f, 2.8544191116f, 2.8548909500f, - 2.8553627798f, 2.8558346010f, 2.8563064135f, 2.8567782174f, 2.8572500126f, - 2.8577217993f, 2.8581935774f, 2.8586653468f, 2.8591371076f, 2.8596088599f, - 2.8600806035f, 2.8605523386f, 2.8610240651f, 2.8614957830f, 2.8619674923f, - 2.8624391930f, 2.8629108852f, 2.8633825688f, 2.8638542439f, 2.8643259104f, - 2.8647975684f, 2.8652692179f, 2.8657408587f, 2.8662124911f, 2.8666841149f, - 2.8671557303f, 2.8676273370f, 2.8680989353f, 2.8685705251f, 2.8690421064f, - 2.8695136791f, 2.8699852434f, 2.8704567992f, 2.8709283464f, 2.8713998853f, - 2.8718714156f, 2.8723429374f, 2.8728144508f, 2.8732859557f, 2.8737574522f, - 2.8742289402f, 2.8747004198f, 2.8751718909f, 2.8756433536f, 2.8761148078f, - 2.8765862536f, 2.8770576910f, 2.8775291199f, 2.8780005404f, 2.8784719526f, - 2.8789433563f, 2.8794147516f, 2.8798861385f, 2.8803575170f, 2.8808288871f, - 2.8813002488f, 2.8817716022f, 2.8822429472f, 2.8827142837f, 2.8831856120f, - 2.8836569318f, 2.8841282433f, 2.8845995465f, 2.8850708413f, 2.8855421277f, - 2.8860134058f, 2.8864846756f, 2.8869559371f, 2.8874271902f, 2.8878984349f, - 2.8883696714f, 2.8888408996f, 2.8893121194f, 2.8897833309f, 2.8902545342f, - 2.8907257291f, 2.8911969158f, 2.8916680941f, 2.8921392642f, 2.8926104260f, - 2.8930815795f, 2.8935527247f, 2.8940238617f, 2.8944949904f, 2.8949661109f, - 2.8954372231f, 2.8959083271f, 2.8963794228f, 2.8968505103f, 2.8973215895f, - 2.8977926605f, 2.8982637233f, 2.8987347779f, 2.8992058242f, 2.8996768624f, - 2.9001478923f, 2.9006189140f, 2.9010899275f, 2.9015609329f, 2.9020319300f, - 2.9025029190f, 2.9029738997f, 2.9034448723f, 2.9039158367f, 2.9043867930f, - 2.9048577411f, 2.9053286810f, 2.9057996128f, 2.9062705364f, 2.9067414519f, - 2.9072123592f, 2.9076832584f, 2.9081541495f, 2.9086250324f, 2.9090959072f, - 2.9095667739f, 2.9100376324f, 2.9105084829f, 2.9109793252f, 2.9114501595f, - 2.9119209856f, 2.9123918037f, 2.9128626136f, 2.9133334155f, 2.9138042093f, - 2.9142749950f, 2.9147457727f, 2.9152165423f, 2.9156873038f, 2.9161580572f, - 2.9166288026f, 2.9170995400f, 2.9175702693f, 2.9180409905f, 2.9185117037f, - 2.9189824089f, 2.9194531061f, 2.9199237952f, 2.9203944763f, 2.9208651494f, - 2.9213358145f, 2.9218064715f, 2.9222771206f, 2.9227477617f, 2.9232183947f, - 2.9236890198f, 2.9241596369f, 2.9246302460f, 2.9251008472f, 2.9255714403f, - 2.9260420255f, 2.9265126027f, 2.9269831720f, 2.9274537333f, 2.9279242867f, - 2.9283948321f, 2.9288653695f, 2.9293358990f, 2.9298064206f, 2.9302769343f, - 2.9307474400f, 2.9312179378f, 2.9316884277f, 2.9321589097f, 2.9326293838f, - 2.9330998499f, 2.9335703082f, 2.9340407585f, 2.9345112010f, 2.9349816356f, - 2.9354520623f, 2.9359224811f, 2.9363928920f, 2.9368632951f, 2.9373336903f, - 2.9378040776f, 2.9382744571f, 2.9387448287f, 2.9392151925f, 2.9396855484f, - 2.9401558965f, 2.9406262367f, 2.9410965691f, 2.9415668937f, 2.9420372104f, - 2.9425075194f, 2.9429778205f, 2.9434481138f, 2.9439183993f, 2.9443886770f, - 2.9448589469f, 2.9453292089f, 2.9457994632f, 2.9462697097f, 2.9467399485f, - 2.9472101794f, 2.9476804026f, 2.9481506180f, 2.9486208256f, 2.9490910255f, - 2.9495612176f, 2.9500314020f, 2.9505015786f, 2.9509717474f, 2.9514419085f, - 2.9519120619f, 2.9523822075f, 2.9528523455f, 2.9533224757f, 2.9537925981f, - 2.9542627129f, 2.9547328199f, 2.9552029192f, 2.9556730108f, 2.9561430948f, - 2.9566131710f, 2.9570832395f, 2.9575533004f, 2.9580233535f, 2.9584933990f, - 2.9589634368f, 2.9594334669f, 2.9599034894f, 2.9603735042f, 2.9608435113f, - 2.9613135108f, 2.9617835026f, 2.9622534868f, 2.9627234633f, 2.9631934322f, - 2.9636633935f, 2.9641333471f, 2.9646032931f, 2.9650732315f, 2.9655431623f, - 2.9660130854f, 2.9664830010f, 2.9669529089f, 2.9674228092f, 2.9678927020f, - 2.9683625871f, 2.9688324646f, 2.9693023346f, 2.9697721970f, 2.9702420518f, - 2.9707118990f, 2.9711817386f, 2.9716515707f, 2.9721213952f, 2.9725912122f, - 2.9730610216f, 2.9735308235f, 2.9740006178f, 2.9744704046f, 2.9749401838f, - 2.9754099555f, 2.9758797197f, 2.9763494763f, 2.9768192254f, 2.9772889670f, - 2.9777587011f, 2.9782284277f, 2.9786981468f, 2.9791678584f, 2.9796375624f, - 2.9801072590f, 2.9805769481f, 2.9810466297f, 2.9815163038f, 2.9819859705f, - 2.9824556296f, 2.9829252814f, 2.9833949256f, 2.9838645624f, 2.9843341917f, - 2.9848038135f, 2.9852734280f, 2.9857430349f, 2.9862126344f, 2.9866822265f, - 2.9871518112f, 2.9876213884f, 2.9880909582f, 2.9885605206f, 2.9890300755f, - 2.9894996231f, 2.9899691632f, 2.9904386959f, 2.9909082213f, 2.9913777392f, - 2.9918472497f, 2.9923167529f, 2.9927862486f, 2.9932557370f, 2.9937252180f, - 2.9941946916f, 2.9946641578f, 2.9951336167f, 2.9956030682f, 2.9960725124f, - 2.9965419492f, 2.9970113786f, 2.9974808007f, 2.9979502155f, 2.9984196229f, - 2.9988890230f, 2.9993584158f, 2.9998278012f, 3.0002971793f, 3.0007665501f, - 3.0012359136f, 3.0017052697f, 3.0021746186f, 3.0026439601f, 3.0031132943f, - 3.0035826213f, 3.0040519409f, 3.0045212533f, 3.0049905584f, 3.0054598562f, - 3.0059291467f, 3.0063984300f, 3.0068677059f, 3.0073369747f, 3.0078062361f, - 3.0082754903f, 3.0087447372f, 3.0092139769f, 3.0096832094f, 3.0101524346f, - 3.0106216526f, 3.0110908633f, 3.0115600668f, 3.0120292631f, 3.0124984521f, - 3.0129676339f, 3.0134368086f, 3.0139059760f, 3.0143751362f, 3.0148442892f, - 3.0153134350f, 3.0157825736f, 3.0162517050f, 3.0167208292f, 3.0171899462f, - 3.0176590561f, 3.0181281587f, 3.0185972542f, 3.0190663426f, 3.0195354238f, - 3.0200044978f, 3.0204735646f, 3.0209426243f, 3.0214116769f, 3.0218807223f, - 3.0223497605f, 3.0228187916f, 3.0232878156f, 3.0237568325f, 3.0242258422f, - 3.0246948448f, 3.0251638403f, 3.0256328286f, 3.0261018099f, 3.0265707841f, - 3.0270397511f, 3.0275087110f, 3.0279776639f, 3.0284466096f, 3.0289155483f, - 3.0293844799f, 3.0298534044f, 3.0303223218f, 3.0307912321f, 3.0312601354f, - 3.0317290316f, 3.0321979208f, 3.0326668028f, 3.0331356779f, 3.0336045458f, - 3.0340734068f, 3.0345422607f, 3.0350111075f, 3.0354799473f, 3.0359487801f, - 3.0364176058f, 3.0368864246f, 3.0373552363f, 3.0378240409f, 3.0382928386f, - 3.0387616293f, 3.0392304129f, 3.0396991896f, 3.0401679592f, 3.0406367219f, - 3.0411054775f, 3.0415742262f, 3.0420429679f, 3.0425117026f, 3.0429804303f, - 3.0434491511f, 3.0439178649f, 3.0443865717f, 3.0448552716f, 3.0453239645f, - 3.0457926504f, 3.0462613294f, 3.0467300015f, 3.0471986666f, 3.0476673247f, - 3.0481359760f, 3.0486046203f, 3.0490732576f, 3.0495418881f, 3.0500105116f, - 3.0504791282f, 3.0509477379f, 3.0514163407f, 3.0518849366f, 3.0523535255f, - 3.0528221076f, 3.0532906828f, 3.0537592511f, 3.0542278125f, 3.0546963670f, - 3.0551649146f, 3.0556334554f, 3.0561019892f, 3.0565705162f, 3.0570390364f, - 3.0575075497f, 3.0579760561f, 3.0584445557f, 3.0589130484f, 3.0593815342f, - 3.0598500133f, 3.0603184855f, 3.0607869508f, 3.0612554093f, 3.0617238610f, - 3.0621923058f, 3.0626607439f, 3.0631291751f, 3.0635975995f, 3.0640660171f, - 3.0645344279f, 3.0650028318f, 3.0654712290f, 3.0659396194f, 3.0664080030f, - 3.0668763798f, 3.0673447498f, 3.0678131130f, 3.0682814695f, 3.0687498191f, - 3.0692181620f, 3.0696864982f, 3.0701548275f, 3.0706231501f, 3.0710914660f, - 3.0715597751f, 3.0720280774f, 3.0724963730f, 3.0729646619f, 3.0734329440f, - 3.0739012194f, 3.0743694880f, 3.0748377499f, 3.0753060051f, 3.0757742536f, - 3.0762424953f, 3.0767107304f, 3.0771789587f, 3.0776471803f, 3.0781153952f, - 3.0785836035f, 3.0790518050f, 3.0795199998f, 3.0799881879f, 3.0804563694f, - 3.0809245442f, 3.0813927122f, 3.0818608737f, 3.0823290284f, 3.0827971765f, - 3.0832653179f, 3.0837334526f, 3.0842015807f, 3.0846697022f, 3.0851378170f, - 3.0856059251f, 3.0860740266f, 3.0865421215f, 3.0870102097f, 3.0874782913f, - 3.0879463662f, 3.0884144346f, 3.0888824963f, 3.0893505514f, 3.0898185999f, - 3.0902866417f, 3.0907546770f, 3.0912227056f, 3.0916907277f, 3.0921587431f, - 3.0926267520f, 3.0930947543f, 3.0935627500f, 3.0940307391f, 3.0944987216f, - 3.0949666975f, 3.0954346669f, 3.0959026297f, 3.0963705859f, 3.0968385356f, - 3.0973064787f, 3.0977744153f, 3.0982423453f, 3.0987102688f, 3.0991781857f, - 3.0996460960f, 3.1001139999f, 3.1005818972f, 3.1010497879f, 3.1015176722f, - 3.1019855499f, 3.1024534211f, 3.1029212858f, 3.1033891439f, 3.1038569956f, - 3.1043248407f, 3.1047926794f, 3.1052605115f, 3.1057283372f, 3.1061961563f, - 3.1066639690f, 3.1071317752f, 3.1075995749f, 3.1080673681f, 3.1085351548f, - 3.1090029351f, 3.1094707089f, 3.1099384762f, 3.1104062371f, 3.1108739915f, - 3.1113417395f, 3.1118094810f, 3.1122772161f, 3.1127449447f, 3.1132126669f, - 3.1136803826f, 3.1141480919f, 3.1146157948f, 3.1150834912f, 3.1155511812f, - 3.1160188648f, 3.1164865420f, 3.1169542128f, 3.1174218771f, 3.1178895351f, - 3.1183571866f, 3.1188248318f, 3.1192924705f, 3.1197601029f, 3.1202277288f, - 3.1206953484f, 3.1211629616f, 3.1216305684f, 3.1220981689f, 3.1225657629f, - 3.1230333506f, 3.1235009319f, 3.1239685069f, 3.1244360755f, 3.1249036378f, - 3.1253711937f, 3.1258387432f, 3.1263062864f, 3.1267738233f, 3.1272413538f, - 3.1277088780f, 3.1281763958f, 3.1286439073f, 3.1291114125f, 3.1295789114f, - 3.1300464040f, 3.1305138902f, 3.1309813701f, 3.1314488437f, 3.1319163111f, - 3.1323837721f, 3.1328512268f, 3.1333186752f, 3.1337861173f, 3.1342535531f, - 3.1347209827f, 3.1351884060f, 3.1356558229f, 3.1361232337f, 3.1365906381f, - 3.1370580363f, 3.1375254282f, 3.1379928138f, 3.1384601932f, 3.1389275663f, - 3.1393949332f, 3.1398622938f, 3.1403296482f, 3.1407969963f, 3.1412643382f, - 3.1417316739f, 3.1421990033f, 3.1426663265f, 3.1431336435f, 3.1436009543f, - 3.1440682588f, 3.1445355571f, 3.1450028492f, 3.1454701351f, 3.1459374148f, - 3.1464046883f, 3.1468719556f, 3.1473392167f, 3.1478064716f, 3.1482737203f, - 3.1487409628f, 3.1492081992f, 3.1496754294f, 3.1501426533f, 3.1506098712f, - 3.1510770828f, 3.1515442883f, 3.1520114876f, 3.1524786808f, 3.1529458678f, - 3.1534130486f, 3.1538802233f, 3.1543473919f, 3.1548145543f, 3.1552817106f, - 3.1557488607f, 3.1562160047f, 3.1566831425f, 3.1571502743f, 3.1576173999f, - 3.1580845194f, 3.1585516328f, 3.1590187401f, 3.1594858412f, 3.1599529363f, - 3.1604200252f, 3.1608871080f, 3.1613541848f, 3.1618212554f, 3.1622883200f, - 3.1627553785f, 3.1632224309f, 3.1636894772f, 3.1641565174f, 3.1646235515f, - 3.1650905796f, 3.1655576016f, 3.1660246176f, 3.1664916275f, 3.1669586313f, - 3.1674256291f, 3.1678926208f, 3.1683596064f, 3.1688265861f, 3.1692935596f, - 3.1697605272f, 3.1702274887f, 3.1706944442f, 3.1711613936f, 3.1716283370f, - 3.1720952744f, 3.1725622058f, 3.1730291311f, 3.1734960505f, 3.1739629638f, - 3.1744298711f, 3.1748967724f, 3.1753636678f, 3.1758305571f, 3.1762974404f, - 3.1767643177f, 3.1772311891f, 3.1776980544f, 3.1781649138f, 3.1786317672f, - 3.1790986146f, 3.1795654561f, 3.1800322916f, 3.1804991211f, 3.1809659446f, - 3.1814327622f, 3.1818995739f, 3.1823663795f, 3.1828331793f, 3.1832999731f, - 3.1837667609f, 3.1842335428f, 3.1847003188f, 3.1851670888f, 3.1856338529f, - 3.1861006111f, 3.1865673633f, 3.1870341096f, 3.1875008501f, 3.1879675845f, - 3.1884343131f, 3.1889010358f, 3.1893677526f, 3.1898344634f, 3.1903011684f, - 3.1907678674f, 3.1912345606f, 3.1917012479f, 3.1921679293f, 3.1926346048f, - 3.1931012744f, 3.1935679382f, 3.1940345961f, 3.1945012481f, 3.1949678942f, - 3.1954345345f, 3.1959011689f, 3.1963677974f, 3.1968344201f, 3.1973010370f, - 3.1977676480f, 3.1982342531f, 3.1987008524f, 3.1991674459f, 3.1996340335f, - 3.2001006153f, 3.2005671913f, 3.2010337614f, 3.2015003257f, 3.2019668842f, - 3.2024334369f, 3.2028999837f, 3.2033665248f, 3.2038330600f, 3.2042995894f, - 3.2047661131f, 3.2052326309f, 3.2056991429f, 3.2061656492f, 3.2066321496f, - 3.2070986443f, 3.2075651331f, 3.2080316162f, 3.2084980935f, 3.2089645651f, - 3.2094310308f, 3.2098974908f, 3.2103639451f, 3.2108303935f, 3.2112968363f, - 3.2117632732f, 3.2122297044f, 3.2126961299f, 3.2131625496f, 3.2136289635f, - 3.2140953717f, 3.2145617742f, 3.2150281709f, 3.2154945620f, 3.2159609472f, - 3.2164273268f, 3.2168937006f, 3.2173600687f, 3.2178264311f, 3.2182927878f, - 3.2187591388f, 3.2192254840f, 3.2196918236f, 3.2201581575f, 3.2206244856f, - 3.2210908081f, 3.2215571248f, 3.2220234359f, 3.2224897413f, 3.2229560410f, - 3.2234223351f, 3.2238886234f, 3.2243549061f, 3.2248211831f, 3.2252874544f, - 3.2257537201f, 3.2262199801f, 3.2266862345f, 3.2271524832f, 3.2276187262f, - 3.2280849636f, 3.2285511953f, 3.2290174214f, 3.2294836419f, 3.2299498567f, - 3.2304160659f, 3.2308822695f, 3.2313484674f, 3.2318146597f, 3.2322808464f, - 3.2327470274f, 3.2332132029f, 3.2336793727f, 3.2341455369f, 3.2346116955f, - 3.2350778485f, 3.2355439959f, 3.2360101377f, 3.2364762739f, 3.2369424045f, - 3.2374085295f, 3.2378746490f, 3.2383407628f, 3.2388068711f, 3.2392729738f, - 3.2397390709f, 3.2402051624f, 3.2406712484f, 3.2411373288f, 3.2416034037f, - 3.2420694729f, 3.2425355367f, 3.2430015948f, 3.2434676475f, 3.2439336945f, - 3.2443997361f, 3.2448657720f, 3.2453318025f, 3.2457978274f, 3.2462638468f, - 3.2467298606f, 3.2471958689f, 3.2476618717f, 3.2481278690f, 3.2485938607f, - 3.2490598470f, 3.2495258277f, 3.2499918029f, 3.2504577726f, 3.2509237368f, - 3.2513896955f, 3.2518556487f, 3.2523215964f, 3.2527875386f, 3.2532534753f, - 3.2537194066f, 3.2541853323f, 3.2546512526f, 3.2551171674f, 3.2555830767f, - 3.2560489806f, 3.2565148789f, 3.2569807719f, 3.2574466593f, 3.2579125413f, - 3.2583784178f, 3.2588442889f, 3.2593101545f, 3.2597760147f, 3.2602418694f, - 3.2607077187f, 3.2611735626f, 3.2616394010f, 3.2621052340f, 3.2625710615f, - 3.2630368836f, 3.2635027003f, 3.2639685116f, 3.2644343174f, 3.2649001179f, - 3.2653659129f, 3.2658317025f, 3.2662974867f, 3.2667632655f, 3.2672290389f, - 3.2676948069f, 3.2681605695f, 3.2686263267f, 3.2690920785f, 3.2695578250f, - 3.2700235660f, 3.2704893017f, 3.2709550320f, 3.2714207569f, 3.2718864764f, - 3.2723521906f, 3.2728178994f, 3.2732836028f, 3.2737493009f, 3.2742149936f, - 3.2746806809f, 3.2751463629f, 3.2756120396f, 3.2760777109f, 3.2765433768f, - 3.2770090375f, 3.2774746927f, 3.2779403427f, 3.2784059873f, 3.2788716266f, - 3.2793372605f, 3.2798028891f, 3.2802685124f, 3.2807341304f, 3.2811997431f, - 3.2816653505f, 3.2821309525f, 3.2825965492f, 3.2830621407f, 3.2835277268f, - 3.2839933076f, 3.2844588832f, 3.2849244534f, 3.2853900184f, 3.2858555781f, - 3.2863211324f, 3.2867866815f, 3.2872522254f, 3.2877177639f, 3.2881832972f, - 3.2886488252f, 3.2891143479f, 3.2895798654f, 3.2900453776f, 3.2905108845f, - 3.2909763862f, 3.2914418826f, 3.2919073738f, 3.2923728598f, 3.2928383405f, - 3.2933038159f, 3.2937692861f, 3.2942347511f, 3.2947002108f, 3.2951656653f, - 3.2956311146f, 3.2960965587f, 3.2965619975f, 3.2970274311f, 3.2974928595f, - 3.2979582827f, 3.2984237006f, 3.2988891134f, 3.2993545210f, 3.2998199233f, - 3.3002853205f, 3.3007507124f, 3.3012160992f, 3.3016814807f, 3.3021468571f, - 3.3026122283f, 3.3030775943f, 3.3035429551f, 3.3040083108f, 3.3044736612f, - 3.3049390065f, 3.3054043467f, 3.3058696816f, 3.3063350114f, 3.3068003360f, - 3.3072656555f, 3.3077309698f, 3.3081962790f, 3.3086615830f, 3.3091268819f, - 3.3095921756f, 3.3100574642f, 3.3105227476f, 3.3109880259f, 3.3114532991f, - 3.3119185672f, 3.3123838301f, 3.3128490879f, 3.3133143405f, 3.3137795881f, - 3.3142448305f, 3.3147100678f, 3.3151753000f, 3.3156405271f, 3.3161057491f, - 3.3165709660f, 3.3170361777f, 3.3175013844f, 3.3179665860f, 3.3184317825f, - 3.3188969739f, 3.3193621602f, 3.3198273414f, 3.3202925176f, 3.3207576887f, - 3.3212228547f, 3.3216880156f, 3.3221531714f, 3.3226183222f, 3.3230834679f, - 3.3235486086f, 3.3240137442f, 3.3244788747f, 3.3249440002f, 3.3254091206f, - 3.3258742360f, 3.3263393463f, 3.3268044516f, 3.3272695519f, 3.3277346471f, - 3.3281997373f, 3.3286648224f, 3.3291299025f, 3.3295949776f, 3.3300600477f, - 3.3305251127f, 3.3309901727f, 3.3314552277f, 3.3319202777f, 3.3323853227f, - 3.3328503627f, 3.3333153977f, 3.3337804276f, 3.3342454526f, 3.3347104725f, - 3.3351754875f, 3.3356404975f, 3.3361055025f, 3.3365705025f, 3.3370354975f, - 3.3375004875f, 3.3379654726f, 3.3384304526f, 3.3388954278f, 3.3393603979f, - 3.3398253631f, 3.3402903233f, 3.3407552785f, 3.3412202288f, 3.3416851741f, - 3.3421501145f, 3.3426150499f, 3.3430799803f, 3.3435449058f, 3.3440098264f, - 3.3444747421f, 3.3449396527f, 3.3454045585f, 3.3458694593f, 3.3463343552f, - 3.3467992462f, 3.3472641322f, 3.3477290133f, 3.3481938895f, 3.3486587608f, - 3.3491236272f, 3.3495884886f, 3.3500533451f, 3.3505181968f, 3.3509830435f, - 3.3514478853f, 3.3519127223f, 3.3523775543f, 3.3528423814f, 3.3533072037f, - 3.3537720210f, 3.3542368335f, 3.3547016411f, 3.3551664438f, 3.3556312416f, - 3.3560960346f, 3.3565608227f, 3.3570256059f, 3.3574903842f, 3.3579551577f, - 3.3584199263f, 3.3588846901f, 3.3593494490f, 3.3598142030f, 3.3602789522f, - 3.3607436966f, 3.3612084361f, 3.3616731707f, 3.3621379005f, 3.3626026255f, - 3.3630673457f, 3.3635320610f, 3.3639967714f, 3.3644614771f, 3.3649261779f, - 3.3653908739f, 3.3658555651f, 3.3663202514f, 3.3667849330f, 3.3672496097f, - 3.3677142816f, 3.3681789488f, 3.3686436111f, 3.3691082686f, 3.3695729213f, - 3.3700375692f, 3.3705022123f, 3.3709668506f, 3.3714314842f, 3.3718961129f, - 3.3723607369f, 3.3728253561f, 3.3732899705f, 3.3737545801f, 3.3742191850f, - 3.3746837851f, 3.3751483804f, 3.3756129709f, 3.3760775567f, 3.3765421377f, - 3.3770067140f, 3.3774712855f, 3.3779358523f, 3.3784004143f, 3.3788649715f, - 3.3793295240f, 3.3797940718f, 3.3802586148f, 3.3807231531f, 3.3811876867f, - 3.3816522155f, 3.3821167396f, 3.3825812590f, 3.3830457736f, 3.3835102836f, - 3.3839747888f, 3.3844392892f, 3.3849037850f, 3.3853682761f, 3.3858327624f, - 3.3862972441f, 3.3867617210f, 3.3872261932f, 3.3876906608f, 3.3881551236f, - 3.3886195817f, 3.3890840352f, 3.3895484839f, 3.3900129280f, 3.3904773674f, - 3.3909418021f, 3.3914062322f, 3.3918706575f, 3.3923350782f, 3.3927994942f, - 3.3932639055f, 3.3937283122f, 3.3941927142f, 3.3946571116f, 3.3951215043f, - 3.3955858923f, 3.3960502757f, 3.3965146544f, 3.3969790285f, 3.3974433979f, - 3.3979077627f, 3.3983721229f, 3.3988364784f, 3.3993008292f, 3.3997651755f, - 3.4002295171f, 3.4006938541f, 3.4011581864f, 3.4016225142f, 3.4020868373f, - 3.4025511558f, 3.4030154696f, 3.4034797789f, 3.4039440835f, 3.4044083836f, - 3.4048726790f, 3.4053369698f, 3.4058012561f, 3.4062655377f, 3.4067298147f, - 3.4071940872f, 3.4076583550f, 3.4081226183f, 3.4085868770f, 3.4090511311f, - 3.4095153806f, 3.4099796255f, 3.4104438659f, 3.4109081017f, 3.4113723329f, - 3.4118365595f, 3.4123007816f, 3.4127649991f, 3.4132292121f, 3.4136934205f, - 3.4141576243f, 3.4146218236f, 3.4150860183f, 3.4155502085f, 3.4160143941f, - 3.4164785752f, 3.4169427518f, 3.4174069238f, 3.4178710913f, 3.4183352542f, - 3.4187994126f, 3.4192635665f, 3.4197277159f, 3.4201918607f, 3.4206560010f, - 3.4211201368f, 3.4215842681f, 3.4220483948f, 3.4225125171f, 3.4229766348f, - 3.4234407480f, 3.4239048568f, 3.4243689610f, 3.4248330607f, 3.4252971560f, - 3.4257612467f, 3.4262253329f, 3.4266894147f, 3.4271534919f, 3.4276175647f, - 3.4280816330f, 3.4285456968f, 3.4290097562f, 3.4294738110f, 3.4299378614f, - 3.4304019073f, 3.4308659488f, 3.4313299858f, 3.4317940183f, 3.4322580464f, - 3.4327220700f, 3.4331860891f, 3.4336501038f, 3.4341141141f, 3.4345781199f, - 3.4350421212f, 3.4355061181f, 3.4359701106f, 3.4364340986f, 3.4368980822f, - 3.4373620614f, 3.4378260361f, 3.4382900064f, 3.4387539723f, 3.4392179337f, - 3.4396818907f, 3.4401458433f, 3.4406097915f, 3.4410737353f, 3.4415376746f, - 3.4420016096f, 3.4424655401f, 3.4429294663f, 3.4433933880f, 3.4438573054f, - 3.4443212183f, 3.4447851268f, 3.4452490310f, 3.4457129307f, 3.4461768261f, - 3.4466407171f, 3.4471046037f, 3.4475684859f, 3.4480323638f, 3.4484962372f, - 3.4489601063f, 3.4494239710f, 3.4498878314f, 3.4503516874f, 3.4508155390f, - 3.4512793863f, 3.4517432292f, 3.4522070677f, 3.4526709019f, 3.4531347317f, - 3.4535985572f, 3.4540623784f, 3.4545261951f, 3.4549900076f, 3.4554538157f, - 3.4559176195f, 3.4563814189f, 3.4568452140f, 3.4573090048f, 3.4577727912f, - 3.4582365733f, 3.4587003511f, 3.4591641246f, 3.4596278938f, 3.4600916586f, - 3.4605554191f, 3.4610191753f, 3.4614829272f, 3.4619466748f, 3.4624104181f, - 3.4628741571f, 3.4633378918f, 3.4638016222f, 3.4642653483f, 3.4647290701f, - 3.4651927876f, 3.4656565008f, 3.4661202097f, 3.4665839144f, 3.4670476147f, - 3.4675113108f, 3.4679750026f, 3.4684386902f, 3.4689023734f, 3.4693660524f, - 3.4698297272f, 3.4702933976f, 3.4707570638f, 3.4712207258f, 3.4716843834f, - 3.4721480369f, 3.4726116860f, 3.4730753310f, 3.4735389716f, 3.4740026081f, - 3.4744662403f, 3.4749298682f, 3.4753934919f, 3.4758571114f, 3.4763207266f, - 3.4767843376f, 3.4772479444f, 3.4777115469f, 3.4781751452f, 3.4786387393f, - 3.4791023292f, 3.4795659148f, 3.4800294963f, 3.4804930735f, 3.4809566465f, - 3.4814202153f, 3.4818837799f, 3.4823473403f, 3.4828108965f, 3.4832744485f, - 3.4837379963f, 3.4842015399f, 3.4846650793f, 3.4851286145f, 3.4855921455f, - 3.4860556723f, 3.4865191950f, 3.4869827135f, 3.4874462277f, 3.4879097379f, - 3.4883732438f, 3.4888367456f, 3.4893002432f, 3.4897637366f, 3.4902272259f, - 3.4906907110f, 3.4911541919f, 3.4916176687f, 3.4920811413f, 3.4925446098f, - 3.4930080741f, 3.4934715343f, 3.4939349903f, 3.4943984422f, 3.4948618899f, - 3.4953253335f, 3.4957887730f, 3.4962522083f, 3.4967156395f, 3.4971790666f, - 3.4976424895f, 3.4981059083f, 3.4985693230f, 3.4990327335f, 3.4994961400f, - 3.4999595423f, 3.5004229405f, 3.5008863346f, 3.5013497246f, 3.5018131104f, - 3.5022764922f, 3.5027398699f, 3.5032032434f, 3.5036666129f, 3.5041299782f, - 3.5045933395f, 3.5050566967f, 3.5055200498f, 3.5059833988f, 3.5064467437f, - 3.5069100845f, 3.5073734213f, 3.5078367539f, 3.5083000825f, 3.5087634070f, - 3.5092267275f, 3.5096900439f, 3.5101533562f, 3.5106166644f, 3.5110799686f, - 3.5115432687f, 3.5120065648f, 3.5124698568f, 3.5129331447f, 3.5133964286f, - 3.5138597085f, 3.5143229842f, 3.5147862560f, 3.5152495237f, 3.5157127874f, - 3.5161760470f, 3.5166393026f, 3.5171025542f, 3.5175658017f, 3.5180290452f, - 3.5184922846f, 3.5189555201f, 3.5194187515f, 3.5198819789f, 3.5203452023f, - 3.5208084217f, 3.5212716370f, 3.5217348483f, 3.5221980557f, 3.5226612590f, - 3.5231244583f, 3.5235876536f, 3.5240508449f, 3.5245140323f, 3.5249772156f, - 3.5254403949f, 3.5259035702f, 3.5263667416f, 3.5268299089f, 3.5272930723f, - 3.5277562317f, 3.5282193871f, 3.5286825385f, 3.5291456860f, 3.5296088294f, - 3.5300719689f, 3.5305351045f, 3.5309982360f, 3.5314613636f, 3.5319244873f, - 3.5323876069f, 3.5328507227f, 3.5333138344f, 3.5337769422f, 3.5342400461f, - 3.5347031460f, 3.5351662419f, 3.5356293339f, 3.5360924220f, 3.5365555061f, - 3.5370185863f, 3.5374816626f, 3.5379447349f, 3.5384078032f, 3.5388708677f, - 3.5393339282f, 3.5397969848f, 3.5402600375f, 3.5407230862f, 3.5411861311f, - 3.5416491720f, 3.5421122090f, 3.5425752421f, 3.5430382712f, 3.5435012965f, - 3.5439643179f, 3.5444273353f, 3.5448903489f, 3.5453533585f, 3.5458163643f, - 3.5462793661f, 3.5467423641f, 3.5472053582f, 3.5476683484f, 3.5481313347f, - 3.5485943171f, 3.5490572956f, 3.5495202702f, 3.5499832410f, 3.5504462079f, - 3.5509091709f, 3.5513721301f, 3.5518350854f, 3.5522980368f, 3.5527609843f, - 3.5532239280f, 3.5536868678f, 3.5541498038f, 3.5546127359f, 3.5550756642f, - 3.5555385886f, 3.5560015091f, 3.5564644258f, 3.5569273387f, 3.5573902477f, - 3.5578531529f, 3.5583160542f, 3.5587789517f, 3.5592418453f, 3.5597047352f, - 3.5601676212f, 3.5606305033f, 3.5610933817f, 3.5615562562f, 3.5620191269f, - 3.5624819937f, 3.5629448568f, 3.5634077160f, 3.5638705714f, 3.5643334231f, - 3.5647962709f, 3.5652591149f, 3.5657219550f, 3.5661847914f, 3.5666476240f, - 3.5671104528f, 3.5675732778f, 3.5680360990f, 3.5684989164f, 3.5689617300f, - 3.5694245398f, 3.5698873459f, 3.5703501481f, 3.5708129466f, 3.5712757413f, - 3.5717385322f, 3.5722013193f, 3.5726641027f, 3.5731268823f, 3.5735896581f, - 3.5740524301f, 3.5745151984f, 3.5749779630f, 3.5754407237f, 3.5759034807f, - 3.5763662340f, 3.5768289835f, 3.5772917292f, 3.5777544712f, 3.5782172094f, - 3.5786799439f, 3.5791426747f, 3.5796054017f, 3.5800681250f, 3.5805308445f, - 3.5809935603f, 3.5814562724f, 3.5819189807f, 3.5823816853f, 3.5828443862f, - 3.5833070833f, 3.5837697768f, 3.5842324665f, 3.5846951525f, 3.5851578347f, - 3.5856205133f, 3.5860831881f, 3.5865458593f, 3.5870085267f, 3.5874711904f, - 3.5879338504f, 3.5883965067f, 3.5888591593f, 3.5893218083f, 3.5897844535f, - 3.5902470950f, 3.5907097328f, 3.5911723670f, 3.5916349974f, 3.5920976242f, - 3.5925602473f, 3.5930228667f, 3.5934854824f, 3.5939480944f, 3.5944107028f, - 3.5948733075f, 3.5953359085f, 3.5957985059f, 3.5962610996f, 3.5967236896f, - 3.5971862760f, 3.5976488587f, 3.5981114377f, 3.5985740131f, 3.5990365848f, - 3.5994991529f, 3.5999617173f, 3.6004242781f, 3.6008868352f, 3.6013493887f, - 3.6018119386f, 3.6022744848f, 3.6027370273f, 3.6031995663f, 3.6036621016f, - 3.6041246332f, 3.6045871613f, 3.6050496857f, 3.6055122065f, 3.6059747236f, - 3.6064372371f, 3.6068997471f, 3.6073622534f, 3.6078247560f, 3.6082872551f, - 3.6087497506f, 3.6092122424f, 3.6096747307f, 3.6101372153f, 3.6105996963f, - 3.6110621737f, 3.6115246476f, 3.6119871178f, 3.6124495844f, 3.6129120475f, - 3.6133745069f, 3.6138369628f, 3.6142994151f, 3.6147618638f, 3.6152243089f, - 3.6156867504f, 3.6161491883f, 3.6166116227f, 3.6170740535f, 3.6175364807f, - 3.6179989044f, 3.6184613245f, 3.6189237410f, 3.6193861539f, 3.6198485633f, - 3.6203109691f, 3.6207733714f, 3.6212357701f, 3.6216981653f, 3.6221605569f, - 3.6226229449f, 3.6230853294f, 3.6235477104f, 3.6240100878f, 3.6244724617f, - 3.6249348320f, 3.6253971988f, 3.6258595620f, 3.6263219217f, 3.6267842779f, - 3.6272466306f, 3.6277089797f, 3.6281713253f, 3.6286336674f, 3.6290960059f, - 3.6295583410f, 3.6300206725f, 3.6304830005f, 3.6309453249f, 3.6314076459f, - 3.6318699634f, 3.6323322773f, 3.6327945878f, 3.6332568947f, 3.6337191981f, - 3.6341814981f, 3.6346437945f, 3.6351060874f, 3.6355683769f, 3.6360306628f, - 3.6364929453f, 3.6369552243f, 3.6374174997f, 3.6378797717f, 3.6383420402f, - 3.6388043053f, 3.6392665668f, 3.6397288249f, 3.6401910795f, 3.6406533306f, - 3.6411155783f, 3.6415778225f, 3.6420400632f, 3.6425023005f, 3.6429645343f, - 3.6434267646f, 3.6438889915f, 3.6443512149f, 3.6448134349f, 3.6452756514f, - 3.6457378644f, 3.6462000740f, 3.6466622802f, 3.6471244829f, 3.6475866822f, - 3.6480488780f, 3.6485110704f, 3.6489732594f, 3.6494354449f, 3.6498976270f, - 3.6503598056f, 3.6508219808f, 3.6512841526f, 3.6517463210f, 3.6522084859f, - 3.6526706475f, 3.6531328056f, 3.6535949603f, 3.6540571115f, 3.6545192594f, - 3.6549814038f, 3.6554435449f, 3.6559056825f, 3.6563678167f, 3.6568299475f, - 3.6572920749f, 3.6577541989f, 3.6582163196f, 3.6586784368f, 3.6591405506f, - 3.6596026610f, 3.6600647681f, 3.6605268717f, 3.6609889720f, 3.6614510689f, - 3.6619131624f, 3.6623752525f, 3.6628373392f, 3.6632994226f, 3.6637615026f, - 3.6642235792f, 3.6646856524f, 3.6651477223f, 3.6656097888f, 3.6660718519f, - 3.6665339117f, 3.6669959681f, 3.6674580212f, 3.6679200708f, 3.6683821172f, - 3.6688441602f, 3.6693061998f, 3.6697682361f, 3.6702302690f, 3.6706922986f, - 3.6711543249f, 3.6716163478f, 3.6720783673f, 3.6725403835f, 3.6730023964f, - 3.6734644060f, 3.6739264122f, 3.6743884151f, 3.6748504146f, 3.6753124109f, - 3.6757744038f, 3.6762363934f, 3.6766983796f, 3.6771603626f, 3.6776223422f, - 3.6780843185f, 3.6785462915f, 3.6790082612f, 3.6794702276f, 3.6799321906f, - 3.6803941504f, 3.6808561068f, 3.6813180600f, 3.6817800098f, 3.6822419564f, - 3.6827038997f, 3.6831658396f, 3.6836277763f, 3.6840897097f, 3.6845516398f, - 3.6850135666f, 3.6854754901f, 3.6859374103f, 3.6863993273f, 3.6868612410f, - 3.6873231514f, 3.6877850585f, 3.6882469623f, 3.6887088629f, 3.6891707602f, - 3.6896326543f, 3.6900945450f, 3.6905564325f, 3.6910183168f, 3.6914801978f, - 3.6919420755f, 3.6924039500f, 3.6928658212f, 3.6933276891f, 3.6937895539f, - 3.6942514153f, 3.6947132735f, 3.6951751285f, 3.6956369802f, 3.6960988287f, - 3.6965606739f, 3.6970225160f, 3.6974843547f, 3.6979461903f, 3.6984080226f, - 3.6988698516f, 3.6993316775f, 3.6997935001f, 3.7002553195f, 3.7007171357f, - 3.7011789486f, 3.7016407583f, 3.7021025648f, 3.7025643681f, 3.7030261682f, - 3.7034879651f, 3.7039497588f, 3.7044115492f, 3.7048733365f, 3.7053351205f, - 3.7057969013f, 3.7062586790f, 3.7067204534f, 3.7071822247f, 3.7076439927f, - 3.7081057576f, 3.7085675192f, 3.7090292777f, 3.7094910330f, 3.7099527851f, - 3.7104145340f, 3.7108762797f, 3.7113380223f, 3.7117997617f, 3.7122614979f, - 3.7127232309f, 3.7131849607f, 3.7136466874f, 3.7141084109f, 3.7145701313f, - 3.7150318485f, 3.7154935625f, 3.7159552733f, 3.7164169810f, 3.7168786855f, - 3.7173403869f, 3.7178020852f, 3.7182637802f, 3.7187254721f, 3.7191871609f, - 3.7196488465f, 3.7201105290f, 3.7205722084f, 3.7210338846f, 3.7214955576f, - 3.7219572275f, 3.7224188943f, 3.7228805580f, 3.7233422185f, 3.7238038759f, - 3.7242655301f, 3.7247271812f, 3.7251888292f, 3.7256504741f, 3.7261121159f, - 3.7265737545f, 3.7270353900f, 3.7274970225f, 3.7279586517f, 3.7284202779f, - 3.7288819010f, 3.7293435210f, 3.7298051378f, 3.7302667516f, 3.7307283622f, - 3.7311899697f, 3.7316515742f, 3.7321131755f, 3.7325747738f, 3.7330363689f, - 3.7334979610f, 3.7339595500f, 3.7344211359f, 3.7348827187f, 3.7353442984f, - 3.7358058750f, 3.7362674486f, 3.7367290190f, 3.7371905864f, 3.7376521507f, - 3.7381137120f, 3.7385752701f, 3.7390368252f, 3.7394983773f, 3.7399599262f, - 3.7404214721f, 3.7408830149f, 3.7413445547f, 3.7418060914f, 3.7422676251f, - 3.7427291557f, 3.7431906832f, 3.7436522077f, 3.7441137291f, 3.7445752475f, - 3.7450367629f, 3.7454982752f, 3.7459597844f, 3.7464212906f, 3.7468827938f, - 3.7473442939f, 3.7478057910f, 3.7482672851f, 3.7487287761f, 3.7491902641f, - 3.7496517491f, 3.7501132310f, 3.7505747100f, 3.7510361858f, 3.7514976587f, - 3.7519591286f, 3.7524205954f, 3.7528820592f, 3.7533435200f, 3.7538049778f, - 3.7542664326f, 3.7547278843f, 3.7551893331f, 3.7556507788f, 3.7561122216f, - 3.7565736613f, 3.7570350981f, 3.7574965318f, 3.7579579625f, 3.7584193903f, - 3.7588808150f, 3.7593422368f, 3.7598036556f, 3.7602650714f, 3.7607264842f, - 3.7611878940f, 3.7616493008f, 3.7621107046f, 3.7625721055f, 3.7630335034f, - 3.7634948983f, 3.7639562903f, 3.7644176792f, 3.7648790652f, 3.7653404482f, - 3.7658018283f, 3.7662632054f, 3.7667245795f, 3.7671859507f, 3.7676473189f, - 3.7681086842f, 3.7685700465f, 3.7690314058f, 3.7694927622f, 3.7699541156f, - 3.7704154661f, 3.7708768136f, 3.7713381582f, 3.7717994999f, 3.7722608386f, - 3.7727221743f, 3.7731835071f, 3.7736448370f, 3.7741061640f, 3.7745674880f, - 3.7750288091f, 3.7754901272f, 3.7759514424f, 3.7764127547f, 3.7768740641f, - 3.7773353705f, 3.7777966741f, 3.7782579747f, 3.7787192724f, 3.7791805671f, - 3.7796418590f, 3.7801031479f, 3.7805644339f, 3.7810257171f, 3.7814869973f, - 3.7819482746f, 3.7824095490f, 3.7828708205f, 3.7833320891f, 3.7837933548f, - 3.7842546176f, 3.7847158775f, 3.7851771345f, 3.7856383886f, 3.7860996398f, - 3.7865608882f, 3.7870221336f, 3.7874833762f, 3.7879446159f, 3.7884058527f, - 3.7888670866f, 3.7893283176f, 3.7897895458f, 3.7902507711f, 3.7907119935f, - 3.7911732130f, 3.7916344297f, 3.7920956435f, 3.7925568544f, 3.7930180625f, - 3.7934792677f, 3.7939404701f, 3.7944016696f, 3.7948628662f, 3.7953240600f, - 3.7957852509f, 3.7962464390f, 3.7967076242f, 3.7971688065f, 3.7976299861f, - 3.7980911627f, 3.7985523366f, 3.7990135075f, 3.7994746757f, 3.7999358410f, - 3.8003970035f, 3.8008581631f, 3.8013193199f, 3.8017804739f, 3.8022416250f, - 3.8027027733f, 3.8031639188f, 3.8036250614f, 3.8040862013f, 3.8045473383f, - 3.8050084725f, 3.8054696038f, 3.8059307324f, 3.8063918581f, 3.8068529810f, - 3.8073141011f, 3.8077752184f, 3.8082363329f, 3.8086974446f, 3.8091585535f, - 3.8096196596f, 3.8100807628f, 3.8105418633f, 3.8110029610f, 3.8114640559f, - 3.8119251479f, 3.8123862372f, 3.8128473237f, 3.8133084074f, 3.8137694884f, - 3.8142305665f, 3.8146916418f, 3.8151527144f, 3.8156137842f, 3.8160748512f, - 3.8165359154f, 3.8169969768f, 3.8174580355f, 3.8179190914f, 3.8183801445f, - 3.8188411949f, 3.8193022425f, 3.8197632873f, 3.8202243294f, 3.8206853687f, - 3.8211464052f, 3.8216074390f, 3.8220684700f, 3.8225294982f, 3.8229905237f, - 3.8234515465f, 3.8239125665f, 3.8243735837f, 3.8248345982f, 3.8252956100f, - 3.8257566190f, 3.8262176253f, 3.8266786288f, 3.8271396296f, 3.8276006276f, - 3.8280616229f, 3.8285226155f, 3.8289836053f, 3.8294445925f, 3.8299055768f, - 3.8303665585f, 3.8308275374f, 3.8312885136f, 3.8317494871f, 3.8322104578f, - 3.8326714259f, 3.8331323912f, 3.8335933538f, 3.8340543137f, 3.8345152708f, - 3.8349762253f, 3.8354371771f, 3.8358981261f, 3.8363590724f, 3.8368200161f, - 3.8372809570f, 3.8377418952f, 3.8382028307f, 3.8386637636f, 3.8391246937f, - 3.8395856211f, 3.8400465459f, 3.8405074679f, 3.8409683873f, 3.8414293039f, - 3.8418902179f, 3.8423511292f, 3.8428120378f, 3.8432729438f, 3.8437338470f, - 3.8441947476f, 3.8446556455f, 3.8451165407f, 3.8455774332f, 3.8460383231f, - 3.8464992103f, 3.8469600948f, 3.8474209767f, 3.8478818559f, 3.8483427324f, - 3.8488036063f, 3.8492644775f, 3.8497253461f, 3.8501862120f, 3.8506470752f, - 3.8511079358f, 3.8515687937f, 3.8520296490f, 3.8524905016f, 3.8529513516f, - 3.8534121990f, 3.8538730437f, 3.8543338857f, 3.8547947251f, 3.8552555619f, - 3.8557163960f, 3.8561772275f, 3.8566380564f, 3.8570988826f, 3.8575597062f, - 3.8580205272f, 3.8584813455f, 3.8589421612f, 3.8594029743f, 3.8598637847f, - 3.8603245926f, 3.8607853978f, 3.8612462004f, 3.8617070004f, 3.8621677977f, - 3.8626285925f, 3.8630893846f, 3.8635501742f, 3.8640109611f, 3.8644717454f, - 3.8649325271f, 3.8653933062f, 3.8658540827f, 3.8663148566f, 3.8667756279f, - 3.8672363966f, 3.8676971627f, 3.8681579262f, 3.8686186872f, 3.8690794455f, - 3.8695402012f, 3.8700009544f, 3.8704617049f, 3.8709224529f, 3.8713831983f, - 3.8718439411f, 3.8723046814f, 3.8727654190f, 3.8732261541f, 3.8736868866f, - 3.8741476165f, 3.8746083439f, 3.8750690687f, 3.8755297909f, 3.8759905105f, - 3.8764512276f, 3.8769119421f, 3.8773726541f, 3.8778333635f, 3.8782940703f, - 3.8787547746f, 3.8792154763f, 3.8796761755f, 3.8801368721f, 3.8805975661f, - 3.8810582576f, 3.8815189466f, 3.8819796330f, 3.8824403169f, 3.8829009982f, - 3.8833616770f, 3.8838223532f, 3.8842830270f, 3.8847436981f, 3.8852043668f, - 3.8856650329f, 3.8861256964f, 3.8865863575f, 3.8870470160f, 3.8875076719f, - 3.8879683254f, 3.8884289763f, 3.8888896247f, 3.8893502706f, 3.8898109140f, - 3.8902715548f, 3.8907321931f, 3.8911928289f, 3.8916534622f, 3.8921140930f, - 3.8925747213f, 3.8930353471f, 3.8934959703f, 3.8939565911f, 3.8944172093f, - 3.8948778251f, 3.8953384383f, 3.8957990490f, 3.8962596573f, 3.8967202630f, - 3.8971808663f, 3.8976414670f, 3.8981020653f, 3.8985626611f, 3.8990232544f, - 3.8994838452f, 3.8999444335f, 3.9004050193f, 3.9008656027f, 3.9013261836f, - 3.9017867619f, 3.9022473379f, 3.9027079113f, 3.9031684823f, 3.9036290507f, - 3.9040896168f, 3.9045501803f, 3.9050107414f, 3.9054713000f, 3.9059318561f, - 3.9063924098f, 3.9068529610f, 3.9073135098f, 3.9077740561f, 3.9082345999f, - 3.9086951413f, 3.9091556803f, 3.9096162167f, 3.9100767508f, 3.9105372823f, - 3.9109978115f, 3.9114583382f, 3.9119188624f, 3.9123793842f, 3.9128399035f, - 3.9133004204f, 3.9137609349f, 3.9142214469f, 3.9146819565f, 3.9151424637f, - 3.9156029684f, 3.9160634707f, 3.9165239706f, 3.9169844680f, 3.9174449630f, - 3.9179054556f, 3.9183659458f, 3.9188264335f, 3.9192869189f, 3.9197474018f, - 3.9202078822f, 3.9206683603f, 3.9211288360f, 3.9215893092f, 3.9220497800f, - 3.9225102484f, 3.9229707145f, 3.9234311781f, 3.9238916393f, 3.9243520980f, - 3.9248125544f, 3.9252730084f, 3.9257334600f, 3.9261939092f, 3.9266543560f, - 3.9271148004f, 3.9275752424f, 3.9280356820f, 3.9284961193f, 3.9289565541f, - 3.9294169865f, 3.9298774166f, 3.9303378443f, 3.9307982696f, 3.9312586925f, - 3.9317191130f, 3.9321795312f, 3.9326399470f, 3.9331003604f, 3.9335607714f, - 3.9340211801f, 3.9344815864f, 3.9349419903f, 3.9354023918f, 3.9358627910f, - 3.9363231879f, 3.9367835823f, 3.9372439744f, 3.9377043642f, 3.9381647515f, - 3.9386251366f, 3.9390855192f, 3.9395458995f, 3.9400062775f, 3.9404666531f, - 3.9409270264f, 3.9413873973f, 3.9418477659f, 3.9423081321f, 3.9427684960f, - 3.9432288575f, 3.9436892167f, 3.9441495735f, 3.9446099281f, 3.9450702802f, - 3.9455306301f, 3.9459909776f, 3.9464513228f, 3.9469116656f, 3.9473720062f, - 3.9478323444f, 3.9482926802f, 3.9487530138f, 3.9492133450f, 3.9496736739f, - 3.9501340005f, 3.9505943248f, 3.9510546467f, 3.9515149664f, 3.9519752837f, - 3.9524355987f, 3.9528959114f, 3.9533562218f, 3.9538165299f, 3.9542768356f, - 3.9547371391f, 3.9551974403f, 3.9556577392f, 3.9561180357f, 3.9565783300f, - 3.9570386220f, 3.9574989116f, 3.9579591990f, 3.9584194841f, 3.9588797669f, - 3.9593400474f, 3.9598003256f, 3.9602606016f, 3.9607208752f, 3.9611811466f, - 3.9616414157f, 3.9621016825f, 3.9625619470f, 3.9630222092f, 3.9634824692f, - 3.9639427269f, 3.9644029823f, 3.9648632354f, 3.9653234863f, 3.9657837349f, - 3.9662439812f, 3.9667042253f, 3.9671644671f, 3.9676247067f, 3.9680849439f, - 3.9685451790f, 3.9690054117f, 3.9694656422f, 3.9699258705f, 3.9703860965f, - 3.9708463202f, 3.9713065417f, 3.9717667609f, 3.9722269779f, 3.9726871926f, - 3.9731474051f, 3.9736076154f, 3.9740678234f, 3.9745280292f, 3.9749882327f, - 3.9754484340f, 3.9759086330f, 3.9763688298f, 3.9768290244f, 3.9772892168f, - 3.9777494069f, 3.9782095948f, 3.9786697804f, 3.9791299639f, 3.9795901451f, - 3.9800503241f, 3.9805105008f, 3.9809706754f, 3.9814308477f, 3.9818910178f, - 3.9823511857f, 3.9828113513f, 3.9832715148f, 3.9837316760f, 3.9841918351f, - 3.9846519919f, 3.9851121465f, 3.9855722989f, 3.9860324491f, 3.9864925971f, - 3.9869527429f, 3.9874128865f, 3.9878730279f, 3.9883331671f, 3.9887933041f, - 3.9892534389f, 3.9897135715f, 3.9901737020f, 3.9906338302f, 3.9910939562f, - 3.9915540801f, 3.9920142017f, 3.9924743212f, 3.9929344385f, 3.9933945536f, - 3.9938546666f, 3.9943147773f, 3.9947748859f, 3.9952349923f, 3.9956950965f, - 3.9961551986f, 3.9966152985f, 3.9970753962f, 3.9975354917f, 3.9979955851f, - 3.9984556763f, 3.9989157654f, 3.9993758522f, 3.9998359370f, 4.0002960195f, - 4.0007560999f, 4.0012161781f, 4.0016762542f, 4.0021363282f, 4.0025963999f, - 4.0030564696f, 4.0035165370f, 4.0039766024f, 4.0044366655f, 4.0048967266f, - 4.0053567854f, 4.0058168422f, 4.0062768968f, 4.0067369492f, 4.0071969996f, - 4.0076570477f, 4.0081170938f, 4.0085771377f, 4.0090371795f, 4.0094972191f, - 4.0099572566f, 4.0104172920f, 4.0108773252f, 4.0113373564f, 4.0117973854f, - 4.0122574123f, 4.0127174370f, 4.0131774596f, 4.0136374802f, 4.0140974986f, - 4.0145575148f, 4.0150175290f, 4.0154775411f, 4.0159375510f, 4.0163975588f, - 4.0168575645f, 4.0173175681f, 4.0177775696f, 4.0182375690f, 4.0186975663f, - 4.0191575615f, 4.0196175546f, 4.0200775456f, 4.0205375345f, 4.0209975213f, - 4.0214575060f, 4.0219174886f, 4.0223774691f, 4.0228374475f, 4.0232974239f, - 4.0237573981f, 4.0242173703f, 4.0246773403f, 4.0251373083f, 4.0255972742f, - 4.0260572380f, 4.0265171998f, 4.0269771594f, 4.0274371170f, 4.0278970725f, - 4.0283570259f, 4.0288169773f, 4.0292769266f, 4.0297368738f, 4.0301968189f, - 4.0306567620f, 4.0311167030f, 4.0315766420f, 4.0320365789f, 4.0324965137f, - 4.0329564464f, 4.0334163771f, 4.0338763058f, 4.0343362324f, 4.0347961569f, - 4.0352560794f, 4.0357159998f, 4.0361759182f, 4.0366358345f, 4.0370957488f, - 4.0375556610f, 4.0380155712f, 4.0384754793f, 4.0389353854f, 4.0393952895f, - 4.0398551915f, 4.0403150915f, 4.0407749894f, 4.0412348853f, 4.0416947792f, - 4.0421546710f, 4.0426145608f, 4.0430744486f, 4.0435343343f, 4.0439942180f, - 4.0444540997f, 4.0449139794f, 4.0453738570f, 4.0458337327f, 4.0462936062f, - 4.0467534778f, 4.0472133474f, 4.0476732149f, 4.0481330805f, 4.0485929440f, - 4.0490528055f, 4.0495126650f, 4.0499725224f, 4.0504323779f, 4.0508922314f, - 4.0513520828f, 4.0518119323f, 4.0522717797f, 4.0527316252f, 4.0531914686f, - 4.0536513101f, 4.0541111495f, 4.0545709870f, 4.0550308225f, 4.0554906559f, - 4.0559504874f, 4.0564103169f, 4.0568701444f, 4.0573299699f, 4.0577897934f, - 4.0582496149f, 4.0587094345f, 4.0591692521f, 4.0596290676f, 4.0600888812f, - 4.0605486929f, 4.0610085025f, 4.0614683102f, 4.0619281159f, 4.0623879196f, - 4.0628477214f, 4.0633075212f, 4.0637673190f, 4.0642271148f, 4.0646869087f, - 4.0651467006f, 4.0656064906f, 4.0660662786f, 4.0665260646f, 4.0669858487f, - 4.0674456308f, 4.0679054109f, 4.0683651891f, 4.0688249654f, 4.0692847397f, - 4.0697445120f, 4.0702042824f, 4.0706640508f, 4.0711238173f, 4.0715835819f, - 4.0720433445f, 4.0725031051f, 4.0729628639f, 4.0734226206f, 4.0738823755f, - 4.0743421284f, 4.0748018793f, 4.0752616283f, 4.0757213754f, 4.0761811206f, - 4.0766408638f, 4.0771006051f, 4.0775603445f, 4.0780200819f, 4.0784798174f, - 4.0789395510f, 4.0793992827f, 4.0798590124f, 4.0803187402f, 4.0807784661f, - 4.0812381901f, 4.0816979122f, 4.0821576323f, 4.0826173506f, 4.0830770669f, - 4.0835367813f, 4.0839964938f, 4.0844562044f, 4.0849159131f, 4.0853756199f, - 4.0858353248f, 4.0862950277f, 4.0867547288f, 4.0872144280f, 4.0876741252f, - 4.0881338206f, 4.0885935141f, 4.0890532057f, 4.0895128953f, 4.0899725831f, - 4.0904322690f, 4.0908919530f, 4.0913516351f, 4.0918113154f, 4.0922709937f, - 4.0927306702f, 4.0931903448f, 4.0936500175f, 4.0941096883f, 4.0945693572f, - 4.0950290242f, 4.0954886894f, 4.0959483527f, 4.0964080142f, 4.0968676737f, - 4.0973273314f, 4.0977869872f, 4.0982466411f, 4.0987062932f, 4.0991659434f, - 4.0996255918f, 4.1000852382f, 4.1005448828f, 4.1010045256f, 4.1014641665f, - 4.1019238055f, 4.1023834427f, 4.1028430780f, 4.1033027115f, 4.1037623431f, - 4.1042219728f, 4.1046816008f, 4.1051412268f, 4.1056008510f, 4.1060604734f, - 4.1065200939f, 4.1069797126f, 4.1074393294f, 4.1078989444f, 4.1083585575f, - 4.1088181688f, 4.1092777783f, 4.1097373859f, 4.1101969917f, 4.1106565957f, - 4.1111161978f, 4.1115757981f, 4.1120353966f, 4.1124949932f, 4.1129545880f, - 4.1134141810f, 4.1138737722f, 4.1143333615f, 4.1147929490f, 4.1152525347f, - 4.1157121186f, 4.1161717007f, 4.1166312809f, 4.1170908593f, 4.1175504359f, - 4.1180100107f, 4.1184695837f, 4.1189291549f, 4.1193887242f, 4.1198482918f, - 4.1203078575f, 4.1207674215f, 4.1212269836f, 4.1216865439f, 4.1221461025f, - 4.1226056592f, 4.1230652141f, 4.1235247673f, 4.1239843186f, 4.1244438681f, - 4.1249034159f, 4.1253629618f, 4.1258225060f, 4.1262820484f, 4.1267415890f, - 4.1272011277f, 4.1276606648f, 4.1281202000f, 4.1285797334f, 4.1290392651f, - 4.1294987949f, 4.1299583230f, 4.1304178494f, 4.1308773739f, 4.1313368967f, - 4.1317964177f, 4.1322559369f, 4.1327154543f, 4.1331749700f, 4.1336344839f, - 4.1340939960f, 4.1345535064f, 4.1350130150f, 4.1354725218f, 4.1359320269f, - 4.1363915302f, 4.1368510317f, 4.1373105315f, 4.1377700296f, 4.1382295258f, - 4.1386890203f, 4.1391485131f, 4.1396080041f, 4.1400674934f, 4.1405269809f, - 4.1409864666f, 4.1414459506f, 4.1419054329f, 4.1423649134f, 4.1428243922f, - 4.1432838692f, 4.1437433445f, 4.1442028180f, 4.1446622899f, 4.1451217599f, - 4.1455812283f, 4.1460406948f, 4.1465001597f, 4.1469596228f, 4.1474190842f, - 4.1478785439f, 4.1483380018f, 4.1487974580f, 4.1492569125f, 4.1497163653f, - 4.1501758163f, 4.1506352656f, 4.1510947132f, 4.1515541591f, 4.1520136032f, - 4.1524730456f, 4.1529324863f, 4.1533919253f, 4.1538513626f, 4.1543107982f, - 4.1547702320f, 4.1552296642f, 4.1556890946f, 4.1561485234f, 4.1566079504f, - 4.1570673757f, 4.1575267993f, 4.1579862212f, 4.1584456414f, 4.1589050599f, - 4.1593644767f, 4.1598238918f, 4.1602833053f, 4.1607427170f, 4.1612021270f, - 4.1616615353f, 4.1621209420f, 4.1625803469f, 4.1630397502f, 4.1634991517f, - 4.1639585516f, 4.1644179498f, 4.1648773463f, 4.1653367412f, 4.1657961343f, - 4.1662555258f, 4.1667149156f, 4.1671743037f, 4.1676336901f, 4.1680930749f, - 4.1685524579f, 4.1690118393f, 4.1694712191f, 4.1699305971f, 4.1703899735f, - 4.1708493483f, 4.1713087213f, 4.1717680927f, 4.1722274625f, 4.1726868305f, - 4.1731461969f, 4.1736055617f, 4.1740649248f, 4.1745242862f, 4.1749836459f, - 4.1754430041f, 4.1759023605f, 4.1763617153f, 4.1768210685f, 4.1772804200f, - 4.1777397698f, 4.1781991180f, 4.1786584646f, 4.1791178095f, 4.1795771528f, - 4.1800364944f, 4.1804958344f, 4.1809551727f, 4.1814145094f, 4.1818738444f, - 4.1823331779f, 4.1827925096f, 4.1832518398f, 4.1837111683f, 4.1841704952f, - 4.1846298204f, 4.1850891441f, 4.1855484660f, 4.1860077864f, 4.1864671051f, - 4.1869264223f, 4.1873857377f, 4.1878450516f, 4.1883043639f, 4.1887636745f, - 4.1892229835f, 4.1896822909f, 4.1901415966f, 4.1906009008f, 4.1910602033f, - 4.1915195042f, 4.1919788036f, 4.1924381013f, 4.1928973973f, 4.1933566918f, - 4.1938159847f, 4.1942752760f, 4.1947345656f, 4.1951938537f, 4.1956531402f, - 4.1961124250f, 4.1965717083f, 4.1970309899f, 4.1974902700f, 4.1979495485f, - 4.1984088253f, 4.1988681006f, 4.1993273743f, 4.1997866464f, 4.2002459169f, - 4.2007051858f, 4.2011644531f, 4.2016237189f, 4.2020829830f, 4.2025422456f, - 4.2030015066f, 4.2034607660f, 4.2039200238f, 4.2043792800f, 4.2048385347f, - 4.2052977878f, 4.2057570393f, 4.2062162892f, 4.2066755376f, 4.2071347844f, - 4.2075940296f, 4.2080532733f, 4.2085125153f, 4.2089717559f, 4.2094309948f, - 4.2098902322f, 4.2103494680f, 4.2108087023f, 4.2112679350f, 4.2117271661f, - 4.2121863957f, 4.2126456237f, 4.2131048502f, 4.2135640751f, 4.2140232984f, - 4.2144825202f, 4.2149417405f, 4.2154009592f, 4.2158601763f, 4.2163193919f, - 4.2167786059f, 4.2172378185f, 4.2176970294f, 4.2181562388f, 4.2186154467f, - 4.2190746530f, 4.2195338578f, 4.2199930611f, 4.2204522628f, 4.2209114630f, - 4.2213706616f, 4.2218298587f, 4.2222890543f, 4.2227482483f, 4.2232074409f, - 4.2236666318f, 4.2241258213f, 4.2245850092f, 4.2250441956f, 4.2255033805f, - 4.2259625639f, 4.2264217457f, 4.2268809260f, 4.2273401048f, 4.2277992821f, - 4.2282584578f, 4.2287176321f, 4.2291768048f, 4.2296359760f, 4.2300951457f, - 4.2305543139f, 4.2310134806f, 4.2314726457f, 4.2319318094f, 4.2323909715f, - 4.2328501322f, 4.2333092913f, 4.2337684489f, 4.2342276051f, 4.2346867597f, - 4.2351459128f, 4.2356050645f, 4.2360642146f, 4.2365233632f, 4.2369825104f, - 4.2374416560f, 4.2379008002f, 4.2383599429f, 4.2388190840f, 4.2392782237f, - 4.2397373619f, 4.2401964986f, 4.2406556338f, 4.2411147676f, 4.2415738998f, - 4.2420330306f, 4.2424921599f, 4.2429512877f, 4.2434104140f, 4.2438695389f, - 4.2443286623f, 4.2447877842f, 4.2452469046f, 4.2457060235f, 4.2461651410f, - 4.2466242570f, 4.2470833716f, 4.2475424846f, 4.2480015962f, 4.2484607064f, - 4.2489198150f, 4.2493789223f, 4.2498380280f, 4.2502971323f, 4.2507562351f, - 4.2512153365f, 4.2516744364f, 4.2521335348f, 4.2525926318f, 4.2530517274f, - 4.2535108214f, 4.2539699141f, 4.2544290053f, 4.2548880950f, 4.2553471833f, - 4.2558062701f, 4.2562653555f, 4.2567244394f, 4.2571835219f, 4.2576426030f, - 4.2581016826f, 4.2585607608f, 4.2590198375f, 4.2594789128f, 4.2599379867f, - 4.2603970591f, 4.2608561301f, 4.2613151996f, 4.2617742677f, 4.2622333344f, - 4.2626923997f, 4.2631514635f, 4.2636105259f, 4.2640695869f, 4.2645286464f, - 4.2649877045f, 4.2654467612f, 4.2659058165f, 4.2663648703f, 4.2668239228f, - 4.2672829738f, 4.2677420234f, 4.2682010716f, 4.2686601183f, 4.2691191637f, - 4.2695782076f, 4.2700372501f, 4.2704962912f, 4.2709553309f, 4.2714143692f, - 4.2718734061f, 4.2723324416f, 4.2727914756f, 4.2732505083f, 4.2737095396f, - 4.2741685694f, 4.2746275979f, 4.2750866250f, 4.2755456506f, 4.2760046749f, - 4.2764636978f, 4.2769227192f, 4.2773817393f, 4.2778407580f, 4.2782997753f, - 4.2787587912f, 4.2792178057f, 4.2796768188f, 4.2801358306f, 4.2805948409f, - 4.2810538499f, 4.2815128575f, 4.2819718637f, 4.2824308685f, 4.2828898719f, - 4.2833488740f, 4.2838078746f, 4.2842668739f, 4.2847258719f, 4.2851848684f, - 4.2856438636f, 4.2861028574f, 4.2865618498f, 4.2870208409f, 4.2874798306f, - 4.2879388189f, 4.2883978059f, 4.2888567914f, 4.2893157757f, 4.2897747585f, - 4.2902337400f, 4.2906927202f, 4.2911516989f, 4.2916106764f, 4.2920696524f, - 4.2925286271f, 4.2929876005f, 4.2934465725f, 4.2939055431f, 4.2943645124f, - 4.2948234803f, 4.2952824469f, 4.2957414121f, 4.2962003760f, 4.2966593386f, - 4.2971182998f, 4.2975772596f, 4.2980362181f, 4.2984951753f, 4.2989541311f, - 4.2994130856f, 4.2998720387f, 4.3003309905f, 4.3007899410f, 4.3012488901f, - 4.3017078379f, 4.3021667844f, 4.3026257295f, 4.3030846733f, 4.3035436158f, - 4.3040025569f, 4.3044614967f, 4.3049204352f, 4.3053793723f, 4.3058383082f, - 4.3062972427f, 4.3067561759f, 4.3072151077f, 4.3076740383f, 4.3081329675f, - 4.3085918954f, 4.3090508220f, 4.3095097473f, 4.3099686712f, 4.3104275939f, - 4.3108865152f, 4.3113454352f, 4.3118043539f, 4.3122632713f, 4.3127221874f, - 4.3131811022f, 4.3136400157f, 4.3140989278f, 4.3145578387f, 4.3150167483f, - 4.3154756565f, 4.3159345635f, 4.3163934692f, 4.3168523735f, 4.3173112766f, - 4.3177701784f, 4.3182290788f, 4.3186879780f, 4.3191468759f, 4.3196057725f, - 4.3200646678f, 4.3205235618f, 4.3209824546f, 4.3214413460f, 4.3219002362f, - 4.3223591250f, 4.3228180126f, 4.3232768989f, 4.3237357839f, 4.3241946677f, - 4.3246535501f, 4.3251124313f, 4.3255713112f, 4.3260301898f, 4.3264890672f, - 4.3269479433f, 4.3274068181f, 4.3278656916f, 4.3283245639f, 4.3287834348f, - 4.3292423046f, 4.3297011730f, 4.3301600402f, 4.3306189061f, 4.3310777708f, - 4.3315366342f, 4.3319954963f, 4.3324543572f, 4.3329132168f, 4.3333720751f, - 4.3338309322f, 4.3342897880f, 4.3347486426f, 4.3352074959f, 4.3356663480f, - 4.3361251988f, 4.3365840484f, 4.3370428967f, 4.3375017438f, 4.3379605896f, - 4.3384194342f, 4.3388782775f, 4.3393371195f, 4.3397959604f, 4.3402548000f, - 4.3407136383f, 4.3411724754f, 4.3416313113f, 4.3420901459f, 4.3425489793f, - 4.3430078115f, 4.3434666424f, 4.3439254721f, 4.3443843005f, 4.3448431277f, - 4.3453019537f, 4.3457607785f, 4.3462196020f, 4.3466784243f, 4.3471372454f, - 4.3475960652f, 4.3480548838f, 4.3485137012f, 4.3489725174f, 4.3494313324f, - 4.3498901461f, 4.3503489586f, 4.3508077699f, 4.3512665800f, 4.3517253888f, - 4.3521841965f, 4.3526430029f, 4.3531018081f, 4.3535606121f, 4.3540194149f, - 4.3544782165f, 4.3549370169f, 4.3553958160f, 4.3558546140f, 4.3563134108f, - 4.3567722063f, 4.3572310007f, 4.3576897938f, 4.3581485858f, 4.3586073765f, - 4.3590661660f, 4.3595249544f, 4.3599837415f, 4.3604425275f, 4.3609013122f, - 4.3613600958f, 4.3618188782f, 4.3622776594f, 4.3627364393f, 4.3631952181f, - 4.3636539957f, 4.3641127722f, 4.3645715474f, 4.3650303215f, 4.3654890943f, - 4.3659478660f, 4.3664066365f, 4.3668654058f, 4.3673241739f, 4.3677829409f, - 4.3682417067f, 4.3687004713f, 4.3691592347f, 4.3696179970f, 4.3700767580f, - 4.3705355179f, 4.3709942767f, 4.3714530342f, 4.3719117906f, 4.3723705459f, - 4.3728292999f, 4.3732880528f, 4.3737468045f, 4.3742055551f, 4.3746643045f, - 4.3751230527f, 4.3755817998f, 4.3760405457f, 4.3764992904f, 4.3769580340f, - 4.3774167765f, 4.3778755177f, 4.3783342579f, 4.3787929968f, 4.3792517347f, - 4.3797104713f, 4.3801692068f, 4.3806279412f, 4.3810866744f, 4.3815454065f, - 4.3820041374f, 4.3824628672f, 4.3829215958f, 4.3833803233f, 4.3838390496f, - 4.3842977748f, 4.3847564989f, 4.3852152218f, 4.3856739436f, 4.3861326643f, - 4.3865913838f, 4.3870501021f, 4.3875088194f, 4.3879675355f, 4.3884262505f, - 4.3888849643f, 4.3893436770f, 4.3898023886f, 4.3902610991f, 4.3907198084f, - 4.3911785166f, 4.3916372237f, 4.3920959296f, 4.3925546345f, 4.3930133382f, - 4.3934720407f, 4.3939307422f, 4.3943894426f, 4.3948481418f, 4.3953068399f, - 4.3957655369f, 4.3962242328f, 4.3966829276f, 4.3971416212f, 4.3976003138f, - 4.3980590052f, 4.3985176955f, 4.3989763847f, 4.3994350728f, 4.3998937599f, - 4.4003524457f, 4.4008111305f, 4.4012698142f, 4.4017284968f, 4.4021871783f, - 4.4026458587f, 4.4031045380f, 4.4035632162f, 4.4040218932f, 4.4044805692f, - 4.4049392441f, 4.4053979179f, 4.4058565907f, 4.4063152623f, 4.4067739328f, - 4.4072326022f, 4.4076912706f, 4.4081499378f, 4.4086086040f, 4.4090672691f, - 4.4095259331f, 4.4099845960f, 4.4104432579f, 4.4109019186f, 4.4113605783f, - 4.4118192369f, 4.4122778944f, 4.4127365508f, 4.4131952062f, 4.4136538605f, - 4.4141125137f, 4.4145711658f, 4.4150298169f, 4.4154884669f, 4.4159471158f, - 4.4164057636f, 4.4168644104f, 4.4173230561f, 4.4177817008f, 4.4182403443f, - 4.4186989868f, 4.4191576283f, 4.4196162687f, 4.4200749080f, 4.4205335463f, - 4.4209921835f, 4.4214508196f, 4.4219094547f, 4.4223680887f, 4.4228267217f, - 4.4232853536f, 4.4237439845f, 4.4242026143f, 4.4246612431f, 4.4251198708f, - 4.4255784975f, 4.4260371231f, 4.4264957476f, 4.4269543712f, 4.4274129936f, - 4.4278716151f, 4.4283302355f, 4.4287888548f, 4.4292474731f, 4.4297060904f, - 4.4301647066f, 4.4306233218f, 4.4310819359f, 4.4315405490f, 4.4319991611f, - 4.4324577721f, 4.4329163821f, 4.4333749911f, 4.4338335991f, 4.4342922060f, - 4.4347508119f, 4.4352094167f, 4.4356680205f, 4.4361266233f, 4.4365852251f, - 4.4370438258f, 4.4375024256f, 4.4379610243f, 4.4384196220f, 4.4388782186f, - 4.4393368143f, 4.4397954089f, 4.4402540025f, 4.4407125951f, 4.4411711866f, - 4.4416297772f, 4.4420883667f, 4.4425469553f, 4.4430055428f, 4.4434641293f, - 4.4439227148f, 4.4443812993f, 4.4448398828f, 4.4452984652f, 4.4457570467f, - 4.4462156272f, 4.4466742066f, 4.4471327851f, 4.4475913625f, 4.4161034198f, - 4.4166593240f, 4.4172152283f, 4.4177711325f, 4.4183270368f, 4.4188829410f, - 4.4194388453f, 4.4199947496f, 4.4205506538f, 4.4211065581f, 4.4216624623f, - 4.4222183666f, 4.4227742708f, 4.4233301751f, 4.4238860794f, 4.4244419836f, - 4.4249978879f, 4.4255537921f, 4.4261096964f, 4.4266656006f, 4.4272215049f, - 4.4277774092f, 4.4283333134f, 4.4288892177f, 4.4294451219f, 4.4300010262f, - 4.4305569304f, 4.4311128347f, 4.4316687390f, 4.4322246432f, 4.4327805475f, - 4.4333364517f, 4.4338923560f, 4.4344482602f, 4.4350041645f, 4.4355600688f, - 4.4361159730f, 4.4366718773f, 4.4372277815f, 4.4377836858f, 4.4383395900f, - 4.4388954943f, 4.4394513986f, 4.4400073028f, 4.4405632071f, 4.4411191113f, - 4.4416750156f, 4.4422309198f, 4.4427868241f, 4.4433427284f, 4.4438986326f, - 4.4444545369f, 4.4450104411f, 4.4455663454f, 4.4461222496f, 4.4466781539f, - 4.4472340582f, 4.4477899624f, 4.4483458667f, 4.4489017709f, 4.4494576752f, - 4.4500135794f, 4.4505694837f, 4.4511253880f, 4.4516812922f, 4.4522371965f, - 4.4527931007f, 4.4533490050f, 4.4539049093f, 4.4544608135f, 4.4550167178f, - 4.4555726220f, 4.4561285263f, 4.4566844305f, 4.4572403348f, 4.4577962391f, - 4.4583521433f, 4.4589080476f, 4.4594639518f, 4.4600198561f, 4.4605757603f, - 4.4611316646f, 4.4616875689f, 4.4622434731f, 4.4627993774f, 4.4633552816f, - 4.4639111859f, 4.4644670901f, 4.4650229944f, 4.4655788987f, 4.4661348029f, - 4.4666907072f, 4.4672466114f, 4.4678025157f, 4.4683584199f, 4.4689143242f, - 4.4694702285f, 4.4700261327f, 4.4705820370f, 4.4711379412f, 4.4716938455f, - 4.4722497497f, 4.4728056540f, 4.4733615583f, 4.4739174625f, 4.4744733668f, - 4.4750292710f, 4.4755851753f, 4.4761410795f, 4.4766969838f, 4.4772528881f, - 4.4778087923f, 4.4783646966f, 4.4789206008f, 4.4794765051f, 4.4800324093f, - 4.4805883136f, 4.4811442179f, 4.4817001221f, 4.4822560264f, 4.4828119306f, - 4.4833678349f, 4.4839237391f, 4.4844796434f, 4.4850355477f, 4.4855914519f, - 4.4861473562f, 4.4867032604f, 4.4872591647f, 4.4878150689f, 4.4883709732f, - 4.4889268775f, 4.4894827817f, 4.4900386860f, 4.4905945902f, 4.4911504945f, - 4.4917063987f, 4.4922623030f, 4.4928182073f, 4.4933741115f, 4.4939300158f, - 4.4944859200f, 4.4950418243f, 4.4955977285f, 4.4961536328f, 4.4967095371f, - 4.4972654413f, 4.4978213456f, 4.4983772498f, 4.4989331541f, 4.4994890583f, - 4.5000449626f, 4.5006008669f, 4.5011567711f, 4.5017126754f, 4.5022685796f, - 4.5028244839f, 4.5033803881f, 4.5039362924f, 4.5044921967f, 4.5050481009f, - 4.5056040052f, 4.5061599094f, 4.5067158137f, 4.5072717179f, 4.5078276222f, - 4.5083835265f, 4.5089394307f, 4.5094953350f, 4.5100512392f, 4.5106071435f, - 4.5111630477f, 4.5117189520f, 4.5122748563f, 4.5128307605f, 4.5133866648f, - 4.5139425690f, 4.5144984733f, 4.5150543776f, 4.5156102818f, 4.5161661861f, - 4.5167220903f, 4.5172779946f, 4.5178338988f, 4.5183898031f, 4.5189457074f, - 4.5195016116f, 4.5200575159f, 4.5206134201f, 4.5211693244f, 4.5217252286f, - 4.5222811329f, 4.5228370372f, 4.5233929414f, 4.5239488457f, 4.5245047499f, - 4.5250606542f, 4.5256165584f, 4.5261724627f, 4.5267283670f, 4.5272842712f, - 4.5278401755f, 4.5283960797f, 4.5289519840f, 4.5295078882f, 4.5300637925f, - 4.5306196968f, 4.5311756010f, 4.5317315053f, 4.5322874095f, 4.5328433138f, - 4.5333992180f, 4.5339551223f, 4.5345110266f, 4.5350669308f, 4.5356228351f, - 4.5361787393f, 4.5367346436f, 4.5372905478f, 4.5378464521f, 4.5384023564f, - 4.5389582606f, 4.5395141649f, 4.5400700691f, 4.5406259734f, 4.5411818776f, - 4.5417377819f, 4.5422936862f, 4.5428495904f, 4.5434054947f, 4.5439613989f, - 4.5445173032f, 4.5450732074f, 4.5456291117f, 4.5461850160f, 4.5467409202f, - 4.5472968245f, 4.5478527287f, 4.5484086330f, 4.5489645372f, 4.5495204415f, - 4.5500763458f, 4.5506322500f, 4.5511881543f, 4.5517440585f, 4.5522999628f, - 4.5528558670f, 4.5534117713f, 4.5539676756f, 4.5545235798f, 4.5550794841f, - 4.5556353883f, 4.5561912926f, 4.5567471968f, 4.5573031011f, 4.5578590054f, - 4.5584149096f, 4.5589708139f, 4.5595267181f, 4.5600826224f, 4.5606385266f, - 4.5611944309f, 4.5617503352f, 4.5623062394f, 4.5628621437f, 4.5634180479f, - 4.5639739522f, 4.5645298564f, 4.5650857607f, 4.5656416650f, 4.5661975692f, - 4.5667534735f, 4.5673093777f, 4.5678652820f, 4.5684211862f, 4.5689770905f, - 4.5695329948f, 4.5700888990f, 4.5706448033f, 4.5712007075f, 4.5717566118f, - 4.5723125160f, 4.5728684203f, 4.5734243246f, 4.5739802288f, 4.5745361331f, - 4.5750920373f, 4.5756479416f, 4.5762038458f, 4.5767597501f, 4.5773156544f, - 4.5778715586f, 4.5784274629f, 4.5789833671f, 4.5795392714f, 4.5800951757f, - 4.5806510799f, 4.5812069842f, 4.5817628884f, 4.5823187927f, 4.5828746969f, - 4.5834306012f, 4.5839865055f, 4.5845424097f, 4.5850983140f, 4.5856542182f, - 4.5862101225f, 4.5867660267f, 4.5873219310f, 4.5878778353f, 4.5884337395f, - 4.5889896438f, 4.5895455480f, 4.5901014523f, 4.5906573565f, 4.5912132608f, - 4.5917691651f, 4.5923250693f, 4.5928809736f, 4.5934368778f, 4.5939927821f, - 4.5945486863f, 4.5951045906f, 4.5956604949f, 4.5962163991f, 4.5967723034f, - 4.5973282076f, 4.5978841119f, 4.5984400161f, 4.5989959204f, 4.5995518247f, - 4.6001077289f, 4.6006636332f, 4.6012195374f, 4.6017754417f, 4.6023313459f, - 4.6028872502f, 4.6034431545f, 4.6039990587f, 4.6045549630f, 4.6051108672f, - 4.6056667715f, 4.6062226757f, 4.6067785800f, 4.6073344843f, 4.6078903885f, - 4.6084462928f, 4.6090021970f, 4.6095581013f, 4.6101140055f, 4.6106699098f, - 4.6112258141f, 4.6117817183f, 4.6123376226f, 4.6128935268f, 4.6134494311f, - 4.6140053353f, 4.6145612396f, 4.6151171439f, 4.6156730481f, 4.6162289524f, - 4.6167848566f, 4.6173407609f, 4.6178966651f, 4.6184525694f, 4.6190084737f, - 4.6195643779f, 4.6201202822f, 4.6206761864f, 4.6212320907f, 4.6217879949f, - 4.6223438992f, 4.6228998035f, 4.6234557077f, 4.6240116120f, 4.6245675162f, - 4.6251234205f, 4.6256793247f, 4.6262352290f, 4.6267911333f, 4.6273470375f, - 4.6279029418f, 4.6284588460f, 4.6290147503f, 4.6295706545f, 4.6301265588f, - 4.6306824631f, 4.6312383673f, 4.6317942716f, 4.6323501758f, 4.6329060801f, - 4.6334619843f, 4.6340178886f, 4.6345737929f, 4.6351296971f, 4.6356856014f, - 4.6362415056f, 4.6367974099f, 4.6373533141f, 4.6379092184f, 4.6384651227f, - 4.6390210269f, 4.6395769312f, 4.6401328354f, 4.6406887397f, 4.6412446440f, - 4.6418005482f, 4.6423564525f, 4.6429123567f, 4.6434682610f, 4.6440241652f, - 4.6445800695f, 4.6451359738f, 4.6456918780f, 4.6462477823f, 4.6468036865f, - 4.6473595908f, 4.6479154950f, 4.6484713993f, 4.6490273036f, 4.6495832078f, - 4.6501391121f, 4.6506950163f, 4.6512509206f, 4.6518068248f, 4.6523627291f, - 4.6529186334f, 4.6534745376f, 4.6540304419f, 4.6545863461f, 4.6551422504f, - 4.6556981546f, 4.6562540589f, 4.6568099632f, 4.6573658674f, 4.6579217717f, - 4.6584776759f, 4.6590335802f, 4.6595894844f, 4.6601453887f, 4.6607012930f, - 4.6612571972f, 4.6618131015f, 4.6623690057f, 4.6629249100f, 4.6634808142f, - 4.6640367185f, 4.6645926228f, 4.6651485270f, 4.6657044313f, 4.6662603355f, - 4.6668162398f, 4.6673721440f, 4.6679280483f, 4.6684839526f, 4.6690398568f, - 4.6695957611f, 4.6701516653f, 4.6707075696f, 4.6712634738f, 4.6718193781f, - 4.6723752824f, 4.6729311866f, 4.6734870909f, 4.6740429951f, 4.6745988994f, - 4.6751548036f, 4.6757107079f, 4.6762666122f, 4.6768225164f, 4.6773784207f, - 4.6779343249f, 4.6784902292f, 4.6790461334f, 4.6796020377f, 4.6801579420f, - 4.6807138462f, 4.6812697505f, 4.6818256547f, 4.6823815590f, 4.6829374632f, - 4.6834933675f, 4.6840492718f, 4.6846051760f, 4.6851610803f, 4.6857169845f, - 4.6862728888f, 4.6868287930f, 4.6873846973f, 4.6879406016f, 4.6884965058f, - 4.6890524101f, 4.6896083143f, 4.6901642186f, 4.6907201228f, 4.6912760271f, - 4.6918319314f, 4.6923878356f, 4.6929437399f, 4.6934996441f, 4.6940555484f, - 4.6946114526f, 4.6951673569f, 4.6957232612f, 4.6962791654f, 4.6968350697f, - 4.6973909739f, 4.6979468782f, 4.6985027824f, 4.6990586867f, 4.6996145910f, - 4.7001704952f, 4.7007263995f, 4.7012823037f, 4.7018382080f, 4.7023941123f, - 4.7029500165f, 4.7035059208f, 4.7040618250f, 4.7046177293f, 4.7051736335f, - 4.7057295378f, 4.7062854421f, 4.7068413463f, 4.7073972506f, 4.7079531548f, - 4.7085090591f, 4.7090649633f, 4.7096208676f, 4.7101767719f, 4.7107326761f, - 4.7112885804f, 4.7118444846f, 4.7124003889f, 4.7129562931f, 4.7135121974f, - 4.7140681017f, 4.7146240059f, 4.7151799102f, 4.7157358144f, 4.7162917187f, - 4.7168476229f, 4.7174035272f, 4.7179594315f, 4.7185153357f, 4.7190712400f, - 4.7196271442f, 4.7201830485f, 4.7207389527f, 4.7212948570f, 4.7218507613f, - 4.7224066655f, 4.7229625698f, 4.7235184740f, 4.7240743783f, 4.7246302825f, - 4.7251861868f, 4.7257420911f, 4.7262979953f, 4.7268538996f, 4.7274098038f, - 4.7279657081f, 4.7285216123f, 4.7290775166f, 4.7296334209f, 4.7301893251f, - 4.7307452294f, 4.7313011336f, 4.7318570379f, 4.7324129421f, 4.7329688464f, - 4.7335247507f, 4.7340806549f, 4.7346365592f, 4.7351924634f, 4.7357483677f, - 4.7363042719f, 4.7368601762f, 4.7374160805f, 4.7379719847f, 4.7385278890f, - 4.7390837932f, 4.7396396975f, 4.7401956017f, 4.7407515060f, 4.7413074103f, - 4.7418633145f, 4.7424192188f, 4.7429751230f, 4.7435310273f, 4.7440869315f, - 4.7446428358f, 4.7451987401f, 4.7457546443f, 4.7463105486f, 4.7468664528f, - 4.7474223571f, 4.7479782613f, 4.7485341656f, 4.7490900699f, 4.7496459741f, - 4.7502018784f, 4.7507577826f, 4.7513136869f, 4.7518695911f, 4.7524254954f, - 4.7529813997f, 4.7535373039f, 4.7540932082f, 4.7546491124f, 4.7552050167f, - 4.7557609209f, 4.7563168252f, 4.7568727295f, 4.7574286337f, 4.7579845380f, - 4.7585404422f, 4.7590963465f, 4.7596522507f, 4.7602081550f, 4.7607640593f, - 4.7613199635f, 4.7618758678f, 4.7624317720f, 4.7629876763f, 4.7635435806f, - 4.7640994848f, 4.7646553891f, 4.7652112933f, 4.7657671976f, 4.7663231018f, - 4.7668790061f, 4.7674349104f, 4.7679908146f, 4.7685467189f, 4.7691026231f, - 4.7696585274f, 4.7702144316f, 4.7707703359f, 4.7713262402f, 4.7718821444f, - 4.7724380487f, 4.7729939529f, 4.7735498572f, 4.7741057614f, 4.7746616657f, - 4.7752175700f, 4.7757734742f, 4.7763293785f, 4.7768852827f, 4.7774411870f, - 4.7779970912f, 4.7785529955f, 4.7791088998f, 4.7796648040f, 4.7802207083f, - 4.7807766125f, 4.7813325168f, 4.7818884210f, 4.7824443253f, 4.7830002296f, - 4.7835561338f, 4.7841120381f, 4.7846679423f, 4.7852238466f, 4.7857797508f, - 4.7863356551f, 4.7868915594f, 4.7874474636f, 4.7880033679f, 4.7885592721f, - 4.7891151764f, 4.7896710806f, 4.7902269849f, 4.7907828892f, 4.7913387934f, - 4.7918946977f, 4.7924506019f, 4.7930065062f, 4.7935624104f, 4.7941183147f, - 4.7946742190f, 4.7952301232f, 4.7957860275f, 4.7963419317f, 4.7968978360f, - 4.7974537402f, 4.7980096445f, 4.7985655488f, 4.7991214530f, 4.7996773573f, - 4.8002332615f, 4.8007891658f, 4.8013450700f, 4.8019009743f, 4.8024568786f, - 4.8030127828f, 4.8035686871f, 4.8041245913f, 4.8046804956f, 4.8052363998f, - 4.8057923041f, 4.8063482084f, 4.8069041126f, 4.8074600169f, 4.8080159211f, - 4.8085718254f, 4.8091277296f, 4.8096836339f, 4.8102395382f, 4.8107954424f, - 4.8113513467f, 4.8119072509f, 4.8124631552f, 4.8130190594f, 4.8135749637f, - 4.8141308680f, 4.8146867722f, 4.8152426765f, 4.8157985807f, 4.8163544850f, - 4.8169103892f, 4.8174662935f, 4.8180221978f, 4.8185781020f, 4.8191340063f, - 4.8196899105f, 4.8202458148f, 4.8208017190f, 4.8213576233f, 4.8219135276f, - 4.8224694318f, 4.8230253361f, 4.8235812403f, 4.8241371446f, 4.8246930488f, - 4.8252489531f, 4.8258048574f, 4.8263607616f, 4.8269166659f, 4.8274725701f, - 4.8280284744f, 4.8285843787f, 4.8291402829f, 4.8296961872f, 4.8302520914f, - 4.8308079957f, 4.8313638999f, 4.8319198042f, 4.8324757085f, 4.8330316127f, - 4.8335875170f, 4.8341434212f, 4.8346993255f, 4.8352552297f, 4.8358111340f, - 4.8363670383f, 4.8369229425f, 4.8374788468f, 4.8380347510f, 4.8385906553f, - 4.8391465595f, 4.8397024638f, 4.8402583681f, 4.8408142723f, 4.8413701766f, - 4.8419260808f, 4.8424819851f, 4.8430378893f, 4.8435937936f, 4.8441496979f, - 4.8447056021f, 4.8452615064f, 4.8458174106f, 4.8463733149f, 4.8469292191f, - 4.8474851234f, 4.8480410277f, 4.8485969319f, 4.8491528362f, 4.8497087404f, - 4.8502646447f, 4.8508205489f, 4.8513764532f, 4.8519323575f, 4.8524882617f, - 4.8530441660f, 4.8536000702f, 4.8541559745f, 4.8547118787f, 4.8552677830f, - 4.8558236873f, 4.8563795915f, 4.8569354958f, 4.8574914000f, 4.8580473043f, - 4.8586032085f, 4.8591591128f, 4.8597150171f, 4.8602709213f, 4.8608268256f, - 4.8613827298f, 4.8619386341f, 4.8624945383f, 4.8630504426f, 4.8636063469f, - 4.8641622511f, 4.8647181554f, 4.8652740596f, 4.8658299639f, 4.8663858681f, - 4.8669417724f, 4.8674976767f, 4.8680535809f, 4.8686094852f, 4.8691653894f, - 4.8697212937f, 4.8702771979f, 4.8708331022f, 4.8713890065f, 4.8719449107f, - 4.8725008150f, 4.8730567192f, 4.8736126235f, 4.8741685277f, 4.8747244320f, - 4.8752803363f, 4.8758362405f, 4.8763921448f, 4.8769480490f, 4.8775039533f, - 4.8780598575f, 4.8786157618f, 4.8791716661f, 4.8797275703f, 4.8802834746f, - 4.8808393788f, 4.8813952831f, 4.8819511873f, 4.8825070916f, 4.8830629959f, - 4.8836189001f, 4.8841748044f, 4.8847307086f, 4.8852866129f, 4.8858425171f, - 4.8863984214f, 4.8869543257f, 4.8875102299f, 4.8880661342f, 4.8886220384f, - 4.8891779427f, 4.8897338470f, 4.8902897512f, 4.8908456555f, 4.8914015597f, - 4.8919574640f, 4.8925133682f, 4.8930692725f, 4.8936251768f, 4.8941810810f, - 4.8947369853f, 4.8952928895f, 4.8958487938f, 4.8964046980f, 4.8969606023f, - 4.8975165066f, 4.8980724108f, 4.8986283151f, 4.8991842193f, 4.8997401236f, - 4.9002960278f, 4.9008519321f, 4.9014078364f, 4.9019637406f, 4.9025196449f, - 4.9030755491f, 4.9036314534f, 4.9041873576f, 4.9047432619f, 4.9052991662f, - 4.9058550704f, 4.9064109747f, 4.9069668789f, 4.9075227832f, 4.9080786874f, - 4.9086345917f, 4.9091904960f, 4.9097464002f, 4.9103023045f, 4.9108582087f, - 4.9114141130f, 4.9119700172f, 4.9125259215f, 4.9130818258f, 4.9136377300f, - 4.9141936343f, 4.9147495385f, 4.9153054428f, 4.9158613470f, 4.9164172513f, - 4.9169731556f, 4.9175290598f, 4.9180849641f, 4.9186408683f, 4.9191967726f, - 4.9197526768f, 4.9203085811f, 4.9208644854f, 4.9214203896f, 4.9219762939f, - 4.9225321981f, 4.9230881024f, 4.9236440066f, 4.9241999109f, 4.9247558152f, - 4.9253117194f, 4.9258676237f, 4.9264235279f, 4.9269794322f, 4.9275353364f, - 4.9280912407f, 4.9286471450f, 4.9292030492f, 4.9297589535f, 4.9303148577f, - 4.9308707620f, 4.9314266662f, 4.9319825705f, 4.9325384748f, 4.9330943790f, - 4.9336502833f, 4.9342061875f, 4.9347620918f, 4.9353179960f, 4.9358739003f, - 4.9364298046f, 4.9369857088f, 4.9375416131f, 4.9380975173f, 4.9386534216f, - 4.9392093258f, 4.9397652301f, 4.9403211344f, 4.9408770386f, 4.9414329429f, - 4.9419888471f, 4.9425447514f, 4.9431006556f, 4.9436565599f, 4.9442124642f, - 4.9447683684f, 4.9453242727f, 4.9458801769f, 4.9464360812f, 4.9469919854f, - 4.9475478897f, 4.9481037940f, 4.9486596982f, 4.9492156025f, 4.9497715067f, - 4.9503274110f, 4.9508833153f, 4.9514392195f, 4.9519951238f, 4.9525510280f, - 4.9531069323f, 4.9536628365f, 4.9542187408f, 4.9547746451f, 4.9553305493f, - 4.9558864536f, 4.9564423578f, 4.9569982621f, 4.9575541663f, 4.9581100706f, - 4.9586659749f, 4.9592218791f, 4.9597777834f, 4.9603336876f, 4.9608895919f, - 4.9614454961f, 4.9620014004f, 4.9625573047f, 4.9631132089f, 4.9636691132f, - 4.9642250174f, 4.9647809217f, 4.9653368259f, 4.9658927302f, 4.9664486345f, - 4.9670045387f, 4.9675604430f, 4.9681163472f, 4.9686722515f, 4.9692281557f, - 4.9697840600f, 4.9703399643f, 4.9708958685f, 4.9714517728f, 4.9720076770f, - 4.9725635813f, 4.9731194855f, 4.9736753898f, 4.9742312941f, 4.9747871983f, - 4.9753431026f, 4.9758990068f, 4.9764549111f, 4.9770108153f, 4.9775667196f, - 4.9781226239f, 4.9786785281f, 4.9792344324f, 4.9797903366f, 4.9803462409f, - 4.9809021451f, 4.9814580494f, 4.9820139537f, 4.9825698579f, 4.9831257622f, - 4.9836816664f, 4.9842375707f, 4.9847934749f, 4.9853493792f, 4.9859052835f, - 4.9864611877f, 4.9870170920f, 4.9875729962f, 4.9881289005f, 4.9886848047f, - 4.9892407090f, 4.9897966133f, 4.9903525175f, 4.9909084218f, 4.9914643260f, - 4.9920202303f, 4.9925761345f, 4.9931320388f, 4.9936879431f, 4.9942438473f, - 4.9947997516f, 4.9953556558f, 4.9959115601f, 4.9964674643f, 4.9970233686f, - 4.9975792729f, 4.9981351771f, 4.9986910814f, 4.9992469856f, 4.9998028899f, - 5.0003587941f, 5.0009146984f, 5.0014706027f, 5.0020265069f, 5.0025824112f, - 5.0031383154f, 5.0036942197f, 5.0042501239f, 5.0048060282f, 5.0053619325f, - 5.0059178367f, 5.0064737410f, 5.0070296452f, 5.0075855495f, 5.0081414537f, - 5.0086973580f, 5.0092532623f, 5.0098091665f, 5.0103650708f, 5.0109209750f, - 5.0114768793f, 5.0120327835f, 5.0125886878f, 5.0131445921f, 5.0137004963f, - 5.0142564006f, 5.0148123048f, 5.0153682091f, 5.0159241134f, 5.0164800176f, - 5.0170359219f, 5.0175918261f, 5.0181477304f, 5.0187036346f, 5.0192595389f, - 5.0198154432f, 5.0203713474f, 5.0209272517f, 5.0214831559f, 5.0220390602f, - 5.0225949644f, 5.0231508687f, 5.0237067730f, 5.0242626772f, 5.0248185815f, - 5.0253744857f, 5.0259303900f, 5.0264862942f, 5.0270421985f, 5.0275981028f, - 5.0281540070f, 5.0287099113f, 5.0292658155f, 5.0298217198f, 5.0303776240f, - 5.0309335283f, 5.0314894326f, 5.0320453368f, 5.0326012411f, 5.0331571453f, - 5.0337130496f, 5.0342689538f, 5.0348248581f, 5.0353807624f, 5.0359366666f, - 5.0364925709f, 5.0370484751f, 5.0376043794f, 5.0381602836f, 5.0387161879f, - 5.0392720922f, 5.0398279964f, 5.0403839007f, 5.0409398049f, 5.0414957092f, - 5.0420516134f, 5.0426075177f, 5.0431634220f, 5.0437193262f, 5.0442752305f, - 5.0448311347f, 5.0453870390f, 5.0459429432f, 5.0464988475f, 5.0470547518f, - 5.0476106560f, 5.0481665603f, 5.0487224645f, 5.0492783688f, 5.0498342730f, - 5.0503901773f, 5.0509460816f, 5.0515019858f, 5.0520578901f, 5.0526137943f, - 5.0531696986f, 5.0537256028f, 5.0542815071f, 5.0548374114f, 5.0553933156f, - 5.0559492199f, 5.0565051241f, 5.0570610284f, 5.0576169326f, 5.0581728369f, - 5.0587287412f, 5.0592846454f, 5.0598405497f, 5.0603964539f, 5.0609523582f, - 5.0615082624f, 5.0620641667f, 5.0626200710f, 5.0631759752f, 5.0637318795f, - 5.0642877837f, 5.0648436880f, 5.0653995922f, 5.0659554965f, 5.0665114008f, - 5.0670673050f, 5.0676232093f, 5.0681791135f, 5.0687350178f, 5.0692909220f, - 5.0698468263f, 5.0704027306f, 5.0709586348f, 5.0715145391f, 5.0720704433f, - 5.0726263476f, 5.0731822518f, 5.0737381561f, 5.0742940604f, 5.0748499646f, - 5.0754058689f, 5.0759617731f, 5.0765176774f, 5.0770735817f, 5.0776294859f, - 5.0781853902f, 5.0787412944f, 5.0792971987f, 5.0798531029f, 5.0804090072f, - 5.0809649115f, 5.0815208157f, 5.0820767200f, 5.0826326242f, 5.0831885285f, - 5.0837444327f, 5.0843003370f, 5.0848562413f, 5.0854121455f, 5.0859680498f, - 5.0865239540f, 5.0870798583f, 5.0876357625f, 5.0881916668f, 5.0887475711f, - 5.0893034753f, 5.0898593796f, 5.0904152838f, 5.0909711881f, 5.0915270923f, - 5.0920829966f, 5.0926389009f, 5.0931948051f, 5.0937507094f, 5.0943066136f, - 5.0948625179f, 5.0954184221f, 5.0959743264f, 5.0965302307f, 5.0970861349f, - 5.0976420392f, 5.0981979434f, 5.0987538477f, 5.0993097519f, 5.0998656562f, - 5.1004215605f, 5.1009774647f, 5.1015333690f, 5.1020892732f, 5.1026451775f, - 5.1032010817f, 5.1037569860f, 5.1043128903f, 5.1048687945f, 5.1054246988f, - 5.1059806030f, 5.1065365073f, 5.1070924115f, 5.1076483158f, 5.1082042201f, - 5.1087601243f, 5.1093160286f, 5.1098719328f, 5.1104278371f, 5.1109837413f, - 5.1115396456f, 5.1120955499f, 5.1126514541f, 5.1132073584f, 5.1137632626f, - 5.1143191669f, 5.1148750711f, 5.1154309754f, 5.1159868797f, 5.1165427839f, - 5.1170986882f, 5.1176545924f, 5.1182104967f, 5.1187664009f, 5.1193223052f, - 5.1198782095f, 5.1204341137f, 5.1209900180f, 5.1215459222f, 5.1221018265f, - 5.1226577307f, 5.1232136350f, 5.1237695393f, 5.1243254435f, 5.1248813478f, - 5.1254372520f, 5.1259931563f, 5.1265490605f, 5.1271049648f, 5.1276608691f, - 5.1282167733f, 5.1287726776f, 5.1293285818f, 5.1298844861f, 5.1304403903f, - 5.1309962946f, 5.1315521989f, 5.1321081031f, 5.1326640074f, 5.1332199116f, - 5.1337758159f, 5.1343317201f, 5.1348876244f, 5.1354435287f, 5.1359994329f, - 5.1365553372f, 5.1371112414f, 5.1376671457f, 5.1382230500f, 5.1387789542f, - 5.1393348585f, 5.1398907627f, 5.1404466670f, 5.1410025712f, 5.1415584755f, - 5.1421143798f, 5.1426702840f, 5.1432261883f, 5.1437820925f, 5.1443379968f, - 5.1448939010f, 5.1454498053f, 5.1460057096f, 5.1465616138f, 5.1471175181f, - 5.1476734223f, 5.1482293266f, 5.1487852308f, 5.1493411351f, 5.1498970394f, - 5.1504529436f, 5.1510088479f, 5.1515647521f, 5.1521206564f, 5.1526765606f, - 5.1532324649f, 5.1537883692f, 5.1543442734f, 5.1549001777f, 5.1554560819f, - 5.1560119862f, 5.1565678904f, 5.1571237947f, 5.1576796990f, 5.1582356032f, - 5.1587915075f, 5.1593474117f, 5.1599033160f, 5.1604592202f, 5.1610151245f, - 5.1615710288f, 5.1621269330f, 5.1626828373f, 5.1632387415f, 5.1637946458f, - 5.1643505500f, 5.1649064543f, 5.1654623586f, 5.1660182628f, 5.1665741671f, - 5.1671300713f, 5.1676859756f, 5.1682418798f, 5.1687977841f, 5.1693536884f, - 5.1699095926f, 5.1704654969f, 5.1710214011f, 5.1715773054f, 5.1721332096f, - 5.1726891139f, 5.1732450182f, 5.1738009224f, 5.1743568267f, 5.1749127309f, - 5.1754686352f, 5.1760245394f, 5.1765804437f, 5.1771363480f, 5.1776922522f, - 5.1782481565f, 5.1788040607f, 5.1793599650f, 5.1799158692f, 5.1804717735f, - 5.1810276778f, 5.1815835820f, 5.1821394863f, 5.1826953905f, 5.1832512948f, - 5.1838071990f, 5.1843631033f, 5.1849190076f, 5.1854749118f, 5.1860308161f, - 5.1865867203f, 5.1871426246f, 5.1876985288f, 5.1882544331f, 5.1888103374f, - 5.1893662416f, 5.1899221459f, 5.1904780501f, 5.1910339544f, 5.1915898586f, - 5.1921457629f, 5.1927016672f, 5.1932575714f, 5.1938134757f, 5.1943693799f, - 5.1949252842f, 5.1954811884f, 5.1960370927f, 5.1965929970f, 5.1971489012f, - 5.1977048055f, 5.1982607097f, 5.1988166140f, 5.1993725183f, 5.1999284225f, - 5.2004843268f, 5.2010402310f, 5.2015961353f, 5.2021520395f, 5.2027079438f, - 5.2032638481f, 5.2038197523f, 5.2043756566f, 5.2049315608f, 5.2054874651f, - 5.2060433693f, 5.2065992736f, 5.2071551779f, 5.2077110821f, 5.2082669864f, - 5.2088228906f, 5.2093787949f, 5.2099346991f, 5.2104906034f, 5.2110465077f, - 5.2116024119f, 5.2121583162f, 5.2127142204f, 5.2132701247f, 5.2138260289f, - 5.2143819332f, 5.2149378375f, 5.2154937417f, 5.2160496460f, 5.2166055502f, - 5.2171614545f, 5.2177173587f, 5.2182732630f, 5.2188291673f, 5.2193850715f, - 5.2199409758f, 5.2204968800f, 5.2210527843f, 5.2216086885f, 5.2221645928f, - 5.2227204971f, 5.2232764013f, 5.2238323056f, 5.2243882098f, 5.2249441141f, - 5.2255000183f, 5.2260559226f, 5.2266118269f, 5.2271677311f, 5.2277236354f, - 5.2282795396f, 5.2288354439f, 5.2293913481f, 5.2299472524f, 5.2305031567f, - 5.2310590609f, 5.2316149652f, 5.2321708694f, 5.2327267737f, 5.2332826779f, - 5.2338385822f, 5.2343944865f, 5.2349503907f, 5.2355062950f, 5.2360621992f, - 5.2366181035f, 5.2371740077f, 5.2377299120f, 5.2382858163f, 5.2388417205f, - 5.2393976248f, 5.2399535290f, 5.2405094333f, 5.2410653375f, 5.2416212418f, - 5.2421771461f, 5.2427330503f, 5.2432889546f, 5.2438448588f, 5.2444007631f, - 5.2449566673f, 5.2455125716f, 5.2460684759f, 5.2466243801f, 5.2471802844f, - 5.2477361886f, 5.2482920929f, 5.2488479971f, 5.2494039014f, 5.2499598057f, - 5.2505157099f, 5.2510716142f, 5.2516275184f, 5.2521834227f, 5.2527393269f, - 5.2532952312f, 5.2538511355f, 5.2544070397f, 5.2549629440f, 5.2555188482f, - 5.2560747525f, 5.2566306567f, 5.2571865610f, 5.2577424653f, 5.2582983695f, - 5.2588542738f, 5.2594101780f, 5.2599660823f, 5.2605219865f, 5.2610778908f, - 5.2616337951f, 5.2621896993f, 5.2627456036f, 5.2633015078f, 5.2638574121f, - 5.2644133164f, 5.2649692206f, 5.2655251249f, 5.2660810291f, 5.2666369334f, - 5.2671928376f, 5.2677487419f, 5.2683046462f, 5.2688605504f, 5.2694164547f, - 5.2699723589f, 5.2705282632f, 5.2710841674f, 5.2716400717f, 5.2721959760f, - 5.2727518802f, 5.2733077845f, 5.2738636887f, 5.2744195930f, 5.2749754972f, - 5.2755314015f, 5.2760873058f, 5.2766432100f, 5.2771991143f, 5.2777550185f, - 5.2783109228f, 5.2788668270f, 5.2794227313f, 5.2799786356f, 5.2805345398f, - 5.2810904441f, 5.2816463483f, 5.2822022526f, 5.2827581568f, 5.2833140611f, - 5.2838699654f, 5.2844258696f, 5.2849817739f, 5.2855376781f, 5.2860935824f, - 5.2866494866f, 5.2872053909f, 5.2877612952f, 5.2883171994f, 5.2888731037f, - 5.2894290079f, 5.2899849122f, 5.2905408164f, 5.2910967207f, 5.2916526250f, - 5.2922085292f, 5.2927644335f, 5.2933203377f, 5.2938762420f, 5.2944321462f, - 5.2949880505f, 5.2955439548f, 5.2960998590f, 5.2966557633f, 5.2972116675f, - 5.2977675718f, 5.2983234760f, 5.2988793803f, 5.2994352846f, 5.2999911888f, - 5.3005470931f, 5.3011029973f, 5.3016589016f, 5.3022148058f, 5.3027707101f, - 5.3033266144f, 5.3038825186f, 5.3044384229f, 5.3049943271f, 5.3055502314f, - 5.3061061356f, 5.3066620399f, 5.3072179442f, 5.3077738484f, 5.3083297527f, - 5.3088856569f, 5.3094415612f, 5.3099974654f, 5.3105533697f, 5.3111092740f, - 5.3116651782f, 5.3122210825f, 5.3127769867f, 5.3133328910f, 5.3138887952f, - 5.3144446995f, 5.3150006038f, 5.3155565080f, 5.3161124123f, 5.3166683165f, - 5.3172242208f, 5.3177801250f, 5.3183360293f, 5.3188919336f, 5.3194478378f, - 5.3200037421f, 5.3205596463f, 5.3211155506f, 5.3216714548f, 5.3222273591f, - 5.3227832634f, 5.3233391676f, 5.3238950719f, 5.3244509761f, 5.3250068804f, - 5.3255627847f, 5.3261186889f, 5.3266745932f, 5.3272304974f, 5.3277864017f, - 5.3283423059f, 5.3288982102f, 5.3294541145f, 5.3300100187f, 5.3305659230f, - 5.3311218272f, 5.3316777315f, 5.3322336357f, 5.3327895400f, 5.3333454443f, - 5.3339013485f, 5.3344572528f, 5.3350131570f, 5.3355690613f, 5.3361249655f, - 5.3366808698f, 5.3372367741f, 5.3377926783f, 5.3383485826f, 5.3389044868f, - 5.3394603911f, 5.3400162953f, 5.3405721996f, 5.3411281039f, 5.3416840081f, - 5.3422399124f, 5.3427958166f, 5.3433517209f, 5.3439076251f, 5.3444635294f, - 5.3450194337f, 5.3455753379f, 5.3461312422f, 5.3466871464f, 5.3472430507f, - 5.3477989549f, 5.3483548592f, 5.3489107635f, 5.3494666677f, 5.3500225720f, - 5.3505784762f, 5.3511343805f, 5.3516902847f, 5.3522461890f, 5.3528020933f, - 5.3533579975f, 5.3539139018f, 5.3544698060f, 5.3550257103f, 5.3555816145f, - 5.3561375188f, 5.3566934231f, 5.3572493273f, 5.3578052316f, 5.3583611358f, - 5.3589170401f, 5.3594729443f, 5.3600288486f, 5.3605847529f, 5.3611406571f, - 5.3616965614f, 5.3622524656f, 5.3628083699f, 5.3633642741f, 5.3639201784f, - 5.3644760827f, 5.3650319869f, 5.3655878912f, 5.3661437954f, 5.3666996997f, - 5.3672556039f, 5.3678115082f, 5.3683674125f, 5.3689233167f, 5.3694792210f, - 5.3700351252f, 5.3705910295f, 5.3711469337f, 5.3717028380f, 5.3722587423f, - 5.3728146465f, 5.3733705508f, 5.3739264550f, 5.3744823593f, 5.3750382635f, - 5.3755941678f, 5.3761500721f, 5.3767059763f, 5.3772618806f, 5.3778177848f, - 5.3783736891f, 5.3789295933f, 5.3794854976f, 5.3800414019f, 5.3805973061f, - 5.3811532104f, 5.3817091146f, 5.3822650189f, 5.3828209231f, 5.3833768274f, - 5.3839327317f, 5.3844886359f, 5.3850445402f, 5.3856004444f, 5.3861563487f, - 5.3867122530f, 5.3872681572f, 5.3878240615f, 5.3883799657f, 5.3889358700f, - 5.3894917742f, 5.3900476785f, 5.3906035828f, 5.3911594870f, 5.3917153913f, - 5.3922712955f, 5.3928271998f, 5.3933831040f, 5.3939390083f, 5.3944949126f, - 5.3950508168f, 5.3956067211f, 5.3961626253f, 5.3967185296f, 5.3972744338f, - 5.3978303381f, 5.3983862424f, 5.3989421466f, 5.3994980509f, 5.4000539551f, - 5.4006098594f, 5.4011657636f, 5.4017216679f, 5.4022775722f, 5.4028334764f, - 5.4033893807f, 5.4039452849f, 5.4045011892f, 5.4050570934f, 5.4056129977f, - 5.4061689020f, 5.4067248062f, 5.4072807105f, 5.4078366147f, 5.4083925190f, - 5.4089484232f, 5.4095043275f, 5.4100602318f, 5.4106161360f, 5.4111720403f, - 5.4117279445f, 5.4122838488f, 5.4128397530f, 5.4133956573f, 5.4139515616f, - 5.4145074658f, 5.4150633701f, 5.4156192743f, 5.4161751786f, 5.4167310828f, - 5.4172869871f, 5.4178428914f, 5.4183987956f, 5.4189546999f, 5.4195106041f, - 5.4200665084f, 5.4206224126f, 5.4211783169f, 5.4217342212f, 5.4222901254f, - 5.4228460297f, 5.4234019339f, 5.4239578382f, 5.4245137424f, 5.4250696467f, - 5.4256255510f, 5.4261814552f, 5.4267373595f, 5.4272932637f, 5.4278491680f, - 5.4284050722f, 5.4289609765f, 5.4295168808f, 5.4300727850f, 5.4306286893f, - 5.4311845935f, 5.4317404978f, 5.4322964020f, 5.4328523063f, 5.4334082106f, - 5.4339641148f, 5.4345200191f, 5.4350759233f, 5.4356318276f, 5.4361877318f, - 5.4367436361f, 5.4372995404f, 5.4378554446f, 5.4384113489f, 5.4389672531f, - 5.4395231574f, 5.4400790616f, 5.4406349659f, 5.4411908702f, 5.4417467744f, - 5.4423026787f, 5.4428585829f, 5.4434144872f, 5.4439703914f, 5.4445262957f, - 5.4450822000f, 5.4456381042f, 5.4461940085f, 5.4467499127f, 5.4473058170f, - 5.4478617212f, 5.4484176255f, 5.4489735298f, 5.4495294340f, 5.4500853383f, - 5.4506412425f, 5.4511971468f, 5.4517530511f, 5.4523089553f, 5.4528648596f, - 5.4534207638f, 5.4539766681f, 5.4545325723f, 5.4550884766f, 5.4556443809f, - 5.4562002851f, 5.4567561894f, 5.4573120936f, 5.4578679979f, 5.4584239021f, - 5.4589798064f, 5.4595357107f, 5.4600916149f, 5.4606475192f, 5.4612034234f, - 5.4617593277f, 5.4623152319f, 5.4628711362f, 5.4634270405f, 5.4639829447f, - 5.4645388490f, 5.4650947532f, 5.4656506575f, 5.4662065617f, 5.4667624660f, - 5.4673183703f, 5.4678742745f, 5.4684301788f, 5.4689860830f, 5.4695419873f, - 5.4700978915f, 5.4706537958f, 5.4712097001f, 5.4717656043f, 5.4723215086f, - 5.4728774128f, 5.4734333171f, 5.4739892213f, 5.4745451256f, 5.4751010299f, - 5.4756569341f, 5.4762128384f, 5.4767687426f, 5.4773246469f, 5.4778805511f, - 5.4784364554f, 5.4789923597f, 5.4795482639f, 5.4801041682f, 5.4806600724f, - 5.4812159767f, 5.4817718809f, 5.4823277852f, 5.4828836895f, 5.4834395937f, - 5.4839954980f, 5.4845514022f, 5.4851073065f, 5.4856632107f, 5.4862191150f, - 5.4867750193f, 5.4873309235f, 5.4878868278f, 5.4884427320f, 5.4889986363f, - 5.4895545405f, 5.4901104448f, 5.4906663491f, 5.4912222533f, 5.4917781576f, - 5.4923340618f, 5.4928899661f, 5.4934458703f, 5.4940017746f, 5.4945576789f, - 5.4951135831f, 5.4956694874f, 5.4962253916f, 5.4967812959f, 5.4973372001f, - 5.4978931044f, 5.4984490087f, 5.4990049129f, 5.4995608172f, 5.5001167214f, - 5.5006726257f, 5.5012285299f, 5.5017844342f, 5.5023403385f, 5.5028962427f, - 5.5034521470f, 5.5040080512f, 5.5045639555f, 5.5051198597f, 5.5056757640f, - 5.5062316683f, 5.5067875725f, 5.5073434768f, 5.5078993810f, 5.5084552853f, - 5.5090111895f, 5.5095670938f, 5.5101229981f, 5.5106789023f, 5.5112348066f, - 5.5117907108f, 5.5123466151f, 5.5129025194f, 5.5134584236f, 5.5140143279f, - 5.5145702321f, 5.5151261364f, 5.5156820406f, 5.5162379449f, 5.5167938492f, - 5.5173497534f, 5.5179056577f, 5.5184615619f, 5.5190174662f, 5.5195733704f, - 5.5201292747f, 5.5206851790f, 5.5212410832f, 5.5217969875f, 5.5223528917f, - 5.5229087960f, 5.5234647002f, 5.5240206045f, 5.5245765088f, 5.5251324130f, - 5.5256883173f, 5.5262442215f, 5.5268001258f, 5.5273560300f, 5.5279119343f, - 5.5284678386f, 5.5290237428f, 5.5295796471f, 5.5301355513f, 5.5306914556f, - 5.5312473598f, 5.5318032641f, 5.5323591684f, 5.5329150726f, 5.5334709769f, - 5.5340268811f, 5.5345827854f, 5.5351386896f, 5.5356945939f, 5.5362504982f, - 5.5368064024f, 5.5373623067f, 5.5379182109f, 5.5384741152f, 5.5390300194f, - 5.5395859237f, 5.5401418280f, 5.5406977322f, 5.5412536365f, 5.5418095407f, - 5.5423654450f, 5.5429213492f, 5.5434772535f, 5.5440331578f, 5.5445890620f, - 5.5451449663f, 5.5457008705f, 5.5462567748f, 5.5468126790f, 5.5473685833f, - 5.5479244876f, 5.5484803918f, 5.5490362961f, 5.5495922003f, 5.5501481046f, - 5.5507040088f, 5.5512599131f, 5.5518158174f, 5.5523717216f, 5.5529276259f, - 5.5534835301f, 5.5540394344f, 5.5545953386f, 5.5551512429f, 5.5557071472f, - 5.5562630514f, 5.5568189557f, 5.5573748599f, 5.5579307642f, 5.5584866684f, -}; -static float get_threshold_vs_intensity(float value) { - DCHECK(value >= 0.0f); - DCHECK(value < 100.0f); - return gTVITable[(int)(value * 100.0f)]; -} - -static float gVisualMaskTable[] = { - 1.0000000000f, 1.1897247198f, 1.6811970813f, 2.1839523495f, - 2.6547752201f, 3.0963096336f, 3.5139692055f, 3.9121076634f, - 4.2939844505f, 4.6620559235f, 5.0182118232f, 5.3639381283f, - 5.7004270140f, 6.0286520228f, 6.3494205286f, 6.6634111728f, - 6.9712011485f, 7.2732864768f, 7.5700973467f, 7.8620099053f, - 8.1493554541f, 8.4324277147f, 8.7114886393f, 8.9867731060f, - 9.2584927519f, 9.5268391297f, 9.7919863293f, 10.0540931710f, - 10.3133050540f, 10.5697555236f, 10.8235676089f, 11.0748549704f, - 11.3237228897f, 11.5702691275f, 11.8145846707f, 12.0567543856f, - 12.2968575912f, 12.5349685653f, 12.7711569910f, 13.0054883541f, - 13.2380242961f, 13.4688229298f, 13.6979391221f, 13.9254247479f, - 14.1513289185f, 14.3756981881f, 14.5985767405f, 14.8200065586f, - 15.0400275782f, 15.2586778282f, 15.4759935584f, 15.6920093571f, - 15.9067582574f, 16.1202718361f, 16.3325803041f, 16.5437125892f, - 16.7536964134f, 16.9625583630f, 17.1703239549f, 17.3770176970f, - 17.5826631441f, 17.7872829508f, 17.9908989195f, 18.1935320461f, - 18.3952025619f, 18.5959299728f, 18.7957330963f, 18.9946300956f, - 19.1926385122f, 19.3897752951f, 19.5860568301f, 19.7814989656f, - 19.9761170379f, 20.1699258942f, 20.3629399152f, 20.5551730353f, - 20.7466387627f, 20.9373501975f, 21.1273200494f, 21.3165606539f, - 21.5050839883f, 21.6929016861f, 21.8800250510f, 22.0664650704f, - 22.2522324278f, 22.4373375146f, 22.6217904416f, 22.8056010496f, - 22.9887789198f, 23.1713333835f, 23.3532735311f, 23.5346082210f, - 23.7153460884f, 23.8954955528f, 24.0750648258f, 24.2540619184f, - 24.4324946480f, 24.6103706451f, 24.7876973593f, 24.9644820659f, - 25.1407318713f, 25.3164537188f, 25.4916543937f, 25.6663405286f, - 25.8405186082f, 26.0141949740f, 26.1873758287f, 26.3600672409f, - 26.5322751485f, 26.7040053635f, 26.8752635753f, 27.0460553544f, - 27.2163861562f, 27.3862613242f, 27.5556860931f, 27.7246655923f, - 27.8932048488f, 28.0613087898f, 28.2289822461f, 28.3962299542f, - 28.5630565593f, 28.7294666176f, 28.8954645988f, 29.0610548887f, - 29.2262417907f, 29.3910295289f, 29.5554222497f, 29.7194240236f, - 29.8830388479f, 30.0462706478f, 30.2091232789f, 30.3716005284f, - 30.5337061172f, 30.6954437015f, 30.8568168742f, 31.0178291668f, - 31.1784840505f, 31.3387849380f, 31.4987351846f, 31.6583380900f, - 31.8175968991f, 31.9765148037f, 32.1350949435f, 32.2933404076f, - 32.4512542352f, 32.6088394171f, 32.7660988969f, 32.9230355715f, - 33.0796522929f, 33.2359518686f, 33.3919370628f, 33.5476105975f, - 33.7029751531f, 33.8580333698f, 34.0127878477f, 34.1672411485f, - 34.3213957956f, 34.4752542755f, 34.6288190382f, 34.7820924981f, - 34.9350770346f, 35.0877749931f, 35.2401886853f, 35.3923203904f, - 35.5441723552f, 35.6957467952f, 35.8470458949f, 35.9980718087f, - 36.1488266612f, 36.2993125482f, 36.4495315367f, 36.5994856659f, - 36.7491769476f, 36.8986073668f, 37.0477788820f, 37.1966934258f, - 37.3453529055f, 37.4937592036f, 37.6419141780f, 37.7898196627f, - 37.9374774680f, 38.0848893814f, 38.2320571673f, 38.3789825683f, - 38.5256673046f, 38.6721130753f, 38.8183215582f, 38.9642944105f, - 39.1100332690f, 39.2555397503f, 39.4008154516f, 39.5458619506f, - 39.6906808062f, 39.8352735585f, 39.9796417293f, 40.1237868223f, - 40.2677103236f, 40.4114137019f, 40.5548984086f, 40.6981658783f, - 40.8412175291f, 40.9840547628f, 41.1266789651f, 41.2690915061f, - 41.4112937401f, 41.5532870064f, 41.6950726292f, 41.8366519180f, - 41.9780261675f, 42.1191966584f, 42.2601646571f, 42.4009314163f, - 42.5414981750f, 42.6818661588f, 42.8220365799f, 42.9620106376f, - 43.1017895185f, 43.2413743965f, 43.3807664328f, 43.5199667769f, - 43.6589765656f, 43.7977969244f, 43.9364289667f, 44.0748737945f, - 44.2131324986f, 44.3512061583f, 44.4890958421f, 44.6268026076f, - 44.7643275016f, 44.9016715605f, 45.0388358101f, 45.1758212661f, - 45.3126289340f, 45.4492598095f, 45.5857148782f, 45.7219951164f, - 45.8581014904f, 45.9940349575f, 46.1297964654f, 46.2653869528f, - 46.4008073495f, 46.5360585761f, 46.6711415446f, 46.8060571584f, - 46.9408063121f, 47.0753898922f, 47.2098087766f, 47.3440638352f, - 47.4781559296f, 47.6120859137f, 47.7458546332f, 47.8794629262f, - 48.0129116232f, 48.1462015470f, 48.2793335128f, 48.4123083288f, - 48.5451267955f, 48.6777897064f, 48.8102978481f, 48.9426519997f, - 49.0748529340f, 49.2069014164f, 49.3387982059f, 49.4705440547f, - 49.6021397085f, 49.7335859065f, 49.8648833815f, 49.9960328598f, - 50.1270350617f, 50.2578907012f, 50.3886004861f, 50.5191651183f, - 50.6495852939f, 50.7798617027f, 50.9099950290f, 51.0399859514f, - 51.1698351425f, 51.2995432697f, 51.4291109947f, 51.5585389736f, - 51.6878278571f, 51.8169782909f, 51.9459909150f, 52.0748663644f, - 52.2036052690f, 52.3322082533f, 52.4606759371f, 52.5890089350f, - 52.7172078569f, 52.8452733075f, 52.9732058871f, 53.1010061908f, - 53.2286748093f, 53.3562123287f, 53.4836193301f, 53.6108963906f, - 53.7380440824f, 53.8650629734f, 53.9919536271f, 54.1187166027f, - 54.2453524549f, 54.3718617344f, 54.4982449875f, 54.6245027566f, - 54.7506355796f, 54.8766439908f, 55.0025285200f, 55.1282896933f, - 55.2539280328f, 55.3794440568f, 55.5048382795f, 55.6301112115f, - 55.7552633595f, 55.8802952267f, 56.0052073123f, 56.1300001119f, - 56.2546741177f, 56.3792298181f, 56.5036676981f, 56.6279882391f, - 56.7521919190f, 56.8762792124f, 57.0002505904f, 57.1241065208f, - 57.2478474679f, 57.3714738931f, 57.4949862540f, 57.6183850054f, - 57.7416705987f, 57.8648434822f, 57.9879041011f, 58.1108528974f, - 58.2336903102f, 58.3564167752f, 58.4790327256f, 58.6015385911f, - 58.7239347990f, 58.8462217731f, 58.9683999348f, 59.0904697023f, - 59.2124314911f, 59.3342857139f, 59.4560327806f, 59.5776730984f, - 59.6992070716f, 59.8206351019f, 59.9419575885f, 60.0631749276f, - 60.1842875131f, 60.3052957360f, 60.4261999850f, 60.5470006461f, - 60.6676981027f, 60.7882927359f, 60.9087849242f, 61.0291750436f, - 61.1494634678f, 61.2696505679f, 61.3897367128f, 61.5097222688f, - 61.6296076002f, 61.7493930687f, 61.8690790336f, 61.9886658524f, - 62.1081538797f, 62.2275434684f, 62.3468349689f, 62.4660287294f, - 62.5851250961f, 62.7041244128f, 62.8230270213f, 62.9418332613f, - 63.0605434703f, 63.1791579837f, 63.2976771350f, 63.4161012555f, - 63.5344306745f, 63.6526657193f, 63.7708067152f, 63.8888539855f, - 64.0068078516f, 64.1246686328f, 64.2424366468f, 64.3601122090f, - 64.4776956331f, 64.5951872310f, 64.7125873125f, 64.8298961859f, - 64.9471141573f, 65.0642415312f, 65.1812786102f, 65.2982256953f, - 65.4150830854f, 65.5318510781f, 65.6485299688f, 65.7651200514f, - 65.8816216181f, 65.9980349595f, 66.1143603642f, 66.2305981194f, - 66.3467485106f, 66.4628118215f, 66.5787883345f, 66.6946783300f, - 66.8104820871f, 66.9261998832f, 67.0418319940f, 67.1573786939f, - 67.2728402556f, 67.3882169501f, 67.5035090473f, 67.6187168152f, - 67.7338405204f, 67.8488804281f, 67.9638368020f, 68.0787099043f, - 68.1934999957f, 68.3082073356f, 68.4228321819f, 68.5373747910f, - 68.6518354179f, 68.7662143164f, 68.8805117387f, 68.9947279357f, - 69.1088631570f, 69.2229176507f, 69.3368916637f, 69.4507854415f, - 69.5645992283f, 69.6783332670f, 69.7919877992f, 69.9055630651f, - 70.0190593037f, 70.1324767528f, 70.2458156488f, 70.3590762270f, - 70.4722587213f, 70.5853633645f, 70.6983903880f, 70.8113400223f, - 70.9242124963f, 71.0370080380f, 71.1497268740f, 71.2623692300f, - 71.3749353302f, 71.4874253979f, 71.5998396551f, 71.7121783227f, - 71.8244416205f, 71.9366297670f, 72.0487429799f, 72.1607814755f, - 72.2727454691f, 72.3846351749f, 72.4964508061f, 72.6081925746f, - 72.7198606915f, 72.8314553666f, 72.9429768088f, 73.0544252259f, - 73.1658008247f, 73.2771038108f, 73.3883343890f, 73.4994927630f, - 73.6105791353f, 73.7215937078f, 73.8325366810f, 73.9434082546f, - 74.0542086273f, 74.1649379969f, 74.2755965600f, 74.3861845126f, - 74.4967020493f, 74.6071493641f, 74.7175266499f, 74.8278340987f, - 74.9380719016f, 75.0482402488f, 75.1583393294f, 75.2683693318f, - 75.3783304435f, 75.4882228508f, 75.5980467396f, 75.7078022944f, - 75.8174896992f, 75.9271091370f, 76.0366607899f, 76.1461448391f, - 76.2555614651f, 76.3649108474f, 76.4741931647f, 76.5834085949f, - 76.6925573150f, 76.8016395013f, 76.9106553292f, 77.0196049731f, - 77.1284886069f, 77.2373064036f, 77.3460585353f, 77.4547451733f, - 77.5633664883f, 77.6719226499f, 77.7804138273f, 77.8888401887f, - 77.9972019015f, 78.1054991325f, 78.2137320475f, 78.3219008118f, - 78.4300055898f, 78.5380465452f, 78.6460238410f, 78.7539376394f, - 78.8617881018f, 78.9695753891f, 79.0772996613f, 79.1849610777f, - 79.2925597969f, 79.4000959769f, 79.5075697749f, 79.6149813473f, - 79.7223308501f, 79.8296184382f, 79.9368442662f, 80.0440084879f, - 80.1511112563f, 80.2581527238f, 80.3651330422f, 80.4720523625f, - 80.5789108353f, 80.6857086103f, 80.7924458365f, 80.8991226625f, - 81.0057392361f, 81.1122957045f, 81.2187922142f, 81.3252289112f, - 81.4316059408f, 81.5379234477f, 81.6441815758f, 81.7503804687f, - 81.8565202691f, 81.9626011194f, 82.0686231610f, 82.1745865351f, - 82.2804913820f, 82.3863378415f, 82.4921260530f, 82.5978561550f, - 82.7035282856f, 82.8091425824f, 82.9146991821f, 83.0201982212f, - 83.1256398354f, 83.2310241599f, 83.3363513293f, 83.4416214778f, - 83.5468347389f, 83.6519912455f, 83.7570911301f, 83.8621345245f, - 83.9671215601f, 84.0720523677f, 84.1769270775f, 84.2817458193f, - 84.3865087223f, 84.4912159151f, 84.5958675259f, 84.7004636823f, - 84.8050045115f, 84.9094901400f, 85.0139206939f, 85.1182962987f, - 85.2226170797f, 85.3268831613f, 85.4310946675f, 85.5352517220f, - 85.6393544479f, 85.7434029677f, 85.8473974035f, 85.9513378769f, - 86.0552245091f, 86.1590574207f, 86.2628367319f, 86.3665625623f, - 86.4702350312f, 86.5738542574f, 86.6774203591f, 86.7809334542f, - 86.8843936600f, 86.9878010934f, 87.0911558709f, 87.1944581085f, - 87.2977079216f, 87.4009054254f, 87.5040507346f, 87.6071439633f, - 87.7101852253f, 87.8131746340f, 87.9161123021f, 88.0189983422f, - 88.1218328663f, 88.2246159860f, 88.3273478124f, 88.4300284562f, - 88.5326580279f, 88.6352366372f, 88.7377643937f, 88.8402414064f, - 88.9426677840f, 89.0450436347f, 89.1473690663f, 89.2496441863f, - 89.3518691018f, 89.4540439192f, 89.5561687448f, 89.6582436845f, - 89.7602688437f, 89.8622443273f, 89.9641702401f, 90.0660466863f, - 90.1678737697f, 90.2696515939f, 90.3713802619f, 90.4730598764f, - 90.5746905398f, 90.6762723540f, 90.7778054207f, 90.8792898409f, - 90.9807257156f, 91.0821131453f, 91.1834522300f, 91.2847430694f, - 91.3859857630f, 91.4871804097f, 91.5883271082f, 91.6894259568f, - 91.7904770534f, 91.8914804956f, 91.9924363807f, 92.0933448055f, - 92.1942058666f, 92.2950196600f, 92.3957862818f, 92.4965058274f, - 92.5971783918f, 92.6978040701f, 92.7983829565f, 92.8989151453f, - 92.9994007303f, 93.0998398050f, 93.2002324624f, 93.3005787954f, - 93.4008788965f, 93.5011328579f, 93.6013407713f, 93.7015027284f, - 93.8016188202f, 93.9016891376f, 94.0017137713f, 94.1016928114f, - 94.2016263479f, 94.3015144703f, 94.4013572681f, 94.5011548300f, - 94.6009072449f, 94.7006146011f, 94.8002769867f, 94.8998944894f, - 94.9994671967f, 95.0989951957f, 95.1984785734f, 95.2979174161f, - 95.3973118103f, 95.4966618419f, 95.5959675966f, 95.6952291597f, - 95.7944466164f, 95.8936200514f, 95.9927495492f, 96.0918351941f, - 96.1908770701f, 96.2898752607f, 96.3888298493f, 96.4877409192f, - 96.5866085529f, 96.6854328332f, 96.7842138422f, 96.8829516620f, - 96.9816463742f, 97.0802980603f, 97.1789068014f, 97.2774726785f, - 97.3759957722f, 97.4744761627f, 97.5729139303f, 97.6713091547f, - 97.7696619155f, 97.8679722920f, 97.9662403632f, 98.0644662079f, - 98.1626499046f, 98.2607915316f, 98.3588911669f, 98.4569488882f, - 98.5549647731f, 98.6529388986f, 98.7508713419f, 98.8487621797f, - 98.9466114885f, 99.0444193444f, 99.1421858235f, 99.2399110016f, - 99.3375949541f, 99.4352377563f, 99.5328394832f, 99.6304002096f, - 99.7279200099f, 99.8253989586f, 99.9228371296f, 100.0202345968f, - 100.1175914337f, 100.2149077137f, 100.3121835099f, 100.4094188952f, - 100.5066139422f, 100.6037687234f, 100.7008833108f, 100.7979577766f, - 100.8949921924f, 100.9919866297f, 101.0889411597f, 101.1858558537f, - 101.2827307823f, 101.3795660162f, 101.4763616257f, 101.5731176811f, - 101.6698342523f, 101.7665114090f, 101.8631492207f, 101.9597477567f, - 102.0563070861f, 102.1528272777f, 102.2493084002f, 102.3457505221f, - 102.4421537115f, 102.5385180365f, 102.6348435649f, 102.7311303643f, - 102.8273785020f, 102.9235880452f, 103.0197590609f, 103.1158916160f, - 103.2119857768f, 103.3080416099f, 103.4040591813f, 103.5000385570f, - 103.5959798028f, 103.6918829842f, 103.7877481666f, 103.8835754151f, - 103.9793647947f, 104.0751163702f, 104.1708302060f, 104.2665063667f, - 104.3621449164f, 104.4577459190f, 104.5533094383f, 104.6488355380f, - 104.7443242815f, 104.8397757320f, 104.9351899524f, 105.0305670058f, - 105.1259069546f, 105.2212098614f, 105.3164757885f, 105.4117047980f, - 105.5068969518f, 105.6020523115f, 105.6971709388f, 105.7922528951f, - 105.8872982415f, 105.9823070389f, 106.0772793484f, 106.1722152304f, - 106.2671147454f, 106.3619779539f, 106.4568049157f, 106.5515956910f, - 106.6463503394f, 106.7410689206f, 106.8357514940f, 106.9303981188f, - 107.0250088540f, 107.1195837586f, 107.2141228914f, 107.3086263108f, - 107.4030940752f, 107.4975262429f, 107.5919228720f, 107.6862840202f, - 107.7806097454f, 107.8749001050f, 107.9691551565f, 108.0633749571f, - 108.1575595639f, 108.2517090336f, 108.3458234232f, 108.4399027890f, - 108.5339471877f, 108.6279566753f, 108.7219313080f, 108.8158711417f, - 108.9097762323f, 109.0036466352f, 109.0974824060f, 109.1912835999f, - 109.2850502721f, 109.3787824776f, 109.4724802713f, 109.5661437077f, - 109.6597728415f, 109.7533677269f, 109.8469284183f, 109.9404549697f, - 110.0339474349f, 110.1274058679f, 110.2208303221f, 110.3142208510f, - 110.4075775081f, 110.5009003464f, 110.5941894189f, 110.6874447786f, - 110.7806664782f, 110.8738545702f, 110.9670091071f, 111.0601301412f, - 111.1532177247f, 111.2462719095f, 111.3392927475f, 111.4322802905f, - 111.5252345899f, 111.6181556974f, 111.7110436640f, 111.8038985411f, - 111.8967203797f, 111.9895092305f, 112.0822651444f, 112.1749881720f, - 112.2676783636f, 112.3603357697f, 112.4529604405f, 112.5455524260f, - 112.6381117761f, 112.7306385406f, 112.8231327691f, 112.9155945113f, - 113.0080238164f, 113.1004207337f, 113.1927853124f, 113.2851176014f, - 113.3774176496f, 113.4696855057f, 113.5619212183f, 113.6541248359f, - 113.7462964068f, 113.8384359793f, 113.9305436014f, 114.0226193210f, - 114.1146631860f, 114.2066752442f, 114.2986555430f, 114.3906041299f, - 114.4825210522f, 114.5744063572f, 114.6662600919f, 114.7580823033f, - 114.8498730381f, 114.9416323432f, 115.0333602650f, 115.1250568500f, - 115.2167221447f, 115.3083561951f, 115.3999590474f, 115.4915307475f, - 115.5830713414f, 115.6745808747f, 115.7660593931f, 115.8575069420f, - 115.9489235669f, 116.0403093131f, 116.1316642256f, 116.2229883494f, - 116.3142817296f, 116.4055444109f, 116.4967764380f, 116.5879778554f, - 116.6791487077f, 116.7702890390f, 116.8613988938f, 116.9524783161f, - 117.0435273498f, 117.1345460389f, 117.2255344272f, 117.3164925583f, - 117.4074204757f, 117.4983182229f, 117.5891858433f, 117.6800233801f, - 117.7708308763f, 117.8616083750f, 117.9523559190f, 118.0430735512f, - 118.1337613143f, 118.2244192507f, 118.3150474030f, 118.4056458135f, - 118.4962145245f, 118.5867535781f, 118.6772630163f, 118.7677428811f, - 118.8581932143f, 118.9486140577f, 119.0390054528f, 119.1293674411f, - 119.2197000642f, 119.3100033632f, 119.4002773794f, 119.4905221539f, - 119.5807377277f, 119.6709241416f, 119.7610814366f, 119.8512096532f, - 119.9413088322f, 120.0313790139f, 120.1214202388f, 120.2114325471f, - 120.3014159792f, 120.3913705750f, 120.4812963746f, 120.5711934178f, - 120.6610617446f, 120.7509013945f, 120.8407124072f, 120.9304948223f, - 121.0202486791f, 121.1099740169f, 121.1996708750f, 121.2893392925f, - 121.3789793085f, 121.4685909619f, 121.5581742915f, 121.6477293361f, - 121.7372561343f, 121.8267547248f, 121.9162251459f, 122.0056674361f, - 122.0950816337f, 122.1844677768f, 122.2738259035f, 122.3631560520f, - 122.4524582600f, 122.5417325654f, 122.6309790060f, 122.7201976194f, - 122.8093884431f, 122.8985515147f, 122.9876868715f, 123.0767945508f, - 123.1658745898f, 123.2549270256f, 123.3439518953f, 123.4329492357f, - 123.5219190838f, 123.6108614763f, 123.6997764499f, 123.7886640412f, - 123.8775242866f, 123.9663572226f, 124.0551628856f, 124.1439413117f, - 124.2326925372f, 124.3214165980f, 124.4101135303f, 124.4987833699f, - 124.5874261526f, 124.6760419142f, 124.7646306903f, 124.8531925165f, - 124.9417274284f, 125.0302354612f, 125.1187166504f, 125.2071710311f, - 125.2955986386f, 125.3839995079f, 125.4723736740f, 125.5607211719f, - 125.6490420363f, 125.7373363021f, 125.8256040038f, 125.9138451762f, - 126.0020598537f, 126.0902480708f, 126.1784098618f, 126.2665452609f, - 126.3546543025f, 126.4427370206f, 126.5307934493f, 126.6188236225f, - 126.7068275742f, 126.7948053381f, 126.8827569480f, 126.9706824375f, - 127.0585818402f, 127.1464551896f, 127.2343025192f, 127.3221238623f, - 127.4099192522f, 127.4976887221f, 127.5854323050f, 127.6731500342f, - 127.7608419425f, 127.8485080628f, 127.9361484281f, 128.0237630709f, - 128.1113520241f, 128.1989153202f, 128.2864529918f, 128.3739650713f, - 128.4614515912f, 128.5489125836f, 128.6363480810f, 128.7237581154f, - 128.8111427189f, 128.8985019236f, 128.9858357615f, 129.0731442644f, - 129.1604274642f, 129.2476853926f, 129.3349180812f, 129.4221255617f, - 129.5093078657f, 129.5964650245f, 129.6835970696f, 129.7707040323f, - 129.8577859439f, 129.9448428355f, 130.0318747383f, 130.1188816833f, - 130.2058637015f, 130.2928208239f, 130.3797530812f, 130.4666605043f, - 130.5535431239f, 130.6404009705f, 130.7272340749f, 130.8140424675f, - 130.9008261787f, 130.9875852390f, 131.0743196786f, 131.1610295278f, - 131.2477148168f, 131.3343755757f, 131.4210118345f, 131.5076236233f, - 131.5942109719f, 131.6807739103f, 131.7673124681f, 131.8538266752f, - 131.9403165612f, 132.0267821556f, 132.1132234881f, 132.1996405881f, - 132.2860334850f, 132.3724022082f, 132.4587467869f, 132.5450672504f, - 132.6313636279f, 132.7176359483f, 132.8038842408f, 132.8901085343f, - 132.9763088578f, 133.0624852401f, 133.1486377099f, 133.2347662960f, - 133.3208710271f, 133.4069519318f, 133.4930090386f, 133.5790423760f, - 133.6650519724f, 133.7510378562f, 133.8370000556f, 133.9229385990f, - 134.0088535146f, 134.0947448303f, 134.1806125744f, 134.2664567748f, - 134.3522774594f, 134.4380746562f, 134.5238483930f, 134.6095986975f, - 134.6953255975f, 134.7810291206f, 134.8667092944f, 134.9523661465f, - 135.0379997043f, 135.1236099953f, 135.2091970468f, 135.2947608862f, - 135.3803015407f, 135.4658190375f, 135.5513134037f, 135.6367846665f, - 135.7222328529f, 135.8076579897f, 135.8930601041f, 135.9784392227f, - 136.0637953725f, 136.1491285802f, 136.2344388724f, 136.3197262759f, - 136.4049908171f, 136.4902325227f, 136.5754514192f, 136.6606475328f, - 136.7458208901f, 136.8309715173f, 136.9160994407f, 137.0012046865f, - 137.0862872808f, 137.1713472498f, 137.2563846195f, 137.3413994159f, - 137.4263916650f, 137.5113613926f, 137.5963086245f, 137.6812333866f, - 137.7661357046f, 137.8510156042f, 137.9358731110f, 138.0207082505f, - 138.1055210484f, 138.1903115300f, 138.2750797208f, 138.3598256462f, - 138.4445493315f, 138.5292508020f, 138.6139300828f, 138.6985871992f, - 138.7832221762f, 138.8678350390f, 138.9524258125f, 139.0369945218f, - 139.1215411916f, 139.2060658470f, 139.2905685127f, 139.3750492135f, - 139.4595079741f, 139.5439448191f, 139.6283597733f, 139.7127528612f, - 139.7971241072f, 139.8814735359f, 139.9658011717f, 140.0501070390f, - 140.1343911620f, 140.2186535652f, 140.3028942727f, 140.3871133086f, - 140.4713106973f, 140.5554864626f, 140.6396406287f, 140.7237732196f, - 140.8078842593f, 140.8919737715f, 140.9760417802f, 141.0600883092f, - 141.1441133823f, 141.2281170231f, 141.3120992554f, 141.3960601027f, - 141.4799995886f, 141.5639177367f, 141.6478145705f, 141.7316901133f, - 141.8155443886f, 141.8993774198f, 141.9831892301f, 142.0669798427f, - 142.1507492810f, 142.2344975681f, 142.3182247270f, 142.4019307809f, - 142.4856157528f, 142.5692796657f, 142.6529225426f, 142.7365444062f, - 142.8201452796f, 142.9037251855f, 142.9872841467f, 143.0708221858f, - 143.1543393257f, 143.2378355888f, 143.3213109979f, 143.4047655755f, - 143.4881993440f, 143.5716123260f, 143.6550045438f, 143.7383760199f, - 143.8217267766f, 143.9050568361f, 143.9883662208f, 144.0716549528f, - 144.1549230543f, 144.2381705475f, 144.3213974544f, 144.4046037970f, - 144.4877895974f, 144.5709548775f, 144.6540996592f, 144.7372239644f, - 144.8203278150f, 144.9034112327f, 144.9864742394f, 145.0695168566f, - 145.1525391061f, 145.2355410094f, 145.3185225883f, 145.4014838642f, - 145.4844248587f, 145.5673455931f, 145.6502460891f, 145.7331263678f, - 145.8159864507f, 145.8988263591f, 145.9816461143f, 146.0644457375f, - 146.1472252498f, 146.2299846724f, 146.3127240265f, 146.3954433331f, - 146.4781426132f, 146.5608218878f, 146.6434811779f, 146.7261205044f, - 146.8087398882f, 146.8913393501f, 146.9739189109f, 147.0564785914f, - 147.1390184123f, 147.2215383942f, 147.3040385579f, 147.3865189239f, - 147.4689795129f, 147.5514203452f, 147.6338414415f, 147.7162428222f, - 147.7986245077f, 147.8809865184f, 147.9633288746f, 148.0456515967f, - 148.1279547049f, 148.2102382194f, 148.2925021605f, 148.3747465483f, - 148.4569714029f, 148.5391767445f, 148.6213625930f, 148.7035289685f, - 148.7856758910f, 148.8678033804f, 148.9499114566f, 149.0320001395f, - 149.1140694489f, 149.1961194046f, 149.2781500263f, 149.3601613339f, - 149.4421533470f, 149.5241260852f, 149.6060795682f, 149.6880138155f, - 149.7699288467f, 149.8518246813f, 149.9337013388f, 150.0155588387f, - 150.0973972003f, 150.1792164430f, 150.2610165862f, 150.3427976491f, - 150.4245596511f, 150.5063026114f, 150.5880265491f, 150.6697314835f, - 150.7514174336f, 150.8330844186f, 150.9147324576f, 150.9963615695f, - 151.0779717734f, 151.1595630882f, 151.2411355329f, 151.3226891264f, - 151.4042238874f, 151.4857398350f, 151.5672369878f, 151.6487153646f, - 151.7301749841f, 151.8116158651f, 151.8930380262f, 151.9744414860f, - 152.0558262632f, 152.1371923763f, 152.2185398438f, 152.2998686843f, - 152.3811789161f, 152.4624705578f, 152.5437436278f, 152.6249981444f, - 152.7062341259f, 152.7874515908f, 152.8686505571f, 152.9498310433f, - 153.0309930674f, 153.1121366477f, 153.1932618024f, 153.2743685495f, - 153.3554569071f, 153.4365268933f, 153.5175785261f, 153.5986118235f, - 153.6796268035f, 153.7606234840f, 153.8416018828f, 153.9225620179f, - 154.0035039071f, 154.0844275682f, 154.1653330190f, 154.2462202772f, - 154.3270893605f, 154.4079402866f, 154.4887730732f, 154.5695877379f, - 154.6503842982f, 154.7311627718f, 154.8119231762f, 154.8926655288f, - 154.9733898472f, 155.0540961487f, 155.1347844509f, 155.2154547711f, - 155.2961071266f, 155.3767415347f, 155.4573580128f, 155.5379565781f, - 155.6185372479f, 155.6991000393f, 155.7796449696f, 155.8601720558f, - 155.9406813151f, 156.0211727646f, 156.1016464214f, 156.1821023024f, - 156.2625404247f, 156.3429608053f, 156.4233634611f, 156.5037484089f, - 156.5841156658f, 156.6644652485f, 156.7447971740f, 156.8251114589f, - 156.9054081201f, 156.9856871743f, 157.0659486382f, 157.1461925285f, - 157.2264188620f, 157.3066276551f, 157.3868189246f, 157.4669926869f, - 157.5471489587f, 157.6272877565f, 157.7074090968f, 157.7875129959f, - 157.8675994705f, 157.9476685368f, 158.0277202114f, 158.1077545104f, - 158.1877714503f, 158.2677710474f, 158.3477533179f, 158.4277182781f, - 158.5076659443f, 158.5875963325f, 158.6675094590f, 158.7474053400f, - 158.8272839914f, 158.9071454295f, 158.9869896703f, 159.0668167298f, - 159.1466266241f, 159.2264193691f, 159.3061949807f, 159.3859534750f, - 159.4656948677f, 159.5454191749f, 159.6251264123f, 159.7048165957f, - 159.7844897410f, 159.8641458640f, 159.9437849804f, 160.0234071058f, - 160.1030122561f, 160.1826004468f, 160.2621716937f, 160.3417260124f, - 160.4212634183f, 160.5007839272f, 160.5802875545f, 160.6597743159f, - 160.7392442266f, 160.8186973023f, 160.8981335584f, 160.9775530103f, - 161.0569556734f, 161.1363415631f, 161.2157106946f, 161.2950630834f, - 161.3743987447f, 161.4537176937f, 161.5330199458f, 161.6123055162f, - 161.6915744200f, 161.7708266724f, 161.8500622886f, 161.9292812837f, - 162.0084836727f, 162.0876694708f, 162.1668386930f, 162.2459913544f, - 162.3251274698f, 162.4042470544f, 162.4833501231f, 162.5624366907f, - 162.6415067723f, 162.7205603826f, 162.7995975366f, 162.8786182490f, - 162.9576225347f, 163.0366104085f, 163.1155818851f, 163.1945369793f, - 163.2734757058f, 163.3523980793f, 163.4313041144f, 163.5101938259f, - 163.5890672282f, 163.6679243361f, 163.7467651641f, 163.8255897267f, - 163.9043980385f, 163.9831901141f, 164.0619659678f, 164.1407256141f, - 164.2194690675f, 164.2981963425f, 164.3769074533f, 164.4556024144f, - 164.5342812400f, 164.6129439447f, 164.6915905426f, 164.7702210480f, - 164.8488354752f, 164.9274338384f, 165.0060161518f, 165.0845824297f, - 165.1631326862f, 165.2416669354f, 165.3201851915f, 165.3986874686f, - 165.4771737807f, 165.5556441419f, 165.6340985663f, 165.7125370679f, - 165.7909596606f, 165.8693663585f, 165.9477571755f, 166.0261321255f, - 166.1044912224f, 166.1828344801f, 166.2611619125f, 166.3394735334f, - 166.4177693567f, 166.4960493961f, 166.5743136654f, 166.6525621784f, - 166.7307949488f, 166.8090119903f, 166.8872133167f, 166.9653989416f, - 167.0435688786f, 167.1217231414f, 167.1998617436f, 167.2779846988f, - 167.3560920205f, 167.4341837223f, 167.5122598177f, 167.5903203203f, - 167.6683652435f, 167.7463946007f, 167.8244084055f, 167.9024066713f, - 167.9803894113f, 168.0583566392f, 168.1363083681f, 168.2142446114f, - 168.2921653825f, 168.3700706947f, 168.4479605612f, 168.5258349954f, - 168.6036940103f, 168.6815376194f, 168.7593658357f, 168.8371786724f, - 168.9149761428f, 168.9927582599f, 169.0705250369f, 169.1482764869f, - 169.2260126229f, 169.3037334580f, 169.3814390053f, 169.4591292777f, - 169.5368042884f, 169.6144640502f, 169.6921085762f, 169.7697378792f, - 169.8473519722f, 169.9249508681f, 170.0025345798f, 170.0801031202f, - 170.1576565021f, 170.2351947383f, 170.3127178416f, 170.3902258249f, - 170.4677187009f, 170.5451964824f, 170.6226591820f, 170.7001068125f, - 170.7775393866f, 170.8549569170f, 170.9323594164f, 171.0097468972f, - 171.0871193723f, 171.1644768542f, 171.2418193554f, 171.3191468886f, - 171.3964594662f, 171.4737571009f, 171.5510398050f, 171.6283075911f, - 171.7055604718f, 171.7827984593f, 171.8600215662f, 171.9372298048f, - 172.0144231877f, 172.0916017270f, 172.1687654353f, 172.2459143248f, - 172.3230484079f, 172.4001676969f, 172.4772722040f, 172.5543619416f, - 172.6314369219f, 172.7084971570f, 172.7855426594f, 172.8625734410f, - 172.9395895142f, 173.0165908910f, 173.0935775837f, 173.1705496043f, - 173.2475069650f, 173.3244496778f, 173.4013777548f, 173.4782912082f, - 173.5551900498f, 173.6320742918f, 173.7089439461f, 173.7857990248f, - 173.8626395397f, 173.9394655029f, 174.0162769263f, 174.0930738218f, - 174.1698562013f, 174.2466240766f, 174.3233774598f, 174.4001163625f, - 174.4768407966f, 174.5535507740f, 174.6302463064f, 174.7069274056f, - 174.7835940834f, 174.8602463515f, 174.9368842217f, 175.0135077056f, - 175.0901168150f, 175.1667115616f, 175.2432919569f, 175.3198580127f, - 175.3964097406f, 175.4729471521f, 175.5494702589f, 175.6259790726f, - 175.7024736047f, 175.7789538667f, 175.8554198703f, 175.9318716268f, - 176.0083091478f, 176.0847324449f, 176.1611415293f, 176.2375364127f, - 176.3139171063f, 176.3902836217f, 176.4666359702f, 176.5429741633f, - 176.6192982122f, 176.6956081283f, 176.7719039230f, 176.8481856076f, - 176.9244531933f, 177.0007066915f, 177.0769461134f, 177.1531714704f, - 177.2293827735f, 177.3055800341f, 177.3817632633f, 177.4579324723f, - 177.5340876724f, 177.6102288746f, 177.6863560902f, 177.7624693302f, - 177.8385686057f, 177.9146539279f, 177.9907253078f, 178.0667827565f, - 178.1428262850f, 178.2188559044f, 178.2948716257f, 178.3708734598f, - 178.4468614179f, 178.5228355108f, 178.5987957495f, 178.6747421449f, - 178.7506747080f, 178.8265934497f, 178.9024983809f, 178.9783895124f, - 179.0542668552f, 179.1301304200f, 179.2059802178f, 179.2818162592f, - 179.3576385552f, 179.4334471165f, 179.5092419539f, 179.5850230782f, - 179.6607905000f, 179.7365442302f, 179.8122842794f, 179.8880106584f, - 179.9637233778f, 180.0394224483f, 180.1151078806f, 180.1907796852f, - 180.2664378729f, 180.3420824542f, 180.4177134398f, 180.4933308401f, - 180.5689346659f, 180.6445249276f, 180.7201016357f, 180.7956648009f, - 180.8712144335f, 180.9467505442f, 181.0222731434f, 181.0977822415f, - 181.1732778490f, 181.2487599764f, 181.3242286340f, 181.3996838323f, - 181.4751255817f, 181.5505538925f, 181.6259687752f, 181.7013702400f, - 181.7767582973f, 181.8521329575f, 181.9274942309f, 182.0028421276f, - 182.0781766581f, 182.1534978326f, 182.2288056614f, 182.3041001546f, - 182.3793813226f, 182.4546491755f, 182.5299037235f, 182.6051449769f, - 182.6803729457f, 182.7555876402f, 182.8307890705f, 182.9059772467f, - 182.9811521789f, 183.0563138773f, 183.1314623519f, 183.2065976128f, - 183.2817196701f, 183.3568285338f, 183.4319242139f, 183.5070067206f, - 183.5820760637f, 183.6571322532f, 183.7321752993f, 183.8072052118f, - 183.8822220006f, 183.9572256758f, 184.0322162472f, 184.1071937248f, - 184.1821581184f, 184.2571094380f, 184.3320476935f, 184.4069728946f, - 184.4818850513f, 184.5567841733f, 184.6316702706f, 184.7065433528f, - 184.7814034299f, 184.8562505115f, 184.9310846075f, 185.0059057276f, - 185.0807138816f, 185.1555090791f, 185.2302913300f, 185.3050606438f, - 185.3798170304f, 185.4545604994f, 185.5292910604f, 185.6040087231f, - 185.6787134972f, 185.7534053922f, 185.8280844179f, 185.9027505837f, - 185.9774038993f, 186.0520443743f, 186.1266720182f, 186.2012868406f, - 186.2758888510f, 186.3504780590f, 186.4250544740f, 186.4996181056f, - 186.5741689633f, 186.6487070564f, 186.7232323946f, 186.7977449873f, - 186.8722448438f, 186.9467319736f, 187.0212063862f, 187.0956680910f, - 187.1701170972f, 187.2445534144f, 187.3189770518f, 187.3933880189f, - 187.4677863249f, 187.5421719793f, 187.6165449912f, 187.6909053701f, - 187.7652531252f, 187.8395882658f, 187.9139108012f, 187.9882207406f, - 188.0625180933f, 188.1368028685f, 188.2110750754f, 188.2853347233f, - 188.3595818212f, 188.4338163785f, 188.5080384043f, 188.5822479078f, - 188.6564448980f, 188.7306293842f, 188.8048013755f, 188.8789608809f, - 188.9531079096f, 189.0272424707f, 189.1013645733f, 189.1754742264f, - 189.2495714391f, 189.3236562204f, 189.3977285793f, 189.4717885249f, - 189.5458360662f, 189.6198712122f, 189.6938939719f, 189.7679043542f, - 189.8419023681f, 189.9158880226f, 189.9898613266f, 190.0638222890f, - 190.1377709188f, 190.2117072248f, 190.2856312160f, 190.3595429012f, - 190.4334422893f, 190.5073293892f, 190.5812042097f, 190.6550667596f, - 190.7289170479f, 190.8027550832f, 190.8765808744f, 190.9503944303f, - 191.0241957597f, 191.0979848714f, 191.1717617740f, 191.2455264764f, - 191.3192789873f, 191.3930193154f, 191.4667474695f, 191.5404634582f, - 191.6141672902f, 191.6878589743f, 191.7615385190f, 191.8352059331f, - 191.9088612252f, 191.9825044039f, 192.0561354779f, 192.1297544558f, - 192.2033613461f, 192.2769561576f, 192.3505388987f, 192.4241095781f, - 192.4976682043f, 192.5712147858f, 192.6447493312f, 192.7182718491f, - 192.7917823479f, 192.8652808362f, 192.9387673224f, 193.0122418151f, - 193.0857043227f, 193.1591548537f, 193.2325934166f, 193.3060200197f, - 193.3794346716f, 193.4528373806f, 193.5262281552f, 193.5996070038f, - 193.6729739347f, 193.7463289564f, 193.8196720772f, 193.8930033056f, - 193.9663226497f, 194.0396301180f, 194.1129257188f, 194.1862094605f, - 194.2594813513f, 194.3327413995f, 194.4059896135f, 194.4792260014f, - 194.5524505717f, 194.6256633325f, 194.6988642921f, 194.7720534586f, - 194.8452308405f, 194.9183964458f, 194.9915502828f, 195.0646923597f, - 195.1378226846f, 195.2109412658f, 195.2840481114f, 195.3571432296f, - 195.4302266285f, 195.5032983162f, 195.5763583010f, 195.6494065908f, - 195.7224431938f, 195.7954681182f, 195.8684813719f, 195.9414829631f, - 196.0144728998f, 196.0874511902f, 196.1604178422f, 196.2333728638f, - 196.3063162632f, 196.3792480483f, 196.4521682272f, 196.5250768078f, - 196.5979737982f, 196.6708592062f, 196.7437330399f, 196.8165953073f, - 196.8894460163f, 196.9622851748f, 197.0351127907f, 197.1079288721f, - 197.1807334267f, 197.2535264626f, 197.3263079876f, 197.3990780095f, - 197.4718365363f, 197.5445835758f, 197.6173191358f, 197.6900432243f, - 197.7627558491f, 197.8354570179f, 197.9081467386f, 197.9808250191f, - 198.0534918670f, 198.1261472902f, 198.1987912965f, 198.2714238937f, - 198.3440450894f, 198.4166548915f, 198.4892533077f, 198.5618403458f, - 198.6344160133f, 198.7069803182f, 198.7795332680f, 198.8520748705f, - 198.9246051333f, 198.9971240642f, 199.0696316708f, 199.1421279607f, - 199.2146129416f, 199.2870866212f, 199.3595490071f, 199.4320001068f, - 199.5044399281f, 199.5768684785f, 199.6492857656f, 199.7216917971f, - 199.7940865804f, 199.8664701231f, 199.9388424328f, 200.0112035171f, - 200.0835533835f, 200.1558920396f, 200.2282194928f, 200.3005357506f, - 200.3728408206f, 200.4451347103f, 200.5174174271f, 200.5896889786f, - 200.6619493722f, 200.7341986153f, 200.8064367155f, 200.8786636801f, - 200.9508795166f, 201.0230842325f, 201.0952778350f, 201.1674603317f, - 201.2396317300f, 201.3117920372f, 201.3839412607f, 201.4560794079f, - 201.5282064862f, 201.6003225029f, 201.6724274653f, 201.7445213808f, - 201.8166042568f, 201.8886761005f, 201.9607369193f, 202.0327867204f, - 202.1048255112f, 202.1768532990f, 202.2488700910f, 202.3208758945f, - 202.3928707167f, 202.4648545650f, 202.5368274465f, 202.6087893686f, - 202.6807403383f, 202.7526803630f, 202.8246094499f, 202.8965276061f, - 202.9684348388f, 203.0403311553f, 203.1122165627f, 203.1840910682f, - 203.2559546790f, 203.3278074021f, 203.3996492448f, 203.4714802142f, - 203.5433003174f, 203.6151095615f, 203.6869079536f, 203.7586955009f, - 203.8304722104f, 203.9022380892f, 203.9739931444f, 204.0457373831f, - 204.1174708124f, 204.1891934392f, 204.2609052706f, 204.3326063138f, - 204.4042965756f, 204.4759760631f, 204.5476447834f, 204.6193027434f, - 204.6909499501f, 204.7625864106f, 204.8342121318f, 204.9058271206f, - 204.9774313841f, 205.0490249292f, 205.1206077629f, 205.1921798920f, - 205.2637413236f, 205.3352920645f, 205.4068321217f, 205.4783615020f, - 205.5498802124f, 205.6213882598f, 205.6928856511f, 205.7643723931f, - 205.8358484927f, 205.9073139568f, 205.9787687921f, 206.0502130057f, - 206.1216466042f, 206.1930695946f, 206.2644819837f, 206.3358837782f, - 206.4072749850f, 206.4786556109f, 206.5500256627f, 206.6213851471f, - 206.6927340710f, 206.7640724411f, 206.8354002641f, 206.9067175469f, - 206.9780242961f, 207.0493205185f, 207.1206062209f, 207.1918814099f, - 207.2631460924f, 207.3344002748f, 207.4056439641f, 207.4768771669f, - 207.5480998898f, 207.6193121395f, 207.6905139228f, 207.7617052462f, - 207.8328861165f, 207.9040565402f, 207.9752165241f, 208.0463660747f, - 208.1175051986f, 208.1886339026f, 208.2597521932f, 208.3308600770f, - 208.4019575606f, 208.4730446505f, 208.5441213535f, 208.6151876760f, - 208.6862436246f, 208.7572892058f, 208.8283244263f, 208.8993492926f, - 208.9703638111f, 209.0413679885f, 209.1123618313f, 209.1833453459f, - 209.2543185389f, 209.3252814168f, 209.3962339860f, 209.4671762531f, - 209.5381082245f, 209.6090299068f, 209.6799413063f, 209.7508424296f, - 209.8217332830f, 209.8926138730f, 209.9634842062f, 210.0343442888f, - 210.1051941273f, 210.1760337281f, 210.2468630977f, 210.3176822423f, - 210.3884911686f, 210.4592898827f, 210.5300783911f, 210.6008567002f, - 210.6716248163f, 210.7423827458f, 210.8131304950f, 210.8838680703f, - 210.9545954780f, 211.0253127245f, 211.0960198160f, 211.1667167589f, - 211.2374035595f, 211.3080802241f, 211.3787467590f, 211.4494031705f, - 211.5200494648f, 211.5906856483f, 211.6613117272f, 211.7319277077f, - 211.8025335962f, 211.8731293988f, 211.9437151218f, 212.0142907715f, - 212.0848563540f, 212.1554118756f, 212.2259573425f, 212.2964927609f, - 212.3670181371f, 212.4375334771f, 212.5080387872f, 212.5785340735f, - 212.6490193423f, 212.7194945997f, 212.7899598518f, 212.8604151049f, - 212.9308603650f, 213.0012956383f, 213.0717209309f, 213.1421362490f, - 213.2125415986f, 213.2829369860f, 213.3533224171f, 213.4236978981f, - 213.4940634351f, 213.5644190342f, 213.6347647014f, 213.7051004428f, - 213.7754262645f, 213.8457421725f, 213.9160481730f, 213.9863442719f, - 214.0566304753f, 214.1269067892f, 214.1971732196f, 214.2674297726f, - 214.3376764542f, 214.4079132703f, 214.4781402271f, 214.5483573304f, - 214.6185645863f, 214.6887620007f, 214.7589495797f, 214.8291273292f, - 214.8992952551f, 214.9694533635f, 215.0396016602f, 215.1097401512f, - 215.1798688424f, 215.2499877399f, 215.3200968494f, 215.3901961769f, - 215.4602857284f, 215.5303655097f, 215.6004355267f, 215.6704957854f, - 215.7405462915f, 215.8105870511f, 215.8806180699f, 215.9506393539f, - 216.0206509088f, 216.0906527406f, 216.1606448551f, 216.2306272581f, - 216.3005999555f, 216.3705629531f, 216.4405162568f, 216.5104598722f, - 216.5803938054f, 216.6503180620f, 216.7202326479f, 216.7901375688f, - 216.8600328306f, 216.9299184390f, 216.9997943998f, 217.0696607187f, - 217.1395174016f, 217.2093644542f, 217.2792018822f, 217.3490296914f, - 217.4188478875f, 217.4886564763f, 217.5584554635f, 217.6282448547f, - 217.6980246558f, 217.7677948724f, 217.8375555102f, 217.9073065749f, - 217.9770480722f, 218.0467800078f, 218.1165023874f, 218.1862152167f, - 218.2559185012f, 218.3256122467f, 218.3952964589f, 218.4649711433f, - 218.5346363056f, 218.6042919515f, 218.6739380866f, 218.7435747164f, - 218.8132018467f, 218.8828194830f, 218.9524276310f, 219.0220262962f, - 219.0916154843f, 219.1611952008f, 219.2307654513f, 219.3003262414f, - 219.3698775767f, 219.4394194627f, 219.5089519050f, 219.5784749091f, - 219.6479884807f, 219.7174926251f, 219.7869873481f, 219.8564726551f, - 219.9259485516f, 219.9954150431f, 220.0648721352f, 220.1343198334f, - 220.2037581432f, 220.2731870701f, 220.3426066195f, 220.4120167970f, - 220.4814176080f, 220.5508090580f, 220.6201911525f, 220.6895638970f, - 220.7589272968f, 220.8282813576f, 220.8976260846f, 220.9669614833f, - 221.0362875592f, 221.1056043178f, 221.1749117643f, 221.2442099043f, - 221.3134987432f, 221.3827782863f, 221.4520485391f, 221.5213095070f, - 221.5905611953f, 221.6598036095f, 221.7290367548f, 221.7982606368f, - 221.8674752608f, 221.9366806320f, 222.0058767560f, 222.0750636380f, - 222.1442412833f, 222.2134096974f, 222.2825688856f, 222.3517188531f, - 222.4208596054f, 222.4899911477f, 222.5591134853f, 222.6282266236f, - 222.6973305678f, 222.7664253233f, 222.8355108954f, 222.9045872893f, - 222.9736545103f, 223.0427125637f, 223.1117614548f, 223.1808011888f, - 223.2498317709f, 223.3188532066f, 223.3878655009f, 223.4568686591f, - 223.5258626866f, 223.5948475884f, 223.6638233699f, 223.7327900362f, - 223.8017475926f, 223.8706960443f, 223.9396353966f, 224.0085656545f, - 224.0774868232f, 224.1463989081f, 224.2153019143f, 224.2841958469f, - 224.3530807111f, 224.4219565121f, 224.4908232551f, 224.5596809453f, - 224.6285295876f, 224.6973691875f, 224.7661997499f, 224.8350212800f, - 224.9038337829f, 224.9726372638f, 225.0414317278f, 225.1102171801f, - 225.1789936256f, 225.2477610696f, 225.3165195172f, 225.3852689733f, - 225.4540094432f, 225.5227409319f, 225.5914634446f, 225.6601769862f, - 225.7288815618f, 225.7975771766f, 225.8662638355f, 225.9349415437f, - 226.0036103062f, 226.0722701280f, 226.1409210142f, 226.2095629698f, - 226.2781959998f, 226.3468201094f, 226.4154353034f, 226.4840415869f, - 226.5526389650f, 226.6212274426f, 226.6898070247f, 226.7583777164f, - 226.8269395226f, 226.8954924483f, 226.9640364985f, 227.0325716781f, - 227.1010979922f, 227.1696154458f, 227.2381240437f, 227.3066237909f, - 227.3751146924f, 227.4435967531f, 227.5120699781f, 227.5805343721f, - 227.6489899402f, 227.7174366872f, 227.7858746182f, 227.8543037379f, - 227.9227240514f, 227.9911355636f, 228.0595382792f, 228.1279322034f, - 228.1963173408f, 228.2646936965f, 228.3330612753f, 228.4014200821f, - 228.4697701217f, 228.5381113991f, 228.6064439191f, 228.6747676865f, - 228.7430827063f, 228.8113889832f, 228.8796865222f, 228.9479753280f, - 229.0162554055f, 229.0845267595f, 229.1527893949f, 229.2210433164f, - 229.2892885290f, 229.3575250374f, 229.4257528463f, 229.4939719607f, - 229.5621823854f, 229.6303841250f, 229.6985771844f, 229.7667615685f, - 229.8349372819f, 229.9031043294f, 229.9712627159f, 230.0394124460f, - 230.1075535246f, 230.1756859564f, 230.2438097462f, 230.3119248986f, - 230.3800314185f, 230.4481293106f, 230.5162185796f, 230.5842992303f, - 230.6523712673f, 230.7204346955f, 230.7884895194f, 230.8565357439f, - 230.9245733736f, 230.9926024132f, 231.0606228675f, 231.1286347411f, - 231.1966380387f, 231.2646327650f, 231.3326189246f, 231.4005965223f, - 231.4685655628f, 231.5365260506f, 231.6044779905f, 231.6724213871f, - 231.7403562450f, 231.8082825689f, 231.8762003635f, 231.9441096334f, - 232.0120103832f, 232.0799026176f, 232.1477863411f, 232.2156615585f, - 232.2835282742f, 232.3513864930f, 232.4192362194f, 232.4870774581f, - 232.5549102136f, 232.6227344905f, 232.6905502935f, 232.7583576271f, - 232.8261564958f, 232.8939469044f, 232.9617288573f, 233.0295023590f, - 233.0972674143f, 233.1650240276f, 233.2327722035f, 233.3005119466f, - 233.3682432613f, 233.4359661522f, 233.5036806240f, 233.5713866810f, - 233.6390843278f, 233.7067735691f, 233.7744544092f, 233.8421268526f, - 233.9097909040f, 233.9774465678f, 234.0450938486f, 234.1127327507f, - 234.1803632788f, 234.2479854372f, 234.3155992306f, 234.3832046633f, - 234.4508017399f, 234.5183904648f, 234.5859708424f, 234.6535428774f, - 234.7211065740f, 234.7886619369f, 234.8562089704f, 234.9237476789f, - 234.9912780670f, 235.0588001390f, 235.1263138994f, 235.1938193527f, - 235.2613165032f, 235.3288053554f, 235.3962859137f, 235.4637581825f, - 235.5312221662f, 235.5986778693f, 235.6661252961f, 235.7335644510f, - 235.8009953384f, 235.8684179628f, 235.9358323285f, 236.0032384398f, - 236.0706363013f, 236.1380259171f, 236.2054072918f, 236.2727804296f, - 236.3401453350f, 236.4075020122f, 236.4748504657f, 236.5421906998f, - 236.6095227189f, 236.6768465272f, 236.7441621291f, 236.8114695290f, - 236.8787687311f, 236.9460597399f, 237.0133425596f, 237.0806171945f, - 237.1478836489f, 237.2151419273f, 237.2823920338f, 237.3496339727f, - 237.4168677485f, 237.4840933652f, 237.5513108274f, 237.6185201391f, - 237.6857213048f, 237.7529143286f, 237.8200992150f, 237.8872759680f, - 237.9544445920f, 238.0216050913f, 238.0887574701f, 238.1559017327f, - 238.2230378833f, 238.2901659261f, 238.3572858654f, 238.4243977055f, - 238.4915014506f, 238.5585971048f, 238.6256846725f, 238.6927641578f, - 238.7598355650f, 238.8268988982f, 238.8939541618f, 238.9610013598f, - 239.0280404966f, 239.0950715762f, 239.1620946029f, 239.2291095809f, - 239.2961165144f, 239.3631154076f, 239.4301062645f, 239.4970890895f, - 239.5640638866f, 239.6310306601f, 239.6979894141f, 239.7649401527f, - 239.8318828802f, 239.8988176006f, 239.9657443182f, 240.0326630371f, - 240.0995737613f, 240.1664764951f, 240.2333712426f, 240.3002580079f, - 240.3671367951f, 240.4340076084f, 240.5008704518f, 240.5677253296f, - 240.6345722457f, 240.7014112044f, 240.7682422096f, 240.8350652656f, - 240.9018803764f, 240.9686875461f, 241.0354867787f, 241.1022780785f, - 241.1690614494f, 241.2358368955f, 241.3026044209f, 241.3693640297f, - 241.4361157259f, 241.5028595136f, 241.5695953969f, 241.6363233798f, - 241.7030434663f, 241.7697556606f, 241.8364599666f, 241.9031563884f, - 241.9698449301f, 242.0365255956f, 242.1031983890f, 242.1698633144f, - 242.2365203756f, 242.3031695769f, 242.3698109221f, 242.4364444153f, - 242.5030700605f, 242.5696878617f, 242.6362978229f, 242.7028999480f, - 242.7694942412f, 242.8360807064f, 242.9026593475f, 242.9692301685f, - 243.0357931735f, 243.1023483664f, 243.1688957511f, 243.2354353317f, - 243.3019671121f, 243.3684910963f, 243.4350072882f, 243.5015156917f, - 243.5680163109f, 243.6345091496f, 243.7009942119f, 243.7674715016f, - 243.8339410227f, 243.9004027791f, 243.9668567748f, 244.0333030137f, - 244.0997414996f, 244.1661722366f, 244.2325952285f, 244.2990104792f, - 244.3654179927f, 244.4318177729f, 244.4982098236f, 244.5645941488f, - 244.6309707523f, 244.6973396380f, 244.7637008099f, 244.8300542718f, - 244.8964000276f, 244.9627380811f, 245.0290684363f, 245.0953910970f, - 245.1617060671f, 245.2280133504f, 245.2943129508f, 245.3606048721f, - 245.4268891183f, 245.4931656931f, 245.5594346004f, 245.6256958441f, - 245.6919494279f, 245.7581953558f, 245.8244336315f, 245.8906642589f, - 245.9568872418f, 246.0231025841f, 246.0893102895f, 246.1555103618f, - 246.2217028049f, 246.2878876226f, 246.3540648187f, 246.4202343969f, - 246.4863963612f, 246.5525507152f, 246.6186974628f, 246.6848366078f, - 246.7509681539f, 246.8170921050f, 246.8832084648f, 246.9493172370f, - 247.0154184255f, 247.0815120340f, 247.1475980663f, 247.2136765262f, - 247.2797474173f, 247.3458107436f, 247.4118665086f, 247.4779147162f, - 247.5439553701f, 247.6099884741f, 247.6760140319f, 247.7420320472f, - 247.8080425237f, 247.8740454652f, 247.9400408755f, 248.0060287582f, - 248.0720091170f, 248.1379819557f, 248.2039472780f, 248.2699050876f, - 248.3358553882f, 248.4017981834f, 248.4677334771f, 248.5336612729f, - 248.5995815745f, 248.6654943855f, 248.7313997098f, 248.7972975509f, - 248.8631879125f, 248.9290707983f, 248.9949462120f, 249.0608141573f, - 249.1266746377f, 249.1925276571f, 249.2583732190f, 249.3242113272f, - 249.3900419852f, 249.4558651967f, 249.5216809654f, 249.5874892948f, - 249.6532901888f, 249.7190836508f, 249.7848696845f, 249.8506482936f, - 249.9164194817f, 249.9821832524f, 250.0479396094f, 250.1136885562f, - 250.1794300964f, 250.2451642338f, 250.3108909719f, 250.3766103143f, - 250.4423222646f, 250.5080268264f, 250.5737240033f, 250.6394137989f, - 250.7050962168f, 250.7707712607f, 250.8364389340f, 250.9020992403f, - 250.9677521833f, 251.0333977665f, 251.0990359936f, 251.1646668679f, - 251.2302903932f, 251.2959065730f, 251.3615154109f, 251.4271169103f, - 251.4927110750f, 251.5582979083f, 251.6238774139f, 251.6894495954f, - 251.7550144562f, 251.8205719999f, 251.8861222300f, 251.9516651502f, - 252.0172007638f, 252.0827290744f, 252.1482500856f, 252.2137638009f, - 252.2792702238f, 252.3447693578f, 252.4102612065f, 252.4757457732f, - 252.5412230616f, 252.6066930752f, 252.6721558174f, 252.7376112918f, - 252.8030595018f, 252.8685004509f, 252.9339341427f, 252.9993605806f, - 253.0647797681f, 253.1301917086f, 253.1955964058f, 253.2609938629f, - 253.3263840835f, 253.3917670711f, 253.4571428292f, 253.5225113611f, - 253.5878726704f, 253.6532267605f, 253.7185736349f, 253.7839132970f, - 253.8492457503f, 253.9145709981f, 253.9798890441f, 254.0451998915f, - 254.1105035438f, 254.1758000045f, 254.2410892771f, 254.3063713648f, - 254.3716462712f, 254.4369139996f, 254.5021745535f, 254.5674279364f, - 254.6326741515f, 254.6979132024f, 254.7631450925f, 254.8283698250f, - 254.8935874035f, 254.9587978314f, 255.0240011120f, 255.0891972487f, - 255.1543862449f, 255.2195681041f, 255.2847428295f, 255.3499104246f, - 255.4150708928f, 255.4802242374f, 255.5453704618f, 255.6105095694f, - 255.6756415635f, 255.7407664475f, 255.8058842248f, 255.8709948988f, - 255.9360984727f, 256.0011949500f, 256.0662843339f, 256.1313666279f, - 256.1964418353f, 256.2615099594f, 256.3265710035f, 256.3916249711f, - 256.4566718654f, 256.5217116898f, 256.5867444476f, 256.6517701421f, - 256.7167887766f, 256.7818003546f, 256.8468048792f, 256.9118023538f, - 256.9767927817f, 257.0417761662f, 257.1067525107f, 257.1717218184f, - 257.2366840926f, 257.3016393367f, 257.3665875539f, 257.4315287475f, - 257.4964629208f, 257.5613900771f, 257.6263102197f, 257.6912233518f, - 257.7561294768f, 257.8210285980f, 257.8859207185f, 257.9508058417f, - 258.0156839708f, 258.0805551091f, 258.1454192599f, 258.2102764264f, - 258.2751266118f, 258.3399698195f, 258.4048060527f, 258.4696353147f, - 258.5344576086f, 258.5992729377f, 258.6640813053f, 258.7288827147f, - 258.7936771689f, 258.8584646714f, 258.9232452252f, 258.9880188337f, - 259.0527855001f, 259.1175452275f, 259.1822980193f, 259.2470438785f, - 259.3117828085f, 259.3765148125f, 259.4412398936f, 259.5059580551f, - 259.5706693002f, 259.6353736320f, 259.7000710538f, 259.7647615688f, - 259.8294451802f, 259.8941218911f, 259.9587917047f, 260.0234546243f, - 260.0881106530f, 260.1527597940f, 260.2174020504f, 260.2820374255f, - 260.3466659225f, 260.4112875444f, 260.4759022945f, 260.5405101759f, - 260.6051111918f, 260.6697053454f, 260.7342926397f, 260.7988730781f, - 260.8634466635f, 260.9280133992f, 260.9925732883f, 261.0571263340f, - 261.1216725394f, 261.1862119076f, 261.2507444418f, 261.3152701451f, - 261.3797890207f, 261.4443010716f, 261.5088063010f, 261.5733047121f, - 261.6377963079f, 261.7022810916f, 261.7667590662f, 261.8312302350f, - 261.8956946009f, 261.9601521672f, 262.0246029369f, 262.0890469132f, - 262.1534840990f, 262.2179144977f, 262.2823381121f, 262.3467549455f, - 262.4111650008f, 262.4755682813f, 262.5399647900f, 262.6043545299f, - 262.6687375042f, 262.7331137160f, 262.7974831682f, 262.8618458641f, - 262.9262018066f, 262.9905509988f, 263.0548934439f, 263.1192291448f, - 263.1835581046f, 263.2478803264f, 263.3121958132f, 263.3765045682f, - 263.4408065943f, 263.5051018946f, 263.5693904721f, 263.6336723299f, - 263.6979474711f, 263.7622158986f, 263.8264776156f, 263.8907326250f, - 263.9549809298f, 264.0192225332f, 264.0834574381f, 264.1476856476f, - 264.2119071647f, 264.2761219924f, 264.3403301337f, 264.4045315916f, - 264.4687263692f, 264.5329144695f, 264.5970958954f, 264.6612706500f, - 264.7254387363f, 264.7896001573f, 264.8537549160f, 264.9179030153f, - 264.9820444583f, 265.0461792480f, 265.1103073874f, 265.1744288794f, - 265.2385437270f, 265.3026519333f, 265.3667535011f, 265.4308484335f, - 265.4949367335f, 265.5590184039f, 265.6230934479f, 265.6871618683f, - 265.7512236682f, 265.8152788504f, 265.8793274180f, 265.9433693738f, - 266.0074047210f, 266.0714334624f, 266.1354556009f, 266.1994711396f, - 266.2634800813f, 266.3274824290f, 266.3914781857f, 266.4554673543f, - 266.5194499377f, 266.5834259389f, 266.6473953608f, 266.7113582063f, - 266.7753144784f, 266.8392641799f, 266.9032073139f, 266.9671438832f, - 267.0310738908f, 267.0949973395f, 267.1589142323f, 267.2228245722f, - 267.2867283619f, 267.3506256044f, 267.4145163027f, 267.4784004596f, - 267.5422780780f, 267.6061491608f, 267.6700137110f, 267.7338717314f, - 267.7977232248f, 267.8615681943f, 267.9254066427f, 267.9892385728f, - 268.0530639876f, 268.1168828899f, 268.1806952827f, 268.2445011687f, - 268.3083005509f, 268.3720934321f, 268.4358798153f, 268.4996597032f, - 268.5634330987f, 268.6272000048f, 268.6909604242f, 268.7547143598f, - 268.8184618145f, 268.8822027911f, 268.9459372925f, 269.0096653216f, - 269.0733868811f, 269.1371019739f, 269.2008106029f, 269.2645127709f, - 269.3282084808f, 269.3918977353f, 269.4555805374f, 269.5192568898f, - 269.5829267953f, 269.6465902569f, 269.7102472773f, 269.7738978594f, - 269.8375420059f, 269.9011797197f, 269.9648110037f, 270.0284358605f, - 270.0920542931f, 270.1556663042f, 270.2192718967f, 270.2828710734f, - 270.3464638370f, 270.4100501903f, 270.4736301362f, 270.5372036775f, - 270.6007708170f, 270.6643315573f, 270.7278859015f, 270.7914338521f, - 270.8549754120f, 270.9185105841f, 270.9820393710f, 271.0455617756f, - 271.1090778006f, 271.1725874488f, 271.2360907230f, 271.2995876260f, - 271.3630781605f, 271.4265623292f, 271.4900401350f, 271.5535115807f, - 271.6169766689f, 271.6804354025f, 271.7438877841f, 271.8073338166f, - 271.8707735027f, 271.9342068451f, 271.9976338467f, 272.0610545100f, - 272.1244688380f, 272.1878768333f, 272.2512784986f, 272.3146738368f, - 272.3780628505f, 272.4414455425f, 272.5048219154f, 272.5681919722f, - 272.6315557153f, 272.6949131477f, 272.7582642719f, 272.8216090908f, - 272.8849476071f, 272.9482798233f, 273.0116057424f, 273.0749253670f, - 273.1382386998f, 273.2015457434f, 273.2648465007f, 273.3281409743f, - 273.3914291669f, 273.4547110813f, 273.5179867201f, 273.5812560859f, - 273.6445191816f, 273.7077760098f, 273.7710265732f, 273.8342708744f, - 273.8975089163f, 273.9607407013f, 274.0239662323f, 274.0871855119f, - 274.1503985428f, 274.2136053277f, 274.2768058692f, 274.3400001700f, - 274.4031882327f, 274.4663700601f, 274.5295456549f, 274.5927150196f, - 274.6558781569f, 274.7190350695f, 274.7821857601f, 274.8453302313f, - 274.9084684857f, 274.9716005261f, 275.0347263550f, 275.0978459751f, - 275.1609593890f, 275.2240665995f, 275.2871676091f, 275.3502624205f, - 275.4133510363f, 275.4764334591f, 275.5395096916f, 275.6025797365f, - 275.6656435963f, 275.7287012736f, 275.7917527712f, 275.8547980916f, - 275.9178372374f, 275.9808702112f, 276.0438970158f, 276.1069176537f, - 276.1699321274f, 276.2329404397f, 276.2959425931f, 276.3589385903f, - 276.4219284338f, 276.4849121262f, 276.5478896702f, 276.6108610683f, - 276.6738263232f, 276.7367854375f, 276.7997384136f, 276.8626852544f, - 276.9256259622f, 276.9885605397f, 277.0514889896f, 277.1144113143f, - 277.1773275165f, 277.2402375987f, 277.3031415635f, 277.3660394136f, - 277.4289311514f, 277.4918167796f, 277.5546963007f, 277.6175697172f, - 277.6804370319f, 277.7432982471f, 277.8061533656f, 277.8690023898f, - 277.9318453223f, 277.9946821656f, 278.0575129224f, 278.1203375951f, - 278.1831561864f, 278.2459686988f, 278.3087751347f, 278.3715754969f, - 278.4343697877f, 278.4971580098f, 278.5599401658f, 278.6227162580f, - 278.6854862891f, 278.7482502617f, 278.8110081781f, 278.8737600411f, - 278.9365058530f, 278.9992456165f, 279.0619793341f, 279.1247070082f, - 279.1874286414f, 279.2501442362f, 279.3128537952f, 279.3755573209f, - 279.4382548157f, 279.5009462822f, 279.5636317229f, 279.6263111403f, - 279.6889845369f, 279.7516519152f, 279.8143132778f, 279.8769686270f, - 279.9396179655f, 280.0022612957f, 280.0648986201f, 280.1275299413f, - 280.1901552616f, 280.2527745837f, 280.3153879099f, 280.3779952428f, - 280.4405965848f, 280.5031919385f, 280.5657813063f, 280.6283646906f, - 280.6909420941f, 280.7535135191f, 280.8160789682f, 280.8786384437f, - 280.9411919483f, 281.0037394842f, 281.0662810541f, 281.1288166603f, - 281.1913463054f, 281.2538699917f, 281.3163877219f, 281.3788994982f, - 281.4414053232f, 281.5039051993f, 281.5663991290f, 281.6288871148f, - 281.6913691590f, 281.7538452641f, 281.8163154326f, 281.8787796669f, - 281.9412379695f, 282.0036903428f, 282.0661367892f, 282.1285773111f, - 282.1910119111f, 282.2534405915f, 282.3158633548f, 282.3782802034f, - 282.4406911397f, 282.5030961662f, 282.5654952852f, 282.6278884993f, - 282.6902758108f, 282.7526572221f, 282.8150327356f, 282.8774023539f, - 282.9397660792f, 283.0021239140f, 283.0644758607f, 283.1268219218f, - 283.1891620995f, 283.2514963964f, 283.3138248149f, 283.3761473572f, - 283.4384640259f, 283.5007748233f, 283.5630797519f, 283.6253788140f, - 283.6876720120f, 283.7499593482f, 283.8122408252f, 283.8745164453f, - 283.9367862109f, 283.9990501242f, 284.0613081879f, 284.1235604041f, - 284.1858067754f, 284.2480473040f, 284.3102819924f, 284.3725108428f, - 284.4347338578f, 284.4969510397f, 284.5591623908f, 284.6213679134f, - 284.6835676101f, 284.7457614831f, 284.8079495348f, 284.8701317675f, - 284.9323081836f, 284.9944787855f, 285.0566435756f, 285.1188025561f, - 285.1809557294f, 285.2431030980f, 285.3052446640f, 285.3673804299f, - 285.4295103981f, 285.4916345708f, 285.5537529504f, 285.6158655393f, - 285.6779723397f, 285.7400733541f, 285.8021685847f, 285.8642580340f, - 285.9263417041f, 285.9884195975f, 286.0504917165f, 286.1125580633f, - 286.1746186405f, 286.2366734501f, 286.2987224947f, 286.3607657764f, - 286.4228032977f, 286.4848350608f, 286.5468610680f, 286.6088813217f, - 286.6708958242f, 286.7329045778f, 286.7949075847f, 286.8569048474f, - 286.9188963681f, 286.9808821491f, 287.0428621927f, 287.1048365012f, - 287.1668050769f, 287.2287679221f, 287.2907250391f, 287.3526764303f, - 287.4146220978f, 287.4765620440f, 287.5384962711f, 287.6004247816f, - 287.6623475775f, 287.7242646613f, 287.7861760353f, 287.8480817016f, - 287.9099816625f, 287.9718759205f, 288.0337644776f, 288.0956473363f, - 288.1575244987f, 288.2193959672f, 288.2812617439f, 288.3431218313f, - 288.4049762315f, 288.4668249468f, 288.5286679795f, 288.5905053319f, - 288.6523370061f, 288.7141630045f, 288.7759833294f, 288.8377979828f, - 288.8996069673f, 288.9614102848f, 289.0232079379f, 289.0849999286f, - 289.1467862592f, 289.2085669320f, 289.2703419492f, 289.3321113130f, - 289.3938750258f, 289.4556330897f, 289.5173855070f, 289.5791322798f, - 289.6408734106f, 289.7026089014f, 289.7643387545f, 289.8260629722f, - 289.8877815566f, 289.9494945101f, 290.0112018347f, 290.0729035328f, - 290.1345996066f, 290.1962900583f, 290.2579748901f, 290.3196541042f, - 290.3813277029f, 290.4429956883f, 290.5046580627f, 290.5663148283f, - 290.6279659873f, 290.6896115419f, 290.7512514942f, 290.8128858467f, - 290.8745146013f, 290.9361377603f, 290.9977553260f, 291.0593673005f, - 291.1209736860f, 291.1825744848f, 291.2441696989f, 291.3057593307f, - 291.3673433822f, 291.4289218558f, 291.4904947535f, 291.5520620776f, - 291.6136238302f, 291.6751800135f, 291.7367306298f, 291.7982756812f, - 291.8598151698f, 291.9213490979f, 291.9828774677f, 292.0444002812f, - 292.1059175407f, 292.1674292484f, 292.2289354064f, 292.2904360168f, - 292.3519310820f, 292.4134206039f, 292.4749045849f, 292.5363830270f, - 292.5978559324f, 292.6593233033f, 292.7207851418f, 292.7822414501f, - 292.8436922304f, 292.9051374847f, 292.9665772153f, 293.0280114244f, - 293.0894401139f, 293.1508632862f, 293.2122809433f, 293.2736930874f, - 293.3350997206f, 293.3965008451f, 293.4578964631f, 293.5192865766f, - 293.5806711878f, 293.6420502988f, 293.7034239118f, 293.7647920289f, - 293.8261546522f, 293.8875117839f, 293.9488634261f, 294.0102095809f, - 294.0715502505f, 294.1328854369f, 294.1942151423f, 294.2555393688f, - 294.3168581186f, 294.3781713938f, 294.4394791964f, 294.5007815286f, - 294.5620783925f, 294.6233697902f, 294.6846557238f, 294.7459361955f, - 294.8072112073f, 294.8684807614f, 294.9297448599f, 294.9910035048f, - 295.0522566982f, 295.1135044424f, 295.1747467393f, 295.2359835911f, - 295.2972149999f, 295.3584409677f, 295.4196614966f, 295.4808765889f, - 295.5420862464f, 295.6032904714f, 295.6644892659f, 295.7256826321f, - 295.7868705719f, 295.8480530875f, 295.9092301809f, 295.9704018543f, - 296.0315681097f, 296.0927289493f, 296.1538843749f, 296.2150343889f, - 296.2761789932f, 296.3373181899f, 296.3984519810f, 296.4595803687f, - 296.5207033550f, 296.5818209420f, 296.6429331318f, 296.7040399264f, - 296.7651413278f, 296.8262373382f, 296.8873279595f, 296.9484131940f, - 297.0094930435f, 297.0705675102f, 297.1316365962f, 297.1927003034f, - 297.2537586339f, 297.3148115899f, 297.3758591732f, 297.4369013861f, - 297.4979382305f, 297.5589697084f, 297.6199958220f, 297.6810165732f, - 297.7420319642f, 297.8030419968f, 297.8640466733f, 297.9250459955f, - 297.9860399657f, 298.0470285857f, 298.1080118576f, 298.1689897835f, - 298.2299623653f, 298.2909296052f, 298.3518915051f, 298.4128480670f, - 298.4737992931f, 298.5347451853f, 298.5956857456f, 298.6566209760f, - 298.7175508787f, 298.7784754555f, 298.8393947085f, 298.9003086398f, - 298.9612172513f, 299.0221205450f, 299.0830185230f, 299.1439111873f, - 299.2047985399f, 299.2656805827f, 299.3265573178f, 299.3874287473f, - 299.4482948730f, 299.5091556971f, 299.5700112214f, 299.6308614481f, - 299.6917063790f, 299.7525460163f, 299.8133803618f, 299.8742094177f, - 299.9350331858f, 299.9958516682f, 300.0566648668f, 300.1174727837f, - 300.1782754208f, 300.2390727802f, 300.2998648637f, 300.3606516735f, - 300.4214332114f, 300.4822094795f, 300.5429804797f, 300.6037462140f, - 300.6645066844f, 300.7252618928f, 300.7860118413f, 300.8467565318f, - 300.9074959663f, 300.9682301468f, 301.0289590751f, 301.0896827534f, - 301.1504011835f, 301.2111143674f, 301.2718223071f, 301.3325250046f, - 301.3932224617f, 301.4539146805f, 301.5146016630f, 301.5752834110f, - 301.6359599265f, 301.6966312116f, 301.7572972681f, 301.8179580980f, - 301.8786137032f, 301.9392640857f, 301.9999092475f, 302.0605491905f, - 302.1211839166f, 302.1818134278f, 302.2424377260f, 302.3030568132f, - 302.3636706913f, 302.4242793622f, 302.4848828279f, 302.5454810904f, - 302.6060741514f, 302.6666620131f, 302.7272446773f, 302.7878221460f, - 302.8483944210f, 302.9089615044f, 302.9695233980f, 303.0300801037f, - 303.0906316236f, 303.1511779595f, 303.2117191133f, 303.2722550870f, - 303.3327858824f, 303.3933115016f, 303.4538319463f, 303.5143472186f, - 303.5748573204f, 303.6353622535f, 303.6958620199f, 303.7563566215f, - 303.8168460601f, 303.8773303378f, 303.9378094564f, 303.9982834178f, - 304.0587522239f, 304.1192158767f, 304.1796743780f, 304.2401277297f, - 304.3005759338f, 304.3610189920f, 304.4214569065f, 304.4818896789f, - 304.5423173113f, 304.6027398054f, 304.6631571633f, 304.7235693868f, - 304.7839764778f, 304.8443784381f, 304.9047752697f, 304.9651669745f, - 305.0255535543f, 305.0859350110f, 305.1463113465f, 305.2066825627f, - 305.2670486615f, 305.3274096447f, 305.3877655143f, 305.4481162720f, - 305.5084619199f, 305.5688024596f, 305.6291378932f, 305.6894682225f, - 305.7497934494f, 305.8101135757f, 305.8704286033f, 305.9307385341f, - 305.9910433699f, 306.0513431126f, 306.1116377640f, 306.1719273261f, - 306.2322118007f, 306.2924911897f, 306.3527654948f, 306.4130347180f, - 306.4732988611f, 306.5335579260f, 306.5938119145f, 306.6540608286f, - 306.7143046699f, 306.7745434404f, 306.8347771420f, 306.8950057764f, - 306.9552293456f, 307.0154478513f, 307.0756612955f, 307.1358696799f, - 307.1960730064f, 307.2562712768f, 307.3164644931f, 307.3766526569f, - 307.4368357702f, 307.4970138348f, 307.5571868526f, 307.6173548253f, - 307.6775177547f, 307.7376756429f, 307.7978284914f, 307.8579763023f, - 307.9181190772f, 307.9782568181f, 308.0383895268f, 308.0985172050f, - 308.1586398547f, 308.2187574776f, 308.2788700755f, 308.3389776504f, - 308.3990802039f, 308.4591777379f, 308.5192702542f, 308.5793577547f, - 308.6394402412f, 308.6995177154f, 308.7595901791f, 308.8196576343f, - 308.8797200827f, 308.9397775260f, 308.9998299662f, 309.0598774050f, - 309.1199198442f, 309.1799572857f, 309.2399897311f, 309.3000171824f, - 309.3600396414f, 309.4200571097f, 309.4800695893f, 309.5400770819f, - 309.6000795893f, 309.6600771133f, 309.7200696557f, 309.7800572184f, - 309.8400398030f, 309.9000174114f, 309.9599900453f, 310.0199577066f, - 310.0799203970f, 310.1398781184f, 310.1998308724f, 310.2597786610f, - 310.3197214858f, 310.3796593487f, 310.4395922514f, 310.4995201957f, - 310.5594431834f, 310.6193612162f, 310.6792742960f, 310.7391824245f, - 310.7990856035f, 310.8589838348f, 310.9188771200f, 310.9787654611f, - 311.0386488597f, 311.0985273177f, 311.1584008367f, 311.2182694186f, - 311.2781330651f, 311.3379917781f, 311.3978455591f, 311.4576944101f, - 311.5175383327f, 311.5773773288f, 311.6372114000f, 311.6970405482f, - 311.7568647751f, 311.8166840824f, 311.8764984719f, 311.9363079454f, - 311.9961125046f, 312.0559121512f, 312.1157068870f, 312.1754967138f, - 312.2352816333f, 312.2950616472f, 312.3548367573f, 312.4146069653f, - 312.4743722729f, 312.5341326820f, 312.5938881942f, 312.6536388113f, - 312.7133845350f, 312.7731253671f, 312.8328613093f, 312.8925923633f, - 312.9523185308f, 313.0120398136f, 313.0717562135f, 313.1314677321f, - 313.1911743712f, 313.2508761325f, 313.3105730177f, 313.3702650286f, - 313.4299521669f, 313.4896344342f, 313.5493118324f, 313.6089843632f, - 313.6686520282f, 313.7283148292f, 313.7879727679f, 313.8476258460f, - 313.9072740652f, 313.9669174274f, 314.0265559340f, 314.0861895870f, - 314.1458183879f, 314.2054423385f, 314.2650614406f, 314.3246756957f, - 314.3842851057f, 314.4438896722f, 314.5034893970f, 314.5630842817f, - 314.6226743280f, 314.6822595376f, 314.7418399123f, 314.8014154538f, - 314.8609861637f, 314.9205520437f, 314.9801130956f, 315.0396693210f, - 315.0992207216f, 315.1587672991f, 315.2183090552f, 315.2778459917f, - 315.3373781101f, 315.3969054122f, 315.4564278997f, 315.5159455743f, - 315.5754584375f, 315.6349664912f, 315.6944697371f, 315.7539681767f, - 315.8134618118f, 315.8729506440f, 315.9324346751f, 315.9919139067f, - 316.0513883404f, 316.1108579781f, 316.1703228213f, 316.2297828717f, - 316.2892381310f, 316.3486886009f, 316.4081342830f, 316.4675751790f, - 316.5270112905f, 316.5864426194f, 316.6458691671f, 316.7052909354f, - 316.7647079260f, 316.8241201404f, 316.8835275805f, 316.9429302477f, - 317.0023281439f, 317.0617212706f, 317.1211096295f, 317.1804932223f, - 317.2398720506f, 317.2992461161f, 317.3586154205f, 317.4179799653f, - 317.4773397523f, 317.5366947831f, 317.5960450593f, 317.6553905826f, - 317.7147313547f, 317.7740673771f, 317.8333986516f, 317.8927251798f, - 317.9520469634f, 318.0113640039f, 318.0706763030f, 318.1299838624f, - 318.1892866837f, 318.2485847685f, 318.3078781185f, 318.3671667353f, - 318.4264506206f, 318.4857297760f, 318.5450042031f, 318.6042739035f, - 318.6635388790f, 318.7227991311f, 318.7820546614f, 318.8413054716f, - 318.9005515634f, 318.9597929382f, 319.0190295979f, 319.0782615439f, - 319.1374887780f, 319.1967113017f, 319.2559291167f, 319.3151422245f, - 319.3743506269f, 319.4335543254f, 319.4927533216f, 319.5519476172f, - 319.6111372138f, 319.6703221130f, 319.7295023164f, 319.7886778257f, - 319.8478486424f, 319.9070147681f, 319.9661762045f, 320.0253329532f, - 320.0844850157f, 320.1436323938f, 320.2027750889f, 320.2619131028f, - 320.3210464369f, 320.3801750930f, 320.4392990726f, 320.4984183773f, - 320.5575330088f, 320.6166429685f, 320.6757482582f, 320.7348488794f, - 320.7939448337f, 320.8530361228f, 320.9121227481f, 320.9712047114f, - 321.0302820141f, 321.0893546579f, 321.1484226445f, 321.2074859752f, - 321.2665446519f, 321.3255986760f, 321.3846480491f, 321.4436927729f, - 321.5027328489f, 321.5617682787f, 321.6207990638f, 321.6798252060f, - 321.7388467066f, 321.7978635674f, 321.8568757899f, 321.9158833757f, - 321.9748863264f, 322.0338846435f, 322.0928783286f, 322.1518673833f, - 322.2108518092f, 322.2698316078f, 322.3288067807f, 322.3877773296f, - 322.4467432559f, 322.5057045612f, 322.5646612471f, 322.6236133151f, - 322.6825607669f, 322.7415036040f, 322.8004418280f, 322.8593754404f, - 322.9183044427f, 322.9772288367f, 323.0361486237f, 323.0950638054f, - 323.1539743833f, 323.2128803591f, 323.2717817341f, 323.3306785101f, - 323.3895706886f, 323.4484582710f, 323.5073412591f, 323.5662196542f, - 323.6250934580f, 323.6839626721f, 323.7428272979f, 323.8016873371f, - 323.8605427911f, 323.9193936615f, 323.9782399499f, 324.0370816579f, - 324.0959187868f, 324.1547513384f, 324.2135793141f, 324.2724027156f, - 324.3312215442f, 324.3900358016f, 324.4488454893f, 324.5076506089f, - 324.5664511618f, 324.6252471496f, 324.6840385739f, 324.7428254362f, - 324.8016077380f, 324.8603854809f, 324.9191586663f, 324.9779272959f, - 325.0366913711f, 325.0954508935f, 325.1542058646f, 325.2129562859f, - 325.2717021589f, 325.3304434853f, 325.3891802664f, 325.4479125039f, - 325.5066401993f, 325.5653633540f, 325.6240819696f, 325.6827960476f, - 325.7415055896f, 325.8002105970f, 325.8589110714f, 325.9176070142f, - 325.9762984271f, 326.0349853115f, 326.0936676689f, 326.1523455009f, - 326.2110188089f, 326.2696875944f, 326.3283518591f, 326.3870116043f, - 326.4456668317f, 326.5043175426f, 326.5629637386f, 326.6216054213f, - 326.6802425921f, 326.7388752525f, 326.7975034040f, 326.8561270481f, - 326.9147461864f, 326.9733608203f, 327.0319709513f, 327.0905765810f, - 327.1491777108f, 327.2077743422f, 327.2663664767f, 327.3249541158f, - 327.3835372611f, 327.4421159139f, 327.5006900758f, 327.5592597483f, - 327.6178249329f, 327.6763856311f, 327.7349418443f, 327.7934935740f, - 327.8520408218f, 327.9105835891f, 327.9691218774f, 328.0276556882f, - 328.0861850229f, 328.1447098831f, 328.2032302702f, 328.2617461858f, - 328.3202576312f, 328.3787646080f, 328.4372671177f, 328.4957651617f, - 328.5542587415f, 328.6127478585f, 328.6712325144f, 328.7297127105f, - 328.7881884482f, 328.8466597292f, 328.9051265548f, 328.9635889265f, - 329.0220468458f, 329.0805003142f, 329.1389493331f, 329.1973939040f, - 329.2558340283f, 329.3142697076f, 329.3727009433f, 329.4311277368f, - 329.4895500897f, 329.5479680033f, 329.6063814791f, 329.6647905187f, - 329.7231951234f, 329.7815952948f, 329.8399910342f, 329.8983823432f, - 329.9567692231f, 330.0151516755f, 330.0735297018f, 330.1319033035f, - 330.1902724820f, 330.2486372387f, 330.3069975751f, 330.3653534927f, - 330.4237049929f, 330.4820520772f, 330.5403947470f, 330.5987330037f, - 330.6570668488f, 330.7153962838f, 330.7737213101f, 330.8320419291f, - 330.8903581422f, 330.9486699510f, 331.0069773569f, 331.0652803612f, - 331.1235789655f, 331.1818731712f, 331.2401629797f, 331.2984483924f, - 331.3567294109f, 331.4150060364f, 331.4732782705f, 331.5315461146f, - 331.5898095702f, 331.6480686385f, 331.7063233212f, 331.7645736196f, - 331.8228195351f, 331.8810610693f, 331.9392982234f, 331.9975309989f, - 332.0557593973f, 332.1139834200f, 332.1722030684f, 332.2304183439f, - 332.2886292480f, 332.3468357821f, 332.4050379475f, 332.4632357458f, -}; -static float get_visual_mask(float value) { - DCHECK(value >= 0.0f); - DCHECK(value < 4000.0f); - return gVisualMaskTable[(int)value]; -} -} // namespace SkPMetricUtil - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SKPMETRICUTIL_GEN_H_
diff --git a/chrome/browser/chromeos/login/screenshot_testing/golden_screenshots/LoginUITest-LoginUIVisible_golden_screenshot.png.sha1 b/chrome/browser/chromeos/login/screenshot_testing/golden_screenshots/LoginUITest-LoginUIVisible_golden_screenshot.png.sha1 deleted file mode 100644 index 746a32a8..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/golden_screenshots/LoginUITest-LoginUIVisible_golden_screenshot.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -228ac7fe3811df8de0378b355a9e0b62bb894e50 \ No newline at end of file
diff --git a/chrome/browser/chromeos/login/screenshot_testing/login_screen_areas.h b/chrome/browser/chromeos/login/screenshot_testing/login_screen_areas.h deleted file mode 100644 index ad32d7ae..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/login_screen_areas.h +++ /dev/null
@@ -1,27 +0,0 @@ -// Copyright (c) 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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_LOGIN_SCREEN_AREAS_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_LOGIN_SCREEN_AREAS_H_ - -#include "third_party/skia/include/core/SkRect.h" - -namespace chromeos { - -namespace areas { - -// Part of the screen with clock (when there are two digits in hours). -const SkIRect kClockArea = SkIRect::MakeLTRB(1260, 727, 1362 + 1, 758 + 1); - -// First usedrpod, chosen as main, when we've got two users. -const SkIRect kFirstUserpod = SkIRect::MakeLTRB(493, 262, 652 + 1, 421 + 1); - -// Second userpod when we've got two users. -const SkIRect kSecondUserpod = SkIRect::MakeLTRB(721, 271, 864 + 1, 415 + 1); - -} // namespace areas - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_LOGIN_SCREEN_AREAS_H_
diff --git a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc b/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc deleted file mode 100644 index ddeb028..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc +++ /dev/null
@@ -1,349 +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 "chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h" - -#include <stddef.h> -#include <stdint.h> - -#include "ash/shell.h" -#include "base/bind.h" -#include "base/command_line.h" -#include "base/files/file_util.h" -#include "base/run_loop.h" -#include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h" -#include "chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h" -#include "chrome/browser/chromeos/login/screenshot_testing/SkPMetric.h" -#include "chromeos/constants/chromeos_switches.h" -#include "content/public/browser/browser_thread.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "ui/compositor/compositor_switches.h" -#include "ui/gfx/codec/png_codec.h" -#include "ui/gfx/image/image.h" -#include "ui/snapshot/snapshot.h" - -namespace { - -// Sets test mode for screenshot testing, using regular comparison. -const char kTestMode[] = "test"; - -// Sets update mode for screenshot testing. -const char kUpdateMode[] = "update"; - -// Sets test mode for screenshot testing, using PerceptualDiff as comparison. -const char kPdiffTestMode[] = "pdiff-test"; - -} // namespace - -namespace chromeos { - -ScreenshotTester::ScreenshotTester() - : test_mode_(false), pdiff_enabled_(false), weak_factory_(this) {} - -ScreenshotTester::~ScreenshotTester() {} - -ScreenshotTester::Result::Result() {} - -ScreenshotTester::Result::Result(const Result& other) = default; - -ScreenshotTester::Result::~Result() {} - -bool ScreenshotTester::TryInitialize() { - base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - if (!command_line.HasSwitch(switches::kEnableScreenshotTestingWithMode)) - return false; - - std::string mode = command_line.GetSwitchValueASCII( - switches::kEnableScreenshotTestingWithMode); - CHECK(mode == kUpdateMode || mode == kTestMode || mode == kPdiffTestMode) - << "Invalid mode for screenshot testing: " << mode; - - CHECK(command_line.HasSwitch(chromeos::switches::kGoldenScreenshotsDir)) - << "No directory with golden screenshots specified, use " - "--golden-screenshots-dir"; - - golden_screenshots_dir_ = - command_line.GetSwitchValuePath(switches::kGoldenScreenshotsDir); - - if (mode == kTestMode || mode == kPdiffTestMode) { - test_mode_ = true; - generate_artifacts_ = command_line.HasSwitch(switches::kArtifactsDir); - if (generate_artifacts_) { - artifacts_dir_ = command_line.GetSwitchValuePath(switches::kArtifactsDir); - } - } - if (mode == kPdiffTestMode) { - pdiff_enabled_ = true; - } - return true; -} - -std::string ScreenshotTester::GetImageFileName( - const std::string& file_name_prefix, - ImageCategories category) { - std::string file_name = file_name_prefix + "_"; - switch (category) { - case kGoldenScreenshot: { - file_name += "golden_screenshot"; - break; - } - case kFailedScreenshot: { - file_name += "failed_screenshot"; - break; - } - case kDifferenceImage: { - file_name += "difference"; - break; - } - } - return file_name + ".png"; -} - -base::FilePath ScreenshotTester::GetImageFilePath( - const std::string& file_name_prefix, - ImageCategories category) { - std::string file_name = GetImageFileName(file_name_prefix, category); - base::FilePath file_path; - if (category == kGoldenScreenshot) { - file_path = golden_screenshots_dir_.AppendASCII(file_name); - } else { - file_path = artifacts_dir_.AppendASCII(file_name); - } - return file_path; -} - -void ScreenshotTester::Run(const std::string& test_name) { - PNGFile current_screenshot = TakeScreenshot(); - base::FilePath golden_screenshot_path = - GetImageFilePath(test_name, kGoldenScreenshot); - PNGFile golden_screenshot = LoadGoldenScreenshot(golden_screenshot_path); - if (test_mode_) { - CHECK(golden_screenshot.get()) - << "A golden screenshot is required for screenshot testing"; - VLOG(0) << "Loaded golden screenshot"; - Result result = CompareScreenshots(golden_screenshot, current_screenshot); - VLOG(0) << "Compared"; - LogComparisonResults(result); - if (!result.screenshots_match && generate_artifacts_) { - // Saving diff imag - if (!pdiff_enabled_) { - base::FilePath difference_image_path = - GetImageFilePath(test_name, kDifferenceImage); - CHECK(SaveImage(difference_image_path, result.diff_image)); - } - - // Saving failed screenshot - base::FilePath failed_screenshot_path = - GetImageFilePath(test_name, kFailedScreenshot); - CHECK(SaveImage(failed_screenshot_path, current_screenshot)); - } - ASSERT_TRUE(result.screenshots_match); - } else { - bool golden_screenshot_needs_update; - if (golden_screenshot.get()) { - // There is a golden screenshot, so we need to check it first. - Result result = CompareScreenshots(golden_screenshot, current_screenshot); - golden_screenshot_needs_update = (!result.screenshots_match); - } else { - // There is no golden screenshot for this test at all. - golden_screenshot_needs_update = true; - } - if (golden_screenshot_needs_update) { - bool golden_screenshot_saved = - SaveImage(golden_screenshot_path, current_screenshot); - CHECK(golden_screenshot_saved); - } else { - VLOG(0) << "Golden screenshot does not differ from the current one, no " - "need to update"; - } - } -} - -void ScreenshotTester::IgnoreArea(const SkIRect& area) { - ignored_areas_.push_back(area); -} - -void ScreenshotTester::EraseIgnoredAreas(SkBitmap& bitmap) { - for (std::vector<SkIRect>::iterator it = ignored_areas_.begin(); - it != ignored_areas_.end(); ++it) { - bitmap.eraseArea((*it), SK_ColorWHITE); - } -} - -bool ScreenshotTester::SaveImage(const base::FilePath& image_path, - PNGFile png_data) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (!png_data.get()) { - LOG(ERROR) << "There is no png data"; - return false; - } - if (!base::CreateDirectory(image_path.DirName())) { - LOG(ERROR) << "Can't create directory" << image_path.DirName().value(); - return false; - } - if (static_cast<size_t>(base::WriteFile( - image_path, reinterpret_cast<const char*>(png_data->front()), - png_data->size())) != png_data->size()) { - LOG(ERROR) << "Can't save screenshot " << image_path.BaseName().value() - << "."; - return false; - } - VLOG(0) << "Screenshot " << image_path.BaseName().value() << " saved to " - << image_path.DirName().value() << "."; - return true; -} - -void ScreenshotTester::ReturnScreenshot(base::RunLoop* run_loop, - PNGFile* screenshot, - PNGFile png_data) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - *screenshot = png_data; - run_loop->Quit(); -} - -ScreenshotTester::PNGFile ScreenshotTester::TakeScreenshot() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - aura::Window* primary_window = ash::Shell::GetPrimaryRootWindow(); - gfx::Rect rect = primary_window->bounds(); - PNGFile screenshot; - base::RunLoop run_loop; - ui::GrabWindowSnapshotAsyncPNG( - primary_window, rect, - base::Bind(&ScreenshotTester::ReturnScreenshot, - weak_factory_.GetWeakPtr(), base::Unretained(&run_loop), - &screenshot)); - run_loop.Run(); - return screenshot; -} - -ScreenshotTester::PNGFile ScreenshotTester::LoadGoldenScreenshot( - base::FilePath image_path) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - if (!base::PathExists(image_path)) { - LOG(WARNING) << "Can't find a golden screenshot for this test"; - return 0; - } - - int64_t golden_screenshot_size; - base::GetFileSize(image_path, &golden_screenshot_size); - - if (golden_screenshot_size == -1) { - LOG(FATAL) << "Can't get golden screenshot size"; - } - scoped_refptr<base::RefCountedBytes> png_data = new base::RefCountedBytes; - png_data->data().resize(golden_screenshot_size); - base::ReadFile(image_path, reinterpret_cast<char*>(&(png_data->data()[0])), - golden_screenshot_size); - - return png_data; -} - -SkBitmap ScreenshotTester::ProcessImageForComparison(const PNGFile& image) { - CHECK(image.get()); - SkBitmap current_bitmap; - gfx::PNGCodec::Decode(image->front(), image->size(), ¤t_bitmap); - EraseIgnoredAreas(current_bitmap); - return current_bitmap; -} - -ScreenshotTester::Result ScreenshotTester::CompareScreenshots( - const PNGFile& model, - const PNGFile& sample) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - - SkBitmap model_bitmap; - SkBitmap sample_bitmap; - - model_bitmap = ProcessImageForComparison(model); - sample_bitmap = ProcessImageForComparison(sample); - - if (pdiff_enabled_) { - return CompareScreenshotsPerceptually(model_bitmap, sample_bitmap); - } else { - return CompareScreenshotsRegularly(model_bitmap, sample_bitmap); - } -} - -void ScreenshotTester::LogSimilarity(double similarity, - bool screenshots_match) { - VLOG(0) << "Screenshots similarity: " << std::setprecision(5) - << similarity * 100 << "\%"; - if (!pdiff_enabled_ && screenshots_match) { - if (similarity == 1) { // 100% - VLOG(0) << "Screenshots match perfectly"; - } else { - VLOG(0) << "Screenshots differ slightly, but it is still a match"; - } - } -} - -void ScreenshotTester::LogComparisonResults( - const ScreenshotTester::Result& result) { - std::string comparison_type = pdiff_enabled_ ? "PerceptualDiff" : "regular"; - if (result.screenshots_match) { - VLOG(0) << "Screenshot testing passed using " << comparison_type - << " comparison"; - } else { - LOG(ERROR) << "Screenshot testing failed using " << comparison_type - << " comparison"; - if (!pdiff_enabled_) { - VLOG(0) << "(HINT): Result may be false negative. Try using " - "PerceptualDiff comparison (use pdiff-test mode instead of " - "test)"; - } - } - LogSimilarity(result.similarity, result.screenshots_match); -} - -ScreenshotTester::Result ScreenshotTester::CompareScreenshotsRegularly( - SkBitmap model_bitmap, - SkBitmap sample_bitmap) { - SkDifferentPixelsMetric differ; - - SkImageDiffer::BitmapsToCreate diff_parameters; - diff_parameters.rgbDiff = true; - SkImageDiffer::Result result; - - differ.diff(&model_bitmap, &sample_bitmap, diff_parameters, &result); - - Result testing_result; - - testing_result.screenshots_match = - (result.result >= kPrecision && - result.maxRedDiff <= kMaxAllowedColorDifference && - result.maxGreenDiff <= kMaxAllowedColorDifference && - result.maxBlueDiff <= kMaxAllowedColorDifference); - - testing_result.similarity = result.result; - - scoped_refptr<base::RefCountedBytes> diff_image(new base::RefCountedBytes); - diff_image->data().resize(result.rgbDiffBitmap.computeByteSize()); - CHECK(gfx::PNGCodec::EncodeBGRASkBitmap(result.rgbDiffBitmap, false, - &diff_image->data())) - << "Could not encode difference to PNG"; - testing_result.diff_image = diff_image; - - return testing_result; -} - -ScreenshotTester::Result ScreenshotTester::CompareScreenshotsPerceptually( - SkBitmap model_bitmap, - SkBitmap sample_bitmap) { - SkPMetric differ; - SkImageDiffer::BitmapsToCreate diff_parameters; - SkImageDiffer::Result result; - - differ.diff(&model_bitmap, &sample_bitmap, diff_parameters, &result); - - ScreenshotTester::Result testing_result; - testing_result.similarity = result.result; - testing_result.screenshots_match = - (result.result == SkImageDiffer::RESULT_CORRECT); - - return testing_result; -} - -} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h b/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h deleted file mode 100644 index 1dd26b6..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h +++ /dev/null
@@ -1,167 +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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SCREENSHOT_TESTER_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SCREENSHOT_TESTER_H_ - -#include <string> -#include <vector> - -#include "base/files/file_path.h" -#include "base/macros.h" -#include "base/memory/ref_counted_memory.h" -#include "base/memory/weak_ptr.h" -#include "third_party/skia/include/core/SkBitmap.h" - -namespace base { -class RunLoop; -} - -namespace chromeos { - -// A class that allows taking, saving and comparing screnshots while -// running tests. -class ScreenshotTester { - public: - ScreenshotTester(); - virtual ~ScreenshotTester(); - - typedef scoped_refptr<base::RefCountedMemory> PNGFile; - - // Contains the results of comparison - struct Result { - Result(); - Result(const Result& other); - ~Result(); - - // Is true if screenshots are considered to be equal, false otherwise. - bool screenshots_match; - - // How similar are images from 0 to 1. - double similarity; - - // Image representing difference. Might not be filled during to specifics of - // some comparison methods. - PNGFile diff_image; - }; - - // Returns true if the screenshots should be taken and will be taken, - // false otherwise. Also gets all the information from the command line - // swithes. - bool TryInitialize(); - - // Does all the work that has been stated through switches: - // updates golden screenshot or takes a new screenshot and compares it - // with the golden one. |test_name| is the name of the test from which - // we run this method. - void Run(const std::string& test_name); - - // Remembers that area |area| should be ignored during comparison. - void IgnoreArea(const SkIRect& area); - - // Prints out how similar two images are. - void LogSimilarity(double similarity, bool screenshots_match); - - private: - // Categories of images that can be possible generated and used during this - // test. - enum ImageCategories { - kGoldenScreenshot, - kFailedScreenshot, - kDifferenceImage - }; - - // When images are same less that |kPrecision| pixels, they are considered to - // be different. - const double kPrecision = 0.99; - - // When difference in any of the RGB colors in any of the pixels between two - // images - // exceeds |kMaxAllowedColorDifference|, images are considered to be - // different. - const int kMaxAllowedColorDifference = 32; - - // Returns full name of a .png file of a |category| type starting with - // |file_name_prefix| prefix, - // e.g. MyTest_golden_screenshot.png - std::string GetImageFileName(const std::string& file_name_prefix, - ImageCategories category); - - // Returns full path for an image of this category. - base::FilePath GetImageFilePath(const std::string& file_name_prefix, - ImageCategories category); - - // Erases areas that should be ignored during comparison from the screenshot. - void EraseIgnoredAreas(SkBitmap& bitmap); - - // Takes a screenshot and returns it. - PNGFile TakeScreenshot(); - - // Saves |png_data| as a new golden screenshot for test |test_name_|. - void UpdateGoldenScreenshot(PNGFile png_data); - - // Saves an image |png_data|, assuming it is a .png file. - // Returns true if image was saved successfully. - bool SaveImage(const base::FilePath& image_path, PNGFile png_data); - - // Logs results of comparison accordint to information in |result|. - void LogComparisonResults(const ScreenshotTester::Result& result); - - // Saves |png_data| as a current screenshot. - void ReturnScreenshot(base::RunLoop* run_loop, - PNGFile* screenshot, - PNGFile png_data); - - // Loads golden screenshot from the disk, assuming it lies at |image_path|. - // Fails if there is no such a file. - PNGFile LoadGoldenScreenshot(base::FilePath image_path); - - // Converts .png file to a bitmap which is ready for comparison (erasing - // ignored areas included). - SkBitmap ProcessImageForComparison(const PNGFile& image); - - // Calls comparing two given screenshots with one of the comparators. - // Returns a Result structure containing comparison results. - Result CompareScreenshots(const PNGFile& model, const PNGFile& sample); - - // Compares images using PerceptualDiff, and returns a Result structure - // without a diff image containing comparison results. - Result CompareScreenshotsPerceptually(SkBitmap model_bitmap, - SkBitmap sample_bitmap); - - // Compares images pixel-by-pixel with some features and returns a Result - // structure containing comparison results. - Result CompareScreenshotsRegularly(SkBitmap model_bitmap, - SkBitmap sample_bitmap); - - // Path to the directory for golden screenshots. - base::FilePath golden_screenshots_dir_; - - // Path to the directory where screenshots that failed comparing - // and difference between them and golden ones will be stored. - base::FilePath artifacts_dir_; - - // Is true when we're in test mode: - // comparing golden screenshots and current ones. - bool test_mode_; - - // Is true when switches specify that PerceptualDiff should - // be used to compare images. - bool pdiff_enabled_; - - // Is true when switches specify that artifacts should be saved somewhere. - bool generate_artifacts_; - - // Vector which holds areas which the comparison ignores because - // them being different is not a bug (e.g. time on the clock). - std::vector<SkIRect> ignored_areas_; - - base::WeakPtrFactory<ScreenshotTester> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(ScreenshotTester); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SCREENSHOT_TESTER_H_
diff --git a/chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.cc b/chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.cc deleted file mode 100644 index 88a009a..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.cc +++ /dev/null
@@ -1,66 +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 "chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.h" - -#include "base/run_loop.h" -#include "base/task/post_task.h" -#include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_notification_types.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/notification_service.h" -#include "content/public/browser/notification_types.h" -#include "ui/compositor/compositor_switches.h" - -namespace chromeos { - -ScreenshotTestingMixin::ScreenshotTestingMixin( - InProcessBrowserTestMixinHost* host) - : InProcessBrowserTestMixin(host) {} - -ScreenshotTestingMixin::~ScreenshotTestingMixin() = default; - -void ScreenshotTestingMixin::RunScreenshotTesting( - const std::string& test_name) { - if (enable_test_screenshots_) { - SynchronizeAnimationLoadWithCompositor(); - screenshot_tester_.Run(test_name); - } -} - -void ScreenshotTestingMixin::IgnoreArea(const SkIRect& area) { - screenshot_tester_.IgnoreArea(area); -} - -void ScreenshotTestingMixin::SetUpInProcessBrowserTestFixture() { - enable_test_screenshots_ = screenshot_tester_.TryInitialize(); -} - -void ScreenshotTestingMixin::SetUpCommandLine(base::CommandLine* command_line) { - if (enable_test_screenshots_) { - command_line->AppendSwitch(switches::kEnablePixelOutputInTests); - } -} - -// Current implementation is a mockup. -// It simply waits for 5 seconds, assuming that this time is enough for -// animation to load completely. -// TODO(elizavetai): Replace this temporary hack with getting a -// valid notification from compositor. -void ScreenshotTestingMixin::SynchronizeAnimationLoadWithCompositor() { - base::RunLoop waiter; - animation_waiter_quitter_ = waiter.QuitClosure(); - timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(2), this, - &ScreenshotTestingMixin::HandleAnimationLoad); - waiter.Run(); -} - -void ScreenshotTestingMixin::HandleAnimationLoad() { - timer_.Stop(); - base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, - animation_waiter_quitter_); -} - -} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.h b/chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.h deleted file mode 100644 index e93e27a..0000000 --- a/chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.h +++ /dev/null
@@ -1,63 +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 CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SCREENSHOT_TESTING_MIXIN_H_ -#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SCREENSHOT_TESTING_MIXIN_H_ - -#include <string> - -#include "base/command_line.h" -#include "base/timer/timer.h" -#include "chrome/browser/chromeos/login/mixin_based_in_process_browser_test.h" -#include "chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h" -#include "content/public/test/browser_test_base.h" - -namespace chromeos { - -// Base mixin class for tests which support testing with screenshots. -// Sets up everything required for taking screenshots. -// Provides functionality to deal with animation load: screenshots -// should be taken only when all the animation is loaded. -class ScreenshotTestingMixin : public InProcessBrowserTestMixin { - public: - explicit ScreenshotTestingMixin(InProcessBrowserTestMixinHost* host); - ~ScreenshotTestingMixin() override; - - void RunScreenshotTesting(const std::string& test_name); - void IgnoreArea(const SkIRect& area); - - // InProcessBrowserTestMixin: - void SetUpInProcessBrowserTestFixture() override; - void SetUpCommandLine(base::CommandLine* command_line) override; - - private: - // It turns out that it takes some more time for the animation - // to finish loading even after all the notifications have been sent. - // That happens due to some properties of compositor. - // This method should be used after getting all the necessary notifications - // to wait for the actual load of animation. - void SynchronizeAnimationLoadWithCompositor(); - - // This method exists only because of the current implementation of - // SynchronizeAnimationLoadWithCompositor. - void HandleAnimationLoad(); - - // Required for current implementation of - // SynchronizeAnimationLoadWithCompositor() - base::OneShotTimer timer_; - base::Closure animation_waiter_quitter_; - - // Is true if testing with screenshots is turned on with all proper switches. - bool enable_test_screenshots_ = false; - - // |screenshot_tester_ | does everything connected with taking, loading and - // comparing screenshots - ScreenshotTester screenshot_tester_; - - DISALLOW_COPY_AND_ASSIGN(ScreenshotTestingMixin); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENSHOT_TESTING_SCREENSHOT_TESTING_MIXIN_H_
diff --git a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc index 106bbd3..545fe4e3 100644 --- a/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc +++ b/chrome/browser/chromeos/login/signin/oauth2_browsertest.cc
@@ -26,6 +26,7 @@ #include "chrome/browser/chromeos/login/startup_utils.h" #include "chrome/browser/chromeos/login/test/fake_gaia_mixin.h" #include "chrome/browser/chromeos/login/test/js_checker.h" +#include "chrome/browser/chromeos/login/test/network_portal_detector_mixin.h" #include "chrome/browser/chromeos/login/test/oobe_base_test.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/wizard_controller.h" @@ -45,8 +46,8 @@ #include "chromeos/login/auth/key.h" #include "chromeos/login/auth/user_context.h" #include "components/account_id/account_id.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/prefs/pref_service.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "content/public/browser/browser_task_traits.h" @@ -467,7 +468,13 @@ request_deferers_[path] = request_deferer; } + void SimulateNetworkOnline() { + network_portal_detector_.SimulateDefaultNetworkState( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE); + } + FakeGaiaMixin fake_gaia_{&mixin_host_, embedded_test_server()}; + NetworkPortalDetectorMixin network_portal_detector_{&mixin_host_}; private: base::FilePath test_data_dir_;
diff --git a/chrome/browser/chromeos/login/test/oobe_base_test.cc b/chrome/browser/chromeos/login/test/oobe_base_test.cc index 5ed7251..ca57face 100644 --- a/chrome/browser/chromeos/login/test/oobe_base_test.cc +++ b/chrome/browser/chromeos/login/test/oobe_base_test.cc
@@ -19,7 +19,6 @@ #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" #include "chrome/browser/chromeos/login/ui/login_display_host_webui.h" #include "chrome/browser/chromeos/login/ui/webui_login_view.h" -#include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" @@ -77,15 +76,6 @@ MixinBasedInProcessBrowserTest::SetUpCommandLine(command_line); } -void OobeBaseTest::SetUpInProcessBrowserTestFixture() { - network_portal_detector_ = new NetworkPortalDetectorTestImpl(); - network_portal_detector::InitializeForTesting(network_portal_detector_); - network_portal_detector_->SetDefaultNetworkForTesting( - FakeShillManagerClient::kFakeEthernetNetworkGuid); - - MixinBasedInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); -} - void OobeBaseTest::SetUpOnMainThread() { // Start the accept thread as the sandbox host process has already been // spawned. @@ -123,46 +113,6 @@ return true; } -void OobeBaseTest::SimulateNetworkOffline() { - NetworkPortalDetector::CaptivePortalState offline_state; - offline_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE; - network_portal_detector_->SetDetectionResultsForTesting( - FakeShillManagerClient::kFakeEthernetNetworkGuid, offline_state); - network_portal_detector_->NotifyObserversForTesting(); -} - -base::Closure OobeBaseTest::SimulateNetworkOfflineClosure() { - return base::Bind(&OobeBaseTest::SimulateNetworkOffline, - base::Unretained(this)); -} - -void OobeBaseTest::SimulateNetworkOnline() { - NetworkPortalDetector::CaptivePortalState online_state; - online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; - online_state.response_code = 204; - network_portal_detector_->SetDetectionResultsForTesting( - FakeShillManagerClient::kFakeEthernetNetworkGuid, online_state); - network_portal_detector_->NotifyObserversForTesting(); -} - -base::Closure OobeBaseTest::SimulateNetworkOnlineClosure() { - return base::Bind(&OobeBaseTest::SimulateNetworkOnline, - base::Unretained(this)); -} - -void OobeBaseTest::SimulateNetworkPortal() { - NetworkPortalDetector::CaptivePortalState portal_state; - portal_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL; - network_portal_detector_->SetDetectionResultsForTesting( - FakeShillManagerClient::kFakeEthernetNetworkGuid, portal_state); - network_portal_detector_->NotifyObserversForTesting(); -} - -base::Closure OobeBaseTest::SimulateNetworkPortalClosure() { - return base::Bind(&OobeBaseTest::SimulateNetworkPortal, - base::Unretained(this)); -} - content::WebUI* OobeBaseTest::GetLoginUI() { return LoginDisplayHost::default_host()->GetOobeUI()->web_ui(); }
diff --git a/chrome/browser/chromeos/login/test/oobe_base_test.h b/chrome/browser/chromeos/login/test/oobe_base_test.h index 2072b12..76c126a3 100644 --- a/chrome/browser/chromeos/login/test/oobe_base_test.h +++ b/chrome/browser/chromeos/login/test/oobe_base_test.h
@@ -18,8 +18,6 @@ namespace chromeos { -class NetworkPortalDetectorTestImpl; - // Base class for OOBE, login, SAML and Kiosk tests. class OobeBaseTest : public MixinBasedInProcessBrowserTest { public: @@ -34,7 +32,6 @@ // MixinBasedInProcessBrowserTest:: void SetUp() override; void SetUpCommandLine(base::CommandLine* command_line) override; - void SetUpInProcessBrowserTestFixture() override; void SetUpOnMainThread() override; void TearDownOnMainThread() override; @@ -48,15 +45,6 @@ // Oobe UI to start up before initializing all mix-ins. virtual bool ShouldWaitForOobeUI(); - // Network status control functions. - void SimulateNetworkOffline(); - void SimulateNetworkOnline(); - void SimulateNetworkPortal(); - - base::Closure SimulateNetworkOfflineClosure(); - base::Closure SimulateNetworkOnlineClosure(); - base::Closure SimulateNetworkPortalClosure(); - // Returns chrome://oobe WebUI. content::WebUI* GetLoginUI(); @@ -70,8 +58,6 @@ void WaitForEnrollmentSuccess(); test::JSChecker SigninFrameJS(); - NetworkPortalDetectorTestImpl* network_portal_detector_ = nullptr; - // Whether to use background networking. Note this is only effective when it // is set before SetUpCommandLine is invoked. bool needs_background_networking_ = false;
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc b/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc index d44596f..22ee68a 100644 --- a/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc +++ b/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc
@@ -35,8 +35,6 @@ } // anonymous namespace -UserImageSyncObserver::Observer::~Observer() {} - UserImageSyncObserver::UserImageSyncObserver(const user_manager::User* user) : user_(user), prefs_(NULL), @@ -70,14 +68,6 @@ kUserImageInfo, user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); } -void UserImageSyncObserver::AddObserver(Observer* observer) { - observer_list_.AddObserver(observer); -} - -void UserImageSyncObserver::RemoveObserver(Observer* observer) { - observer_list_.RemoveObserver(observer); -} - void UserImageSyncObserver::OnProfileGained(Profile* profile) { prefs_ = PrefServiceSyncableFromProfile(profile); pref_change_registrar_.reset(new PrefChangeRegistrar); @@ -102,8 +92,6 @@ UpdateLocalImageFromSynced(); local_image_updated = true; } - for (auto& observer : observer_list_) - observer.OnInitialSync(local_image_updated); } void UserImageSyncObserver::OnPreferenceChanged(const std::string& pref_name) {
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h b/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h index 3ead53b2..8b928a5 100644 --- a/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h +++ b/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h
@@ -8,7 +8,6 @@ #include <memory> #include <string> -#include "base/observer_list.h" #include "components/sync_preferences/pref_service_syncable_observer.h" #include "components/user_manager/user_manager.h" #include "content/public/browser/notification_observer.h" @@ -41,16 +40,6 @@ public content::NotificationObserver, public user_manager::UserManager::Observer { public: - class Observer { - public: - // Called right after image info synced (i.e. |is_synced| became |true|). - // |local_image_updated| indicates if we desided to update local image in - // result of sync. - virtual void OnInitialSync(bool local_image_updated) = 0; - virtual ~Observer(); - }; - - public: explicit UserImageSyncObserver(const user_manager::User* user); ~UserImageSyncObserver() override; @@ -60,11 +49,6 @@ // Returns |true| if sync was initialized and prefs have actual state. bool is_synced() const { return is_synced_; } - // Adds |observer| into observers list. - void AddObserver(Observer* observer); - // Removes |observer| from observers list. - void RemoveObserver(Observer* observer); - private: // sync_preferences::PrefServiceSyncableObserver implementation. void OnIsSyncingChanged() override; @@ -103,7 +87,6 @@ bool is_synced_; // Indicates if local user image changed during initialization. bool local_image_changed_; - base::ObserverList<Observer>::Unchecked observer_list_; }; } // namespace chromeos
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 6ec21f2..fe90e16 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -189,8 +189,7 @@ {chromeos::OobeScreen::SCREEN_OOBE_WELCOME, "network"}, {chromeos::OobeScreen::SCREEN_CREATE_SUPERVISED_USER_FLOW_DEPRECATED, "supervised-user-creation-flow"}, - {chromeos::OobeScreen::SCREEN_TERMS_OF_SERVICE, "tos"}, - {chromeos::OobeScreen::SCREEN_USER_IMAGE_PICKER, "image"}}; + {chromeos::OobeScreen::SCREEN_TERMS_OF_SERVICE, "tos"}}; void RecordUMAHistogramForOOBEStepCompletionTime(chromeos::OobeScreen screen, base::TimeDelta step_time) { @@ -1566,7 +1565,6 @@ return (screen_id == OobeScreen::SCREEN_OOBE_HID_DETECTION || screen_id == OobeScreen::SCREEN_OOBE_WELCOME || screen_id == OobeScreen::SCREEN_OOBE_UPDATE || - screen_id == OobeScreen::SCREEN_USER_IMAGE_PICKER || screen_id == OobeScreen::SCREEN_OOBE_EULA || screen_id == OobeScreen::SCREEN_SPECIAL_LOGIN || screen_id == OobeScreen::SCREEN_WRONG_HWID); @@ -1584,7 +1582,6 @@ current_screen_id == OobeScreen::SCREEN_SYNC_CONSENT || current_screen_id == OobeScreen::SCREEN_FINGERPRINT_SETUP || current_screen_id == OobeScreen::SCREEN_ARC_TERMS_OF_SERVICE || - current_screen_id == OobeScreen::SCREEN_USER_IMAGE_PICKER || current_screen_id == OobeScreen::SCREEN_DISCOVER || current_screen_id == OobeScreen::SCREEN_MARKETING_OPT_IN) { default_controller()->OnOobeFlowFinished();
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index 0ce570a..0b9ca6e 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -45,7 +45,6 @@ #include "chrome/browser/chromeos/login/screens/mock_welcome_screen.h" #include "chrome/browser/chromeos/login/screens/mock_wrong_hwid_screen.h" #include "chrome/browser/chromeos/login/screens/reset_screen.h" -#include "chrome/browser/chromeos/login/screens/user_image_screen.h" #include "chrome/browser/chromeos/login/screens/welcome_screen.h" #include "chrome/browser/chromeos/login/screens/wrong_hwid_screen.h" #include "chrome/browser/chromeos/login/startup_utils.h"
diff --git a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc index 68470c2..b23009d9 100644 --- a/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc +++ b/chrome/browser/chromeos/ownership/owner_settings_service_chromeos_unittest.cc
@@ -29,8 +29,7 @@ namespace { -void OnPrefChanged(const std::string& /* setting */) { -} +void OnPrefChanged(const std::string& /* setting */) {} class PrefsChecker : public ownership::OwnerSettingsService::Observer { public: @@ -169,7 +168,7 @@ } TEST_F(OwnerSettingsServiceChromeOSTest, FailedSetRequest) { - session_manager_client_.set_store_policy_success(false); + session_manager_client_.ForceStorePolicyFailure(true); std::string current_channel; ASSERT_TRUE(provider_->Get(kReleaseChannel)->GetAsString(¤t_channel)); ASSERT_NE(current_channel, "stable-channel");
diff --git a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc index 4df110c..4fdc024 100644 --- a/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc
@@ -122,7 +122,8 @@ class DeviceCloudPolicyManagerChromeOSTest : public chromeos::DeviceSettingsTestBase, - public DeviceCloudPolicyManagerChromeOS::Observer { + public DeviceCloudPolicyManagerChromeOS::Observer, + public chromeos::SessionManagerClient::Observer { protected: DeviceCloudPolicyManagerChromeOSTest() : state_keys_broker_(&fake_session_manager_client_), store_(nullptr) { @@ -135,9 +136,11 @@ state_keys.push_back("2"); state_keys.push_back("3"); fake_session_manager_client_.set_server_backed_state_keys(state_keys); + session_manager_client_.AddObserver(this); } ~DeviceCloudPolicyManagerChromeOSTest() override { + session_manager_client_.RemoveObserver(this); chromeos::system::StatisticsProvider::SetTestProvider(NULL); } @@ -177,9 +180,10 @@ test_url_loader_factory_.GetSafeWeakWrapper(), &local_state_); url_fetcher_response_code_ = net::HTTP_OK; - url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," - "\"expires_in\":1234," - "\"refresh_token\":\"refreshToken4Test\"}"; + url_fetcher_response_string_ = + "{\"access_token\":\"accessToken4Test\"," + "\"expires_in\":1234," + "\"refresh_token\":\"refreshToken4Test\"}"; AllowUninterestingRemoteCommandFetches(); } @@ -215,8 +219,7 @@ base::RunLoop loop; chromeos::InstallAttributes::LockResult result; install_attributes_->LockDevice( - DEVICE_MODE_ENTERPRISE, - PolicyBuilder::kFakeDomain, + DEVICE_MODE_ENTERPRISE, PolicyBuilder::kFakeDomain, std::string(), // realm PolicyBuilder::kFakeDeviceId, base::Bind(&CopyLockResult, &loop, &result)); @@ -265,9 +268,20 @@ .Times(AnyNumber()); } + // DeviceCloudPolicyManagerChromeOS::Observer: MOCK_METHOD0(OnDeviceCloudPolicyManagerConnected, void()); MOCK_METHOD0(OnDeviceCloudPolicyManagerDisconnected, void()); + // SessionManagerClient::Observer: + void OwnerKeySet(bool success) override { + // Called when the owner key is set in SessionManagerClient. Make it + // immediately available to |owner_key_util_| since code that "loads" the + // key will load it through that instance. + EXPECT_TRUE(success); + owner_key_util_->SetPublicKeyFromPrivateKey( + *device_policy_->GetNewSigningKey()); + } + std::unique_ptr<chromeos::InstallAttributes> install_attributes_; net::HttpStatusCode url_fetcher_response_code_; @@ -460,7 +474,6 @@ device_policy_->policy()); robot_auth_fetch_response_.mutable_service_api_access_response() ->set_auth_code("auth_code_for_test"); - loaded_blob_ = device_policy_->GetBlob(); // Initialize the manager. FlushDeviceSettings(); @@ -562,11 +575,12 @@ // Process verification. MockDeviceManagementJob* robot_auth_fetch_job = NULL; - EXPECT_CALL(device_management_service_, CreateJob( - DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH, _)) + EXPECT_CALL( + device_management_service_, + CreateJob(DeviceManagementRequestJob::TYPE_API_AUTH_CODE_FETCH, _)) .Times(AtMost(1)) - .WillOnce(device_management_service_.CreateAsyncJob( - &robot_auth_fetch_job)); + .WillOnce( + device_management_service_.CreateAsyncJob(&robot_auth_fetch_job)); EXPECT_CALL( device_management_service_, StartJob(dm_protocol::kValueRequestApiAuthorization, _, _, _, _, _, _)) @@ -588,6 +602,18 @@ if (done_) return; + // Set expectations for the second policy refresh that happens after the + // enrollment completes. + MockDeviceManagementJob* component_policy_fetch_job = NULL; + EXPECT_CALL(device_management_service_, + CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) + .Times(AtMost(1)) + .WillOnce(device_management_service_.CreateAsyncJob( + &component_policy_fetch_job)); + EXPECT_CALL(device_management_service_, + StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _, _)) + .Times(AtMost(1)); + // Process robot refresh token fetch if the auth code fetch succeeded. // DeviceCloudPolicyInitializer holds an EnrollmentHandlerChromeOS which // holds a GaiaOAuthClient that fetches the refresh token during enrollment. @@ -603,6 +629,7 @@ // Process robot refresh token store and policy store. base::RunLoop().RunUntilIdle(); + if (!done_ || status_.status() == EnrollmentStatus::SUCCESS) { // Verify the state only if the task is not yet failed. // Note that, if the flow is not yet |done_| here, assume that it is @@ -617,22 +644,7 @@ if (done_) return; - // Process the second policy refresh that happens after the enrollment - // completes. - MockDeviceManagementJob* component_policy_fetch_job = NULL; - EXPECT_CALL(device_management_service_, - CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH, _)) - .Times(AtMost(1)) - .WillOnce(device_management_service_.CreateAsyncJob( - &component_policy_fetch_job)); - EXPECT_CALL(device_management_service_, - StartJob(dm_protocol::kValueRequestPolicy, _, _, _, _, _, _)) - .Times(AtMost(1)); - - // Key installation and policy load. - session_manager_client_.set_device_policy(loaded_blob_); - owner_key_util_->SetPublicKeyFromPrivateKey( - *device_policy_->GetNewSigningKey()); + // Policy load. ReloadDeviceSettings(); // Respond to the second policy refresh. @@ -674,8 +686,6 @@ DeviceManagementStatus robot_auth_fetch_status_; em::DeviceManagementResponse robot_auth_fetch_response_; - std::string loaded_blob_; - em::DeviceManagementRequest register_request_; std::string client_id_; EnrollmentStatus status_; @@ -733,9 +743,10 @@ // The encryption lib is a noop for tests, but empty results from encryption // is an error, so we simulate an encryption error by returning an empty // refresh token. - url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," - "\"expires_in\":1234," - "\"refresh_token\":\"\"}"; + url_fetcher_response_string_ = + "{\"access_token\":\"accessToken4Test\"," + "\"expires_in\":1234," + "\"refresh_token\":\"\"}"; RunTest(); ExpectFailedEnrollment(EnrollmentStatus::ROBOT_REFRESH_STORE_FAILED); } @@ -759,14 +770,14 @@ } TEST_P(DeviceCloudPolicyManagerChromeOSEnrollmentTest, StoreError) { - session_manager_client_.set_store_policy_success(false); + session_manager_client_.ForceStorePolicyFailure(true); RunTest(); ExpectFailedEnrollment(EnrollmentStatus::STORE_ERROR); EXPECT_EQ(CloudPolicyStore::STATUS_STORE_ERROR, status_.store_status()); } TEST_P(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { - loaded_blob_.clear(); + session_manager_client_.ForceRetrievePolicyLoadError(true); RunTest(); ExpectFailedEnrollment(EnrollmentStatus::STORE_ERROR); EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, status_.store_status());
diff --git a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc index 71cc68e..4b5c099 100644 --- a/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc +++ b/chrome/browser/chromeos/policy/remote_commands/crd_host_delegate.cc
@@ -305,7 +305,6 @@ // TODO(antrim): set up watchdog timer (reasonable cutoff). host_ = remoting::CreateIt2MeNativeMessagingHostForChromeOS( - g_browser_process->system_request_context(), base::CreateSingleThreadTaskRunnerWithTraits( {content::BrowserThread::IO}), base::CreateSingleThreadTaskRunnerWithTraits(
diff --git a/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.cc b/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.cc index be8c6bb..3c6efc0 100644 --- a/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.cc +++ b/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.cc
@@ -18,6 +18,10 @@ namespace { +// Timeout for the TPM firmware update availability check. +const base::TimeDelta kFirmwareAvailabilityCheckerTimeout = + base::TimeDelta::FromSeconds(20); + // Reads the value of the the device setting key // TPMFirmwareUpdateSettings.AutoUpdateMode from a trusted store. If the value // is temporarily untrusted |callback| will be invoked later when trusted values @@ -25,7 +29,7 @@ // via the device policy TPMFirmwareUpdateSettings. policy::AutoUpdateMode GetTPMAutoUpdateModeSetting( const chromeos::CrosSettings* cros_settings, - const base::RepeatingCallback<void()> callback) { + const base::RepeatingClosure callback) { if (!g_browser_process->platform_part() ->browser_policy_connector_chromeos() ->IsEnterpriseManaged()) { @@ -33,7 +37,7 @@ } chromeos::CrosSettingsProvider::TrustedStatus status = - cros_settings->PrepareTrustedValues(base::BindRepeating(callback)); + cros_settings->PrepareTrustedValues(callback); if (status != chromeos::CrosSettingsProvider::TRUSTED) return policy::AutoUpdateMode::kNever; const base::Value* tpm_settings = @@ -102,7 +106,7 @@ void TPMAutoUpdateModePolicyHandler::CheckForUpdate( base::OnceCallback<void(bool)> callback) { chromeos::tpm_firmware_update::UpdateAvailable( - std::move(callback), base::TimeDelta().FromSeconds(20)); + std::move(callback), kFirmwareAvailabilityCheckerTimeout); } // static @@ -121,4 +125,21 @@ update_checker_callback_ = callback; } +void TPMAutoUpdateModePolicyHandler::UpdateOnEnrollmentIfNeeded() { + AutoUpdateMode auto_update_mode = GetTPMAutoUpdateModeSetting( + cros_settings_, + base::BindRepeating( + &TPMAutoUpdateModePolicyHandler::UpdateOnEnrollmentIfNeeded, + weak_factory_.GetWeakPtr())); + + // If the TPM is set to update with user acknowlegment, always update on + // enrollment. The AutoUpdateMode.UserAcknowledgment flow is meant to give a + // warning to the user to backup their data. During enrollment there is no + // user data on the device. + if (auto_update_mode == AutoUpdateMode::kEnrollment || + auto_update_mode == AutoUpdateMode::kUserAcknowledgment) { + update_checker_callback_.Run(base::BindOnce(&OnUpdateAvailableCheckResult)); + } +} + } // namespace policy
diff --git a/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h b/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h index 8feef00..467625ea 100644 --- a/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h +++ b/chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h
@@ -46,6 +46,11 @@ void SetUpdateCheckerCallbackForTesting( const UpdateCheckerCallback& callback); + // Updates the TPM firmware if the device is set to update at enrollment via + // device policy option TPMFirmwareUpdateSettings.AutoUpdateMode. If the TPM + // firmware is not vulnerable the method will return without updating. + void UpdateOnEnrollmentIfNeeded(); + private: void OnPolicyChanged();
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 c6d67a5..772ac871 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.cc
@@ -38,7 +38,6 @@ #include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_features.h" #include "chromeos/constants/chromeos_switches.h" -#include "components/crash/core/common/crash_key.h" #include "components/invalidation/impl/profile_invalidation_provider.h" #include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h" #include "components/policy/core/common/cloud/cloud_external_data_manager.h" @@ -218,16 +217,6 @@ DCHECK(device_management_service); DCHECK(local_state); - // TODO(emaxx): Remove the crash key after the crashes tracked at - // https://crbug.com/685996 are fixed. - if (core()->client()) { - static crash_reporter::CrashKeyString<1024> connect_callstack_key( - "user-cloud-policy-manager-connect-trace"); - crash_reporter::SetCrashKeyStringToStackTrace(&connect_callstack_key, - connect_callstack_); - } else { - connect_callstack_ = base::debug::StackTrace(); - } CHECK(!core()->client()); local_state_ = local_state;
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h index 8b9458e..87c1d4ec 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h +++ b/chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h
@@ -10,7 +10,6 @@ #include "base/bind.h" #include "base/compiler_specific.h" -#include "base/debug/stack_trace.h" #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -282,11 +281,6 @@ base::Time time_token_available_; base::Time time_client_registered_; - // Stack trace of the previous Connect() method call. - // TODO(emaxx): Remove after the crashes tracked at https://crbug.com/685996 - // are fixed. - base::debug::StackTrace connect_callstack_; - // The AccountId associated with the user whose policy is being loaded. const AccountId account_id_;
diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc index 47f80d5..d1b7fba 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc
@@ -347,7 +347,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, StoreFail) { // Let store policy fail. - session_manager_client_->set_store_policy_success(false); + session_manager_client_->ForceStorePolicyFailure(true); store_->Store(policy_.policy()); RunLoopAndExpectError(CloudPolicyStore::STATUS_STORE_ERROR);
diff --git a/chrome/browser/chromeos/settings/device_settings_service_unittest.cc b/chrome/browser/chromeos/settings/device_settings_service_unittest.cc index 1b0ef5c..de63d7d 100644 --- a/chrome/browser/chromeos/settings/device_settings_service_unittest.cc +++ b/chrome/browser/chromeos/settings/device_settings_service_unittest.cc
@@ -43,9 +43,7 @@ class DeviceSettingsServiceTest : public DeviceSettingsTestBase { public: - void SetOperationCompleted() { - operation_completed_ = true; - } + void SetOperationCompleted() { operation_completed_ = true; } void SetOwnershipStatus( DeviceSettingsService::OwnershipStatus ownership_status) { @@ -155,7 +153,7 @@ EXPECT_EQ(DeviceSettingsService::STORE_KEY_UNAVAILABLE, device_settings_service_->status()); - session_manager_client_.set_store_policy_success(false); + session_manager_client_.ForceStorePolicyFailure(true); device_settings_service_->Store( device_policy_->GetCopy(), base::Bind(&DeviceSettingsServiceTest::SetOperationCompleted,
diff --git a/chrome/browser/chromeos/system/device_disabling_browsertest.cc b/chrome/browser/chromeos/system/device_disabling_browsertest.cc index ac9dd682..fdcb985c 100644 --- a/chrome/browser/chromeos/system/device_disabling_browsertest.cc +++ b/chrome/browser/chromeos/system/device_disabling_browsertest.cc
@@ -10,6 +10,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/run_loop.h" +#include "chrome/browser/chromeos/login/test/network_portal_detector_mixin.h" #include "chrome/browser/chromeos/login/test/oobe_base_test.h" #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" @@ -78,6 +79,7 @@ void UpdateState(NetworkError::ErrorReason reason) override; std::unique_ptr<base::RunLoop> network_state_change_wait_run_loop_; + NetworkPortalDetectorMixin network_portal_detector_{&mixin_host_}; private: FakeSessionManagerClient* fake_session_manager_client_; @@ -213,7 +215,8 @@ ASSERT_TRUE(signin_screen_handler); signin_screen_handler->SetOfflineTimeoutForTesting( base::TimeDelta::FromSeconds(0)); - SimulateNetworkOffline(); + network_portal_detector_.SimulateDefaultNetworkState( + NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_OFFLINE); network_state_change_wait_run_loop_->Run(); network_state_informer->RemoveObserver(this); base::RunLoop().RunUntilIdle();
diff --git a/chrome/browser/component_updater/sth_set_component_installer.cc b/chrome/browser/component_updater/sth_set_component_installer.cc index e3d67c7c..2403050 100644 --- a/chrome/browser/component_updater/sth_set_component_installer.cc +++ b/chrome/browser/component_updater/sth_set_component_installer.cc
@@ -22,7 +22,6 @@ #include "base/threading/sequenced_task_runner_handle.h" #include "base/values.h" #include "base/version.h" -#include "chrome/browser/after_startup_task_utils.h" #include "components/certificate_transparency/sth_observer.h" #include "components/component_updater/component_updater_paths.h" #include "content/public/browser/browser_thread.h" @@ -223,11 +222,10 @@ // Load and parse the STH JSON on a background task runner, then // dispatch back to the current task runner with all of the successfully // parsed results. - auto background_runner = base::MakeRefCounted<AfterStartupTaskUtils::Runner>( - base::CreateTaskRunnerWithTraits( - {base::TaskPriority::BEST_EFFORT, base::MayBlock()})); - background_runner->PostTask( - FROM_HERE, + auto background_runner = base::CreateTaskRunnerWithTraits( + {base::TaskPriority::BEST_EFFORT, base::MayBlock()}); + content::BrowserThread::PostAfterStartupTask( + FROM_HERE, background_runner, base::BindOnce(&LoadSTHsFromDisk, GetInstalledPath(GetInstallDir()), base::SequencedTaskRunnerHandle::Get(), base::BindRepeating(OnSTHLoaded)));
diff --git a/chrome/browser/component_updater/sth_set_component_installer_unittest.cc b/chrome/browser/component_updater/sth_set_component_installer_unittest.cc index 7bb1180..80911869 100644 --- a/chrome/browser/component_updater/sth_set_component_installer_unittest.cc +++ b/chrome/browser/component_updater/sth_set_component_installer_unittest.cc
@@ -17,7 +17,6 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "base/version.h" -#include "chrome/browser/after_startup_task_utils.h" #include "components/certificate_transparency/sth_observer.h" #include "components/certificate_transparency/sth_reporter.h" #include "content/public/test/test_browser_thread_bundle.h" @@ -43,8 +42,6 @@ public: STHSetComponentInstallerTest() : network_service_(std::make_unique<network::NetworkService>(nullptr)) { - AfterStartupTaskUtils::SetBrowserStartupIsCompleteForTesting(); - network_service_->sth_reporter()->RegisterObserver(&observer_); }
diff --git a/chrome/browser/conflicts/module_database_win.cc b/chrome/browser/conflicts/module_database_win.cc index 405f9b2..c474dd02 100644 --- a/chrome/browser/conflicts/module_database_win.cc +++ b/chrome/browser/conflicts/module_database_win.cc
@@ -122,11 +122,20 @@ // static scoped_refptr<base::SequencedTaskRunner> ModuleDatabase::GetTaskRunner() { - static base::LazySequencedTaskRunner g_task_runner = + static constexpr base::Feature kDistinctModuleDatabaseSequence{ + "DistinctModuleDatabaseSequence", base::FEATURE_DISABLED_BY_DEFAULT}; + + static base::LazySequencedTaskRunner g_ui_task_runner = LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER( base::TaskTraits(content::BrowserThread::UI)); + static base::LazySequencedTaskRunner g_distinct_task_runner = + LAZY_SEQUENCED_TASK_RUNNER_INITIALIZER( + base::TaskTraits(base::TaskPriority::BEST_EFFORT, + base::TaskShutdownBehavior::BLOCK_SHUTDOWN)); - return g_task_runner.Get(); + return base::FeatureList::IsEnabled(kDistinctModuleDatabaseSequence) + ? g_distinct_task_runner.Get() + : g_ui_task_runner.Get(); } // static
diff --git a/chrome/browser/conflicts/module_inspector_win.cc b/chrome/browser/conflicts/module_inspector_win.cc index 0bdfd9a..b8077f6 100644 --- a/chrome/browser/conflicts/module_inspector_win.cc +++ b/chrome/browser/conflicts/module_inspector_win.cc
@@ -13,10 +13,10 @@ #include "base/task_runner_util.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" -#include "chrome/browser/after_startup_task_utils.h" #include "chrome/browser/conflicts/module_info_util_win.h" #include "chrome/common/chrome_paths.h" #include "chrome/services/util_win/public/mojom/constants.mojom.h" +#include "content/public/browser/browser_thread.h" #include "content/public/common/service_manager_connection.h" #include "services/service_manager/public/cpp/connector.h" @@ -97,8 +97,8 @@ base::FeatureList::IsEnabled(kDisableBackgroundModuleInspection)), test_connector_(nullptr), weak_ptr_factory_(this) { - // Use AfterStartupTaskUtils to be notified when startup is finished. - AfterStartupTaskUtils::PostTask( + // Use PostAfterStartupTask to be notified when startup is finished. + content::BrowserThread::PostAfterStartupTask( FROM_HERE, base::SequencedTaskRunnerHandle::Get(), base::BindOnce(&ModuleInspector::OnStartupFinished, weak_ptr_factory_.GetWeakPtr()));
diff --git a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc index ac69ad7..951c93d6 100644 --- a/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc
@@ -535,13 +535,12 @@ // Legacy, persisted exception for CONTENT_SETTINGS_TYPE_PLUGINS with a // non-empty pattern, and non-empty resource identifier. - ResourceIdentifier res_id("abcde"); - ASSERT_TRUE(SetLegacyPersistedPluginSetting(&prefs, pattern, wildcard, res_id, - value->DeepCopy())); + ASSERT_TRUE(SetLegacyPersistedPluginSetting( + &prefs, pattern, wildcard, ResourceIdentifier(), value->DeepCopy())); - // Same with an empty pattern and non-empty resource identifier. - ASSERT_TRUE(SetLegacyPersistedPluginSetting(&prefs, wildcard, wildcard, - res_id, value->DeepCopy())); + // Non-empty pattern, plugins, empty resource identifier. + provider.SetWebsiteSetting(pattern, wildcard, CONTENT_SETTINGS_TYPE_PLUGINS, + ResourceIdentifier(), value->DeepCopy()); #endif // Non-empty pattern, syncable, empty resource identifier.
diff --git a/chrome/browser/drive/drive_notification_manager_factory.cc b/chrome/browser/drive/drive_notification_manager_factory.cc index a4ffda5c..ce59af4 100644 --- a/chrome/browser/drive/drive_notification_manager_factory.cc +++ b/chrome/browser/drive/drive_notification_manager_factory.cc
@@ -8,10 +8,10 @@ #include "chrome/browser/invalidation/deprecated_profile_invalidation_provider_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service_factory.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/drive/drive_notification_manager.h" #include "components/invalidation/impl/profile_invalidation_provider.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "components/sync/driver/sync_driver_switches.h" namespace drive {
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc index 457b6ff..c6547aca 100644 --- a/chrome/browser/extensions/active_tab_unittest.cc +++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -61,7 +61,7 @@ #include "chromeos/constants/chromeos_switches.h" #include "chromeos/login/login_state/scoped_test_public_session_login_state.h" #include "components/account_id/account_id.h" -#include "components/browser_sync/browser_sync_switches.h" +#include "components/sync/driver/sync_driver_switches.h" #include "extensions/browser/extension_dialog_auto_confirm.h" #endif
diff --git a/chrome/browser/extensions/api/gcm/gcm_apitest.cc b/chrome/browser/extensions/api/gcm/gcm_apitest.cc index 651da3a..1357ae0 100644 --- a/chrome/browser/extensions/api/gcm/gcm_apitest.cc +++ b/chrome/browser/extensions/api/gcm/gcm_apitest.cc
@@ -12,8 +12,8 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/gcm_driver/fake_gcm_profile_service.h" +#include "components/sync/driver/sync_driver_switches.h" #include "extensions/test/result_catcher.h" using extensions::ResultCatcher;
diff --git a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc index 5cd12d5..8c33f17 100644 --- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc +++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -25,7 +25,6 @@ #include "content/public/browser/browser_thread.h" #include "extensions/common/constants.h" #include "extensions/common/url_pattern.h" -#include "net/url_request/url_request_context_getter.h" #include "remoting/host/it2me/it2me_native_messaging_host_chromeos.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" @@ -96,7 +95,6 @@ std::unique_ptr<NativeMessageHost> CreateIt2MeHost() { return remoting::CreateIt2MeNativeMessagingHostForChromeOS( - g_browser_process->system_request_context(), base::CreateSingleThreadTaskRunnerWithTraits( {content::BrowserThread::IO}), base::CreateSingleThreadTaskRunnerWithTraits(
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index e26c3be6..78119d4 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -1563,6 +1563,17 @@ web_socket.reset(); } +// Tests that a clean close from the server is not reported as an error when +// there is a race between OnDropChannel and SendFrame. +// Regression test for https://crbug.com/937790. +IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebSocketCleanClose) { + ASSERT_TRUE(StartEmbeddedTestServer()); + ASSERT_TRUE(StartWebSocketServer(net::GetWebSocketTestDataDirectory())); + ASSERT_TRUE( + RunExtensionSubtest("webrequest", "test_websocket_clean_close.html")) + << message_; +} + // Test behavior when intercepting requests from a browser-initiated url fetch. IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestURLLoaderInterception) {
diff --git a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc index 056ad2f..6be9131 100644 --- a/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc +++ b/chrome/browser/extensions/external_provider_impl_chromeos_unittest.cc
@@ -27,8 +27,8 @@ #include "chrome/test/base/testing_profile.h" #include "chromeos/system/fake_statistics_provider.h" #include "chromeos/system/statistics_provider.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/sync/base/pref_names.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/model/fake_sync_change_processor.h" #include "components/sync/model/sync_change_processor.h" #include "components/sync/model/sync_error_factory_mock.h"
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 3452bd0..3bd2395 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -194,7 +194,7 @@ }, { "name": "autofill-dropdown-layout", - // "owners": [ "your-team" ], + "owners": [ "tmartino" ], "expiry_milestone": 76 }, { @@ -591,11 +591,6 @@ "expiry_milestone": 76 }, { - "name": "disable-pull-to-refresh-effect", - // "owners": [ "your-team" ], - "expiry_milestone": 76 - }, - { // See https://crbug.com/882238. "name": "disable-pushstate-throttle", "owners": [ "arthursonzogni@chromium.org", "palmer@chromium.org" ], @@ -949,8 +944,8 @@ }, { "name": "enable-chrome-duet", - // "owners": [ "your-team" ], - "expiry_milestone": 76 + "owners": [ "mdjones" ], + "expiry_milestone": 79 }, { "name": "enable-chromeos-account-manager", @@ -993,6 +988,11 @@ "expiry_milestone": 76 }, { + "name": "enable-cros-ime-input-logic-fst", + "owners": [ "essential-inputs-team@google.com" ], + "expiry_milestone": 77 + }, + { "name": "enable-cros-ime-service", "owners": [ "essential-inputs-team@google.com" ], "expiry_milestone": 76 @@ -1432,11 +1432,6 @@ "expiry_milestone": 78 }, { - "name": "enable-ntp-offline-page-download-suggestions", - "owners": [ "fgorski" ], - "expiry_milestone": 76 - }, - { "name": "enable-ntp-remote-suggestions", "owners": [ "fgorski" ], "expiry_milestone": 76 @@ -1812,8 +1807,8 @@ }, { "name": "enable-usbguard", - // "owners": [ "your-team" ], - "expiry_milestone": 76 + "owners": [ "allenwebb", "mnissler", "jorgelo" ], + "expiry_milestone": 80 }, { "name": "enable-use-zoom-for-dsf", @@ -2057,6 +2052,11 @@ "expiry_milestone": 76 }, { + "name": "file-manager-feedback-panel", + "owners": [ "adanilo" ], + "expiry_milestone": 77 + }, + { "name": "fill-on-account-select", "owners": [ "jdoerrie" ], "expiry_milestone": 76
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 91926ea1..5eea2de 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2337,12 +2337,6 @@ "Enables a revamped context menu when a link, image, or video is long " "pressed within Chrome."; -const char kEnableNtpOfflinePageDownloadSuggestionsName[] = - "Show offline page downloads on the New Tab page"; -const char kEnableNtpOfflinePageDownloadSuggestionsDescription[] = - "If enabled, the list of content suggestions on the New Tab page will " - "contain pages that the user downloaded for later use."; - const char kEnableNtpRemoteSuggestionsName[] = "Show server-side suggestions on the New Tab page"; const char kEnableNtpRemoteSuggestionsDescription[] = @@ -2542,10 +2536,6 @@ const char kProgressBarThrottleDescription[] = "Limit the maximum progress update to make progress appear smoother."; -const char kPullToRefreshEffectName[] = "The pull-to-refresh effect"; -const char kPullToRefreshEffectDescription[] = - "Page reloads triggered by vertically overscrolling content."; - const char kPwaImprovedSplashScreenName[] = "Improved Splash Screen for standalone PWAs"; const char kPwaImprovedSplashScreenDescription[] = @@ -3205,6 +3195,10 @@ "Enable ChromeVox rich text indication, which automatically notifies the " "user of text styling."; +const char kFileManagerFeedbackPanelDescription[] = + "Enable new feedback panel in the Files app."; +const char kFileManagerFeedbackPanelName[] = "Files App. feedback panel"; + const char kFileManagerTouchModeName[] = "Files App. touch mode"; const char kFileManagerTouchModeDescription[] = "Touchscreen-specific interactions of the Files app."; @@ -3231,6 +3225,10 @@ "Enable/Disable gesture typing option in the settings page for the virtual " "keyboard."; +const char kImeInputLogicFstName[] = "Enable FST Input Logic on IME"; +const char kImeInputLogicFstDescription[] = + "Enable FST Input Logic to replace the IME legacy input logic on NaCl"; + const char kImeServiceName[] = "Enable IME service"; const char kImeServiceDescription[] = "Enable IME service to provide the IME functionality instead of NaCl"; @@ -3510,9 +3508,6 @@ #endif // defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_CHROMEOS) -const char kExperimentalUiName[] = "Use all upcoming UI features"; -const char kExperimentalUiDescription[] = "Use all upcoming UI features."; - // Feature flags -------------------------------------------------------------- #if defined(DCHECK_IS_CONFIGURABLE)
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index cd22b23..b1c0fd2 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1401,9 +1401,6 @@ extern const char kEnableRevampedContextMenuName[]; extern const char kEnableRevampedContextMenuDescription[]; -extern const char kEnableNtpOfflinePageDownloadSuggestionsName[]; -extern const char kEnableNtpOfflinePageDownloadSuggestionsDescription[]; - extern const char kEnableNtpRemoteSuggestionsName[]; extern const char kEnableNtpRemoteSuggestionsDescription[]; @@ -1518,9 +1515,6 @@ extern const char kProgressBarThrottleName[]; extern const char kProgressBarThrottleDescription[]; -extern const char kPullToRefreshEffectName[]; -extern const char kPullToRefreshEffectDescription[]; - extern const char kPwaImprovedSplashScreenName[]; extern const char kPwaImprovedSplashScreenDescription[]; extern const char kPwaPersistentNotificationName[]; @@ -1937,6 +1931,9 @@ extern const char kExperimentalAccessibilityChromeVoxRichTextIndicationDescription[]; +extern const char kFileManagerFeedbackPanelDescription[]; +extern const char kFileManagerFeedbackPanelName[]; + extern const char kFileManagerTouchModeName[]; extern const char kFileManagerTouchModeDescription[]; @@ -1952,6 +1949,9 @@ extern const char kGestureTypingName[]; extern const char kGestureTypingDescription[]; +extern const char kImeInputLogicFstName[]; +extern const char kImeInputLogicFstDescription[]; + extern const char kImeServiceName[]; extern const char kImeServiceDescription[];
diff --git a/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc b/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc index 106b351..e94a07f 100644 --- a/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc +++ b/chrome/browser/metrics/process_memory_metrics_emitter_browsertest.cc
@@ -776,8 +776,9 @@ } // Test is flaky on chromeos and linux. https://crbug.com/938054. +// Test is flaky on mac: https://crbug.com/948674. #if defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER) || \ - defined(OS_CHROMEOS) || defined(OS_LINUX) + defined(OS_CHROMEOS) || defined(OS_LINUX) || defined(OS_MACOSX) #define MAYBE_ForegroundAndBackgroundPages DISABLED_ForegroundAndBackgroundPages #else #define MAYBE_ForegroundAndBackgroundPages ForegroundAndBackgroundPages
diff --git a/chrome/browser/metrics/ukm_browsertest.cc b/chrome/browser/metrics/ukm_browsertest.cc index fee542cf..a893c3c1 100644 --- a/chrome/browser/metrics/ukm_browsertest.cc +++ b/chrome/browser/metrics/ukm_browsertest.cc
@@ -30,8 +30,8 @@ #include "chrome/browser/unified_consent/unified_consent_service_factory.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/metrics_services_manager/metrics_services_manager.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_token_status.h" @@ -128,7 +128,7 @@ class SyncConnectionOkChecker : public SingleClientStatusChangeChecker { public: - explicit SyncConnectionOkChecker(browser_sync::ProfileSyncService* service) + explicit SyncConnectionOkChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} bool IsExitConditionSatisfied() override { @@ -398,7 +398,7 @@ class UkmEnabledChecker : public SingleClientStatusChangeChecker { public: UkmEnabledChecker(UkmBrowserTestBase* test, - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, bool want_enabled) : SingleClientStatusChangeChecker(service), test_(test),
diff --git a/chrome/browser/notifications/notification_trigger_scheduler.cc b/chrome/browser/notifications/notification_trigger_scheduler.cc index 54b4d21d..b0c257a4 100644 --- a/chrome/browser/notifications/notification_trigger_scheduler.cc +++ b/chrome/browser/notifications/notification_trigger_scheduler.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/notifications/platform_notification_service_impl.h" #include "chrome/browser/profiles/profile.h" @@ -15,6 +16,10 @@ #include "content/public/browser/platform_notification_context.h" #include "content/public/browser/storage_partition.h" +#if defined(OS_ANDROID) +#include "chrome/browser/notifications/notification_trigger_scheduler_android.h" +#endif + using content::BrowserContext; using content::BrowserThread; @@ -52,7 +57,11 @@ // static std::unique_ptr<NotificationTriggerScheduler> NotificationTriggerScheduler::Create() { +#if defined(OS_ANDROID) + return base::WrapUnique(new NotificationTriggerSchedulerAndroid()); +#else return base::WrapUnique(new NotificationTriggerScheduler()); +#endif } // static
diff --git a/chrome/browser/notifications/notification_trigger_scheduler.h b/chrome/browser/notifications/notification_trigger_scheduler.h index c3f8882..f7bbc7ab 100644 --- a/chrome/browser/notifications/notification_trigger_scheduler.h +++ b/chrome/browser/notifications/notification_trigger_scheduler.h
@@ -28,7 +28,7 @@ // StoragePartition of profiles that have pending notifications at that time. // If there is an existing earlier trigger set, this is a nop. Otherwise this // overwrites the existing trigger so only the earliest is set at any time. - void ScheduleTrigger(base::Time timestamp); + virtual void ScheduleTrigger(base::Time timestamp); // Triggers pending notifications for |partition|. // TODO(knollr): Mock the actual storage partitions to observe this call in
diff --git a/chrome/browser/notifications/notification_trigger_scheduler_android.cc b/chrome/browser/notifications/notification_trigger_scheduler_android.cc new file mode 100644 index 0000000..4b48bccd6 --- /dev/null +++ b/chrome/browser/notifications/notification_trigger_scheduler_android.cc
@@ -0,0 +1,37 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/notifications/notification_trigger_scheduler_android.h" + +#include "chrome/browser/notifications/platform_notification_service_impl.h" +#include "content/public/browser/browser_thread.h" +#include "jni/NotificationTriggerScheduler_jni.h" + +using content::BrowserThread; + +// static +void JNI_NotificationTriggerScheduler_TriggerNotifications(JNIEnv* env) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + NotificationTriggerScheduler::TriggerNotifications(); +} + +NotificationTriggerSchedulerAndroid::NotificationTriggerSchedulerAndroid() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + JNIEnv* env = base::android::AttachCurrentThread(); + + java_notification_trigger_scheduler_.Reset( + Java_NotificationTriggerScheduler_getInstance(env)); +} + +NotificationTriggerSchedulerAndroid::~NotificationTriggerSchedulerAndroid() = + default; + +void NotificationTriggerSchedulerAndroid::ScheduleTrigger( + base::Time timestamp) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + JNIEnv* env = base::android::AttachCurrentThread(); + + Java_NotificationTriggerScheduler_schedule( + env, java_notification_trigger_scheduler_, timestamp.ToJavaTime()); +}
diff --git a/chrome/browser/notifications/notification_trigger_scheduler_android.h b/chrome/browser/notifications/notification_trigger_scheduler_android.h new file mode 100644 index 0000000..63b52a91 --- /dev/null +++ b/chrome/browser/notifications/notification_trigger_scheduler_android.h
@@ -0,0 +1,37 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TRIGGER_SCHEDULER_ANDROID_H_ +#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TRIGGER_SCHEDULER_ANDROID_H_ + +#include "base/android/jni_android.h" +#include "base/lazy_instance.h" +#include "base/macros.h" +#include "base/time/time.h" +#include "chrome/browser/notifications/notification_trigger_scheduler.h" + +// This class is used to schedule tasks on Android that wake up Chrome and call +// NotificationTriggerScheduler::TriggerNotifications to trigger all pending +// notifications. All methods are expected to be called on the UI thread. +class NotificationTriggerSchedulerAndroid + : public NotificationTriggerScheduler { + public: + ~NotificationTriggerSchedulerAndroid() override; + + // NotificationTriggerScheduler + void ScheduleTrigger(base::Time timestamp) override; + + protected: + NotificationTriggerSchedulerAndroid(); + + private: + friend class NotificationTriggerScheduler; + + base::android::ScopedJavaGlobalRef<jobject> + java_notification_trigger_scheduler_; + + DISALLOW_COPY_AND_ASSIGN(NotificationTriggerSchedulerAndroid); +}; + +#endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_TRIGGER_SCHEDULER_ANDROID_H_
diff --git a/chrome/browser/ntp_snippets/dependent_features.cc b/chrome/browser/ntp_snippets/dependent_features.cc index 571d5ffb..0c5a790 100644 --- a/chrome/browser/ntp_snippets/dependent_features.cc +++ b/chrome/browser/ntp_snippets/dependent_features.cc
@@ -25,9 +25,7 @@ } bool AreOfflinePageDownloadsEnabled() { - return !IsSimplifiedNtpEnabled() && - base::FeatureList::IsEnabled( - features::kOfflinePageDownloadSuggestionsFeature); + return !IsSimplifiedNtpEnabled(); } bool IsDownloadsProviderEnabled() { return AreAssetDownloadsEnabled() || AreOfflinePageDownloadsEnabled();
diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc index 341c88a..2b59b08 100644 --- a/chrome/browser/password_manager/chrome_password_manager_client.cc +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
@@ -418,7 +418,6 @@ const GURL& origin, const std::vector<const PasswordForm*>* federated_matches) const { #if defined(OS_ANDROID) - // Either #passwords-keyboards-accessory or #experimental-ui must be enabled. if (!PasswordAccessoryController::AllowedForWebContents(web_contents())) { return; // No need to even create the bridge if it's not going to be used. } @@ -662,7 +661,6 @@ CPMD_BAD_ORIGIN_AUTOMATIC_GENERATION_STATUS_CHANGED)) return; #if defined(OS_ANDROID) - // Either #passwords-keyboards-accessory or #experimental-ui must be enabled. if (PasswordGenerationController::AllowedForWebContents(web_contents())) { if (available) { password_manager::PasswordManagerDriver* driver = @@ -998,7 +996,6 @@ bool is_fillable, bool is_password_field) { #if defined(OS_ANDROID) - // Either #passwords-keyboards-accessory or #experimental-ui must be enabled. if (PasswordAccessoryController::AllowedForWebContents(web_contents())) { PasswordAccessoryController::GetOrCreate(web_contents()) ->RefreshSuggestionsForField(last_committed_origin, is_fillable,
diff --git a/chrome/browser/password_manager/password_accessory_controller_impl.cc b/chrome/browser/password_manager/password_accessory_controller_impl.cc index 422874f6..b793a9d 100644 --- a/chrome/browser/password_manager/password_accessory_controller_impl.cc +++ b/chrome/browser/password_manager/password_accessory_controller_impl.cc
@@ -44,7 +44,6 @@ if (vr::VrTabHelper::IsInVr(web_contents)) { return false; // TODO(crbug.com/865749): Reenable if works for VR keyboard. } - // Either #passwords-keyboards-accessory or #experimental-ui must be enabled. return base::FeatureList::IsEnabled( password_manager::features::kPasswordsKeyboardAccessory); }
diff --git a/chrome/browser/password_manager/password_manager_test_base.cc b/chrome/browser/password_manager/password_manager_test_base.cc index 728b556..18912a4 100644 --- a/chrome/browser/password_manager/password_manager_test_base.cc +++ b/chrome/browser/password_manager/password_manager_test_base.cc
@@ -501,8 +501,7 @@ PasswordStoreFactory::GetForProfile(browser->profile(), ServiceAccessType::IMPLICIT_ACCESS); PasswordStoreResultsObserver syncer; - password_store->GetAutofillableLoginsWithAffiliationAndBrandingInformation( - &syncer); + password_store->GetAllLoginsWithAffiliationAndBrandingInformation(&syncer); syncer.Wait(); }
diff --git a/chrome/browser/password_manager/password_store_mac_unittest.cc b/chrome/browser/password_manager/password_store_mac_unittest.cc index b8a74d58..7fdd6d67 100644 --- a/chrome/browser/password_manager/password_store_mac_unittest.cc +++ b/chrome/browser/password_manager/password_store_mac_unittest.cc
@@ -276,7 +276,7 @@ FinishAsyncProcessing(); EXPECT_THAT(mock_consumer.forms(), IsEmpty()); - store()->GetBlacklistLogins(&mock_consumer); + store()->GetAllLogins(&mock_consumer); FinishAsyncProcessing(); EXPECT_THAT(mock_consumer.forms(), IsEmpty());
diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc index f34a00c..a13873578 100644 --- a/chrome/browser/password_manager/password_store_x.cc +++ b/chrome/browser/password_manager/password_store_x.cc
@@ -307,13 +307,6 @@ return std::vector<std::unique_ptr<PasswordForm>>(); } -std::vector<std::unique_ptr<PasswordForm>> -PasswordStoreX::FillLoginsForSameOrganizationName( - const std::string& signon_realm) { - // Not available on X. - return std::vector<std::unique_ptr<PasswordForm>>(); -} - bool PasswordStoreX::FillAutofillableLogins( std::vector<std::unique_ptr<PasswordForm>>* forms) { CheckMigration();
diff --git a/chrome/browser/password_manager/password_store_x.h b/chrome/browser/password_manager/password_store_x.h index a783fef..6dc58132 100644 --- a/chrome/browser/password_manager/password_store_x.h +++ b/chrome/browser/password_manager/password_store_x.h
@@ -174,8 +174,6 @@ const base::Callback<bool(const GURL&)>& origin_filter) override; std::vector<std::unique_ptr<autofill::PasswordForm>> FillMatchingLogins( const FormDigest& form) override; - std::vector<std::unique_ptr<autofill::PasswordForm>> - FillLoginsForSameOrganizationName(const std::string& signon_realm) override; bool FillAutofillableLogins( std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) override; bool FillBlacklistLogins(
diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc index 696a6d8f..945d39e 100644 --- a/chrome/browser/password_manager/password_store_x_unittest.cc +++ b/chrome/browser/password_manager/password_store_x_unittest.cc
@@ -273,14 +273,15 @@ }; void LoginDatabaseQueryCallback(password_manager::LoginDatabase* login_db, - bool autofillable, MockLoginDatabaseReturn* mock_return) { - std::vector<std::unique_ptr<PasswordForm>> forms; - if (autofillable) - EXPECT_TRUE(login_db->GetAutofillableLogins(&forms)); - else - EXPECT_TRUE(login_db->GetBlacklistLogins(&forms)); - mock_return->OnLoginDatabaseQueryDone(forms); + password_manager::PrimaryKeyToFormMap key_to_form_map; + EXPECT_EQ(password_manager::FormRetrievalResult::kSuccess, + login_db->GetAllLogins(&key_to_form_map)); + std::vector<std::unique_ptr<PasswordForm>> results; + results.reserve(key_to_form_map.size()); + for (auto& key_to_form : key_to_form_map) + results.push_back(std::move(key_to_form.second)); + mock_return->OnLoginDatabaseQueryDone(results); } // Generate |count| expected logins, either auto-fillable or blacklisted. @@ -542,11 +543,9 @@ feature_list.InitAndDisableFeature( password_manager::features::kMigrateLinuxToLoginDB); - std::vector<std::unique_ptr<PasswordForm>> expected_autofillable; - InitExpectedForms(true, 5, &expected_autofillable); - - std::vector<std::unique_ptr<PasswordForm>> expected_blacklisted; - InitExpectedForms(false, 5, &expected_blacklisted); + std::vector<std::unique_ptr<PasswordForm>> expected_forms; + InitExpectedForms(true, 5, &expected_forms); + InitExpectedForms(false, 5, &expected_forms); const base::FilePath login_db_file = test_login_db_file_path(); std::unique_ptr<password_manager::LoginDatabase> login_db( @@ -560,10 +559,7 @@ ASSERT_TRUE(base::GetFileInfo(login_db_file, &db_file_start_info)); // Populate the login DB with logins that should be migrated. - for (const auto& form : expected_autofillable) { - EXPECT_EQ(AddChangeForForm(*form), login_db->AddLogin(*form)); - } - for (const auto& form : expected_blacklisted) { + for (const auto& form : expected_forms) { EXPECT_EQ(AddChangeForForm(*form), login_db->AddLogin(*form)); } @@ -582,50 +578,25 @@ MockPasswordStoreConsumer consumer; - // The autofillable forms should have been migrated to the native backend. - EXPECT_CALL(consumer, - OnGetPasswordStoreResultsConstRef( - UnorderedPasswordFormElementsAre(&expected_autofillable))); - - store->GetAutofillableLogins(&consumer); - WaitForPasswordStore(); - - // The blacklisted forms should have been migrated to the native backend. - EXPECT_CALL(consumer, - OnGetPasswordStoreResultsConstRef( - UnorderedPasswordFormElementsAre(&expected_blacklisted))); - - store->GetBlacklistLogins(&consumer); + // All forms should have been migrated to the native backend. + EXPECT_CALL(consumer, OnGetPasswordStoreResultsConstRef( + UnorderedPasswordFormElementsAre(&expected_forms))); + store->GetAllLogins(&consumer); WaitForPasswordStore(); MockLoginDatabaseReturn ld_return; if (GetParam() == WORKING_BACKEND) { - // No autofillable logins should be left in the login DB. + // No logins should be left in the login DB. EXPECT_CALL(ld_return, OnLoginDatabaseQueryDone(IsEmpty())); } else { - // The autofillable logins should still be in the login DB. + // All logins should still be in the login DB. EXPECT_CALL(ld_return, OnLoginDatabaseQueryDone( - UnorderedPasswordFormElementsAre(&expected_autofillable))); + UnorderedPasswordFormElementsAre(&expected_forms))); } - LoginDatabaseQueryCallback(store->login_db(), true, &ld_return); - - WaitForPasswordStore(); - - if (GetParam() == WORKING_BACKEND) { - // Likewise, no blacklisted logins should be left in the login DB. - EXPECT_CALL(ld_return, OnLoginDatabaseQueryDone(IsEmpty())); - } else { - // The blacklisted logins should still be in the login DB. - EXPECT_CALL(ld_return, - OnLoginDatabaseQueryDone( - UnorderedPasswordFormElementsAre(&expected_blacklisted))); - } - - LoginDatabaseQueryCallback(store->login_db(), false, &ld_return); - + LoginDatabaseQueryCallback(store->login_db(), &ld_return); WaitForPasswordStore(); if (GetParam() == WORKING_BACKEND) {
diff --git a/chrome/browser/plugins/plugin_info_host_impl_unittest.cc b/chrome/browser/plugins/plugin_info_host_impl_unittest.cc index fa754772..f5eabe4 100644 --- a/chrome/browser/plugins/plugin_info_host_impl_unittest.cc +++ b/chrome/browser/plugins/plugin_info_host_impl_unittest.cc
@@ -354,37 +354,20 @@ host, GURL(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string(), CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - // Allow plugin "foo" on all sites. - map->SetContentSettingCustomScope( - ContentSettingsPattern::Wildcard(), ContentSettingsPattern::Wildcard(), - CONTENT_SETTINGS_TYPE_PLUGINS, "foo", CONTENT_SETTING_ALLOW); - GURL unmatched_host("https://www.google.com"); - ASSERT_EQ( + EXPECT_EQ( CONTENT_SETTING_BLOCK, map->GetContentSetting(unmatched_host, unmatched_host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); - ASSERT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, + EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, map->GetContentSetting(host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string())); - ASSERT_EQ( - CONTENT_SETTING_ALLOW, - map->GetContentSetting(host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "foo")); - ASSERT_EQ( - CONTENT_SETTING_DEFAULT, - map->GetContentSetting(host, host, CONTENT_SETTINGS_TYPE_PLUGINS, "bar")); - // "foo" is allowed everywhere. - VerifyPluginContentSetting(host, "foo", CONTENT_SETTING_ALLOW, false, false); - - // There is no specific content setting for "bar", so the general setting - // for example.com applies. - VerifyPluginContentSetting( - host, "bar", CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, false, false); - - // Otherwise, use the default. - VerifyPluginContentSetting(unmatched_host, "bar", CONTENT_SETTING_BLOCK, true, + VerifyPluginContentSetting(host, std::string(), + CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, false, false); + VerifyPluginContentSetting(unmatched_host, std::string(), + CONTENT_SETTING_BLOCK, false, false); // Block plugins via policy. sync_preferences::TestingPrefServiceSyncable* prefs = @@ -393,10 +376,10 @@ std::make_unique<base::Value>(CONTENT_SETTING_BLOCK)); // All plugins should be blocked now. - VerifyPluginContentSetting(host, "foo", CONTENT_SETTING_BLOCK, true, true); - VerifyPluginContentSetting(host, "bar", CONTENT_SETTING_BLOCK, true, true); - VerifyPluginContentSetting(unmatched_host, "bar", CONTENT_SETTING_BLOCK, true, + VerifyPluginContentSetting(host, std::string(), CONTENT_SETTING_BLOCK, true, true); + VerifyPluginContentSetting(unmatched_host, std::string(), + CONTENT_SETTING_BLOCK, true, true); { bool is_managed = false; EXPECT_EQ(
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index 59ec781..757722fb 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc
@@ -16,7 +16,6 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/common/buildflags.h" #include "chrome/common/pref_names.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/language/core/browser/pref_names.h" @@ -24,6 +23,7 @@ #include "components/prefs/pref_service.h" #include "components/safe_browsing/common/safe_browsing_prefs.h" #include "components/sync/base/sync_prefs.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_service.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h"
diff --git a/chrome/browser/resource_coordinator/tab_manager_browsertest.cc b/chrome/browser/resource_coordinator/tab_manager_browsertest.cc index 180b10b0..5c31a1a 100644 --- a/chrome/browser/resource_coordinator/tab_manager_browsertest.cc +++ b/chrome/browser/resource_coordinator/tab_manager_browsertest.cc
@@ -1495,8 +1495,10 @@ } // namespace -// Flaky on Linux. Times out on Windows debug builds. http://crbug.com/772839. -#if defined(OS_LINUX) || (defined(OS_WIN) && !defined(NDEBUG)) +// Flaky on Linux. Times out on Windows and Mac debug builds. +// http://crbug.com/772839. +#if defined(OS_LINUX) || \ + ((defined(OS_WIN) || defined(OS_MACOSX)) && !defined(NDEBUG)) #define MAYBE_DiscardTabsWithMinimizedAndOccludedWindows \ DISABLED_DiscardTabsWithMinimizedAndOccludedWindows #else
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js index d8710ec0..a6aff45 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js
@@ -618,6 +618,10 @@ */ AutomationPredicate.autoScrollable = function(node) { return !!node.scrollable && + (node.standardActions.includes( + chrome.automation.ActionType.SCROLL_FORWARD) || + node.standardActions.includes( + chrome.automation.ActionType.SCROLL_BACKWARD)) && (node.role == Role.GRID || node.role == Role.LIST || node.role == Role.POP_UP_BUTTON || node.role == Role.SCROLL_VIEW); };
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js index c2b87c3..cad8e2e 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -464,12 +464,13 @@ $if($inPageLinkTarget, @internal_link, $role) $description`, }, list: { - enter: `$role @@list_with_items($setSize)`, + enter: `$role @@list_with_items($countChildren(listItem))`, speak: `$nameFromNode $descendants $role - @@list_with_items($setSize) $description $state` + @@list_with_items($countChildren(listItem)) $description $state` }, listBox: { - enter: `$nameFromNode $role @@list_with_items($setSize) + enter: `$nameFromNode + $role @@list_with_items($countChildren(listBoxOption)) $restriction $description` }, listBoxOption: { @@ -484,23 +485,29 @@ menu: { enter: `$name $role `, speak: `$name $node(activeDescendant) - $role @@list_with_items($setSize) $description $state $restriction` + $role @@list_with_items( + $countChildren(menuItem, menuItemCheckBox, menuItemRadio)) + $description $state $restriction` }, menuItem: { speak: `$name $role $if($hasPopup, @has_submenu) - @describe_index($posInSet, $setSize) $description $state $restriction` + @describe_index($if($posInSet, $posInSet, $indexInParent(menuItem, menuItemCheckBox, menuItemRadio)), + $if($setSize, $setSize, $parentChildCount(menuItem, menuItemCheckBox, menuItemRadio))) + $description $state $restriction` }, menuItemCheckBox: { speak: `$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) $name $role $checked $state $restriction $description - @describe_index($posInSet, $setSize)` + @describe_index($if($posInSet, $posInSet, $indexInParent(menuItem, menuItemCheckBox, menuItemRadio)), + $if($setSize, $setSize, $parentChildCount(menuItem, menuItemCheckBox, menuItemRadio))) ` }, menuItemRadio: { speak: `$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) $if($checked, @describe_radio_selected($name), @describe_radio_unselected($name)) $state $roleDescription $restriction $description - @describe_index($posInSet, $setSize)` + @describe_index($if($posInSet, $posInSet, $indexInParent(menuItem, menuItemCheckBox, menuItemRadio)), + $if($setSize, $setSize, $parentChildCount(menuItem, menuItemCheckBox, menuItemRadio))) ` }, menuListOption: { speak: `$name $role @describe_index($posInSet, $setSize) $state @@ -571,7 +578,10 @@ $name $role $pressed $description $state $restriction` }, toolbar: {enter: `$name $role $description $restriction`}, - tree: {enter: `$name $role @@list_with_items($setSize) $restriction`}, + tree: { + enter: `$name $role @@list_with_items($countChildren(treeItem)) + $restriction` + }, treeItem: { enter: `$role $expanded $collapsed $restriction @describe_index($posInSet, $setSize) @@ -1311,6 +1321,25 @@ this.append_(buff, String(count)); ruleStr.writeTokenWithValue(token, String(count)); } + } else if (token == 'parentChildCount') { + if (node.parent) { + options.annotation.push(token); + var roles; + if (tree.firstChild) { + roles = this.createRoles_(tree); + } else { + roles = new Set(); + roles.add(node.role); + } + + var count = node.parent.children + .filter(function(child) { + return roles.has(child.role); + }) + .length; + this.append_(buff, String(count)); + ruleStr.writeTokenWithValue(token, String(count)); + } } else if (token == 'restriction') { var msg = Output.RESTRICTION_STATE_MAP[node.restriction]; if (msg) { @@ -1561,9 +1590,13 @@ this.format_(node, '$indexInParent', buff, ruleStr); } } else if (token == 'setSize') { - var size = node.setSize ? node.setSize : 0; - this.append_(buff, String(size)); - ruleStr.writeTokenWithValue(token, String(node.setSize)); + if (node.setSize !== undefined) { + this.append_(buff, String(node.setSize)); + ruleStr.writeTokenWithValue(token, String(node.setSize)); + } else { + ruleStr.writeToken(token); + this.format_(node, '$parentChildCount', buff, ruleStr); + } } else if (tree.firstChild) { // Custom functions. if (token == 'if') { @@ -1597,6 +1630,16 @@ tree.firstChild.value, node.location || undefined)); this.append_(buff, '', options); ruleStr.writeTokenWithValue(token, tree.firstChild.value); + } else if (token == 'countChildren') { + var roles = this.createRoles_(tree); + + var count = node.children + .filter(function(e) { + return roles.has(e.role); + }) + .length; + this.append_(buff, String(count)); + ruleStr.writeTokenWithValue(token, String(count)); } } } else if (prefix == '@') {
diff --git a/chrome/browser/resources/chromeos/kiosk_next_home/api.js b/chrome/browser/resources/chromeos/kiosk_next_home/api.js index 8c11f80..c1532795 100644 --- a/chrome/browser/resources/chromeos/kiosk_next_home/api.js +++ b/chrome/browser/resources/chromeos/kiosk_next_home/api.js
@@ -73,10 +73,11 @@ launchHomeUrl(suffix) {} /** - * Uninstalls an app. + * Shows a prompt to uninstall the app with the given appId. + * + * We will notify listeners when the app is uninstalled through a readiness + * state change. * @param {string} appId App to uninstall. - * @return {!Promise} Resolves when app is uninstalled, or rejects in case of - * failures. */ uninstallApp(appId) {}
diff --git a/chrome/browser/resources/chromeos/kiosk_next_home/api_impl.js b/chrome/browser/resources/chromeos/kiosk_next_home/api_impl.js index e593759..f3760d1 100644 --- a/chrome/browser/resources/chromeos/kiosk_next_home/api_impl.js +++ b/chrome/browser/resources/chromeos/kiosk_next_home/api_impl.js
@@ -164,8 +164,7 @@ /** @override */ uninstallApp(appId) { - // TODO(brunoad): Implement this method. - return Promise.reject('Not implemented.'); + this.appControllerProxy_.uninstallApp(appId); } /** @override */
diff --git a/chrome/browser/resources/chromeos/login/images/user_image.svg b/chrome/browser/resources/chromeos/login/images/user_image.svg deleted file mode 100644 index f631ec30..0000000 --- a/chrome/browser/resources/chromeos/login/images/user_image.svg +++ /dev/null
@@ -1 +0,0 @@ -<svg width="64" height="64" viewBox="0 0 24 24" fill="#4285f4" xmlns="http://www.w3.org/2000/svg"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/><path d="M0 0h24v24H0z" fill="none"/></svg>
diff --git a/chrome/browser/resources/chromeos/login/md_login.html b/chrome/browser/resources/chromeos/login/md_login.html index 0dd88ffa..1a21ec7 100644 --- a/chrome/browser/resources/chromeos/login/md_login.html +++ b/chrome/browser/resources/chromeos/login/md_login.html
@@ -58,7 +58,6 @@ <link rel="stylesheet" href="oobe_screen_enable_kiosk.css"> <link rel="stylesheet" href="oobe_screen_terms_of_service.css"> <link rel="stylesheet" href="oobe_screen_auto_enrollment_check.css"> -<link rel="stylesheet" href="oobe_screen_user_image.css"> <link rel="stylesheet" href="oobe_screen_supervision_transition.css"> <link rel="stylesheet" href="screen_app_launch_splash.css"> <link rel="stylesheet" href="screen_arc_kiosk_splash.css">
diff --git a/chrome/browser/resources/chromeos/login/md_login.js b/chrome/browser/resources/chromeos/login/md_login.js index c896cb2..3cc6a711 100644 --- a/chrome/browser/resources/chromeos/login/md_login.js +++ b/chrome/browser/resources/chromeos/login/md_login.js
@@ -24,7 +24,6 @@ // <include src="oobe_screen_autolaunch.js"> // <include src="oobe_screen_enable_kiosk.js"> // <include src="oobe_screen_terms_of_service.js"> -// <include src="oobe_screen_user_image.js"> // <include src="oobe_screen_supervision_transition.js"> // <include src="oobe_screen_assistant_optin_flow.js"> // <include src="oobe_select.js"> @@ -77,7 +76,6 @@ login.WrongHWIDScreen.register(); login.AccountPickerScreen.register(); login.GaiaSigninScreen.register(); - login.UserImageScreen.register(/* lazyInit= */ true); login.ResetScreen.register(); login.AutolaunchScreen.register(); login.KioskEnableScreen.register();
diff --git a/chrome/browser/resources/chromeos/login/md_login_screens.html b/chrome/browser/resources/chromeos/login/md_login_screens.html index 12dc1abc..e12f206 100644 --- a/chrome/browser/resources/chromeos/login/md_login_screens.html +++ b/chrome/browser/resources/chromeos/login/md_login_screens.html
@@ -2,7 +2,6 @@ <include src="oobe_screen_autolaunch.html"> <include src="oobe_screen_enable_kiosk.html"> <include src="oobe_screen_terms_of_service.html"> -<include src="oobe_screen_user_image.html"> <include src="oobe_screen_supervision_transition.html"> <include src="oobe_screen_assistant_optin_flow.html"> <include src="../../../../../ui/login/account_picker/chromeos_screen_account_picker.html">
diff --git a/chrome/browser/resources/chromeos/login/oobe.html b/chrome/browser/resources/chromeos/login/oobe.html index 31f0ff8..6e79cbb 100644 --- a/chrome/browser/resources/chromeos/login/oobe.html +++ b/chrome/browser/resources/chromeos/login/oobe.html
@@ -63,7 +63,6 @@ <link rel="stylesheet" href="oobe_screen_enable_kiosk.css"> <link rel="stylesheet" href="oobe_screen_terms_of_service.css"> <link rel="stylesheet" href="oobe_screen_auto_enrollment_check.css"> -<link rel="stylesheet" href="oobe_screen_user_image.css"> <link rel="stylesheet" href="oobe_screen_supervision_transition.css"> <link rel="stylesheet" href="screen_app_launch_splash.css">
diff --git a/chrome/browser/resources/chromeos/login/oobe.js b/chrome/browser/resources/chromeos/login/oobe.js index 55b38819..f5395382 100644 --- a/chrome/browser/resources/chromeos/login/oobe.js +++ b/chrome/browser/resources/chromeos/login/oobe.js
@@ -25,7 +25,6 @@ // <include src="oobe_screen_autolaunch.js"> // <include src="oobe_screen_enable_kiosk.js"> // <include src="oobe_screen_terms_of_service.js"> -// <include src="oobe_screen_user_image.js"> // <include src="oobe_screen_supervision_transition.js"> // <include src="oobe_screen_assistant_optin_flow.js"> // <include src="oobe_select.js"> @@ -110,7 +109,6 @@ login.KioskEnableScreen.register(); login.AccountPickerScreen.register(); login.GaiaSigninScreen.register(); - login.UserImageScreen.register(/* lazyInit= */ false); login.ErrorMessageScreen.register(); login.TPMErrorMessageScreen.register(); login.PasswordChangedScreen.register();
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.css b/chrome/browser/resources/chromeos/login/oobe_screen_user_image.css deleted file mode 100644 index c6e388f..0000000 --- a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.css +++ /dev/null
@@ -1,54 +0,0 @@ -/* Copyright 2013 The Chromium Authors. All rights reserved. - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. */ - -#user-image { - min-height: 640px; - padding-bottom: 24px; - padding-left: 24px; - padding-top: 24px; - width: 768px; -} - -#user-image.loading { - height: 640px; /* Should be the same as #gaia-signin height. */ - padding: 0 0 0; - width: 768px; /* Should be the same as #gaia-signin width. */ -} - -#user-image-screen-curtain { - margin-inline-start: 8px; -} - -#user-image-screen-title { - font-size: 28px; - margin-top: 24px; -} - -#user-image .step-contents { - margin-bottom: 16px; - margin-inline-start: 31px; -} - -.user-image-stream-area .spinner { - display: none; - height: 44px; - left: 50%; - margin-left: -22px; - margin-top: -22px; - position: absolute; - top: 50%; - width: 44px; -} - -#user-image-logo { - height: 32px; - margin-inline-start: 8px; - margin-top: 32px; - width: auto; -} - -#ok-button { - margin-inline-end: 16px; - margin-top: -6px; -}
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.html b/chrome/browser/resources/chromeos/login/oobe_screen_user_image.html deleted file mode 100644 index 2007a32..0000000 --- a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.html +++ /dev/null
@@ -1,19 +0,0 @@ -<div class="step right hidden loading" id="user-image" hidden> - <div class="step-contents"> - <img id="user-image-logo" src="images/user_image.svg" alt> - <div id="user-image-screen-curtain"> - <p id="user-image-screen-title" - i18n-content="userImageScreenTitle"></p> - </div> - <div id="user-image-screen-main"> - <oobe-change-picture id="changePicture"> - </oobe-change-picture> - </div> - </div> - <div id="user-image-controls" class="step-controls"></div> - <div id="user-images-loading" class="step-loading"> - <link rel="stylesheet" href="oobe_flex_layout.css"> - <throbber-notice i18n-values="text:syncingPreferences" class="fit"> - </throbber-notice> - </div> -</div>
diff --git a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js b/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js deleted file mode 100644 index 058aa208..0000000 --- a/chrome/browser/resources/chromeos/login/oobe_screen_user_image.js +++ /dev/null
@@ -1,159 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -/** - * @fileoverview Oobe user image screen implementation. - */ - -login.createScreen('UserImageScreen', 'user-image', function() { - return { - EXTERNAL_API: [ - 'setDefaultImages', - 'hideCurtain', - 'setIsCameraPresent', - 'setProfilePictureDataURL', - 'setIsProfilePictureAvailable', - 'setSelectedImageIndex', - 'setSelectedImageURL', - ], - - /** @override */ - decorate: function(element) { - this.profileImageLoading = true; - chrome.send('getImages'); - }, - - /** - * Buttons in oobe wizard's button strip. - * @type {array} Array of Buttons. - */ - get buttons() { - var okButton = this.ownerDocument.createElement('oobe-text-button'); - okButton.id = 'ok-button'; - okButton.textContent = loadTimeData.getString('okButtonText'); - okButton.setAttribute('inverse', ''); - okButton.addEventListener('click', this.acceptImage_.bind(this)); - return [okButton]; - }, - - /** - * True if the Profile image is being loaded. - * @type {boolean} - */ - get profileImageLoading() { - return this.profileImageLoading_; - }, - set profileImageLoading(value) { - this.profileImageLoading_ = value; - $('user-image-screen-main') - .classList.toggle('profile-image-loading', value); - if (value) - announceAccessibleMessage(loadTimeData.getString('syncingPreferences')); - }, - - /** - * Event handler that is invoked just before the screen is shown. - * @param {object} data Screen init payload. - */ - onBeforeShow: function(data) { - this.loading = true; - chrome.send('onUserImageScreenShown'); - }, - - /** - * Event handler that is invoked just before the screen is hidden. - */ - onBeforeHide: function() { - this.loading = false; - }, - - /** - * Accepts currently selected image, if possible. - * @private - */ - acceptImage_: function() { - var okButton = $('ok-button'); - if (!okButton.disabled) { - okButton.disabled = true; - chrome.send('onUserImageAccepted'); - this.loading = true; - } - }, - - /** - * Appends default images to the image grid. Should only be called once. - * @param {Array<{url: string, author: string, website: string}>} images - * An array of default images data, including URL, author and website. - */ - setDefaultImages: function(info) { - $('changePicture').defaultImages = info.images; - $('changePicture').firstDefaultImageIndex = info.first; - chrome.send('screenReady'); - }, - - get loading() { - return this.classList.contains('loading'); - }, - - set loading(value) { - this.classList.toggle('loading', value); - $('oobe').classList.toggle('image-loading', value); - Oobe.getInstance().updateScreenSize(this); - }, - - /** - * Hides curtain with spinner. - */ - hideCurtain: function() { - this.loading = false; - $('changePicture').focus(); - }, - - /** @param {boolean} present */ - setIsCameraPresent: function(present) { - $('changePicture').cameraPresent = present; - }, - - /** @param {string} url */ - setProfilePictureDataURL: function(url) { - this.profileImageLoading = false; - if (url) - $('changePicture').setProfileImageUrl(url, false /* selected */); - }, - - /** @param {boolean} available */ - setIsProfilePictureAvailable: function(available) { - if (!available) { - this.profileImageLoading = false; - // Empty url hides profile image selection choice. - $('changePicture').setProfileImageUrl('', false /* selected */); - } - }, - - /** - * Selects user image with the given index. - * @param {number} index Index of the image to select. - */ - setSelectedImageIndex: function(index) { - $('changePicture').selectedImageIndex = index; - }, - - /** - * Selects user image with the given URL. - * @param {string} url URL of the image to select. - */ - setSelectedImageURL: function(url) { - if (!url) - return; - $('changePicture').selectedImageUrl = url; - }, - - /** - * Updates localized content of the screen that is not updated via template. - */ - updateLocalizedContent: function() { - $('changePicture').i18nUpdateLocale(); - }, - }; -});
diff --git a/chrome/browser/resources/chromeos/login/oobe_screens.html b/chrome/browser/resources/chromeos/login/oobe_screens.html index ba033078..a91781da 100644 --- a/chrome/browser/resources/chromeos/login/oobe_screens.html +++ b/chrome/browser/resources/chromeos/login/oobe_screens.html
@@ -8,7 +8,6 @@ <include src="oobe_screen_terms_of_service.html"> <include src="oobe_screen_update.html"> <include src="oobe_screen_auto_enrollment_check.html"> -<include src="oobe_screen_user_image.html"> <include src="oobe_screen_hid_detection.html"> <include src="oobe_screen_supervision_transition.html"> <include src="oobe_screen_demo_setup.html">
diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js index c4e3fab..71f596d 100644 --- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js +++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js
@@ -881,9 +881,6 @@ if (!$('offline-gaia').hidden) $('offline-gaia').focus(); - - // Warm up the user images screen. - Oobe.getInstance().preloadScreen({id: SCREEN_USER_IMAGE_PICKER}); }, /**
diff --git a/chrome/browser/resources/management/management_ui.html b/chrome/browser/resources/management/management_ui.html index 3403e31d..7024466 100644 --- a/chrome/browser/resources/management/management_ui.html +++ b/chrome/browser/resources/management/management_ui.html
@@ -30,8 +30,9 @@ } main { - overflow: auto; - padding-bottom: 2em; + height: 100%; + margin: 0 3px; + overflow: overlay; } .header { @@ -39,7 +40,8 @@ } h2 { - @apply --cr-card-external-title; + @apply --cr-title-text; + font-weight: 600; } .subtitle { @@ -52,14 +54,14 @@ .sections-container { @apply --cr-centered-card-container; - margin-top: var(--cr-section-vertical-margin); + height: 100%; } .card { @apply --cr-card-elevation; background-color: var(--cr-card-background-color); - border-radius: var(--cr-card-border-radius); margin: 0 3px; + min-height: 100%; } .browser-report iron-icon { @@ -139,100 +141,98 @@ .browser-report ul { margin: 0; } - - .list-item div { - padding: 0 5px 0; - } </style> <cr-toolbar page-name="[[title_]]" show-search="[[showSearchInToolbar_]]"> </cr-toolbar> <main id="mainContent"> <div class="sections-container"> + <div class="card"> <if expr="not chromeos"> - <section class="card three-line single-column"> - <p inner-h-t-m-l="[[managementNoticeHtml_]]"></p> - </section> + <section class="three-line single-column"> + <p inner-h-t-m-l="[[managementNoticeHtml_]]"></p> + </section> </if> <if expr="chromeos"> - <template is="dom-if" - if="[[showDeviceReportingInfo_(deviceReportingInfo_)]]"> - <h2>$i18n{deviceReporting}</h2> - <section class="card three-line single-column"> - <div class="subtitle"> - $i18n{deviceConfiguration} - </div> - <template is="dom-repeat" items="[[deviceReportingInfo_]]"> - <div class="device-reporting"> - <span> - <iron-icon icon="[[getIconForDeviceReportingType_( - item.reportingType)]]"></iron-icon> - [[i18n(item.messageId)]] - </span> + <template is="dom-if" + if="[[showDeviceReportingInfo_(deviceReportingInfo_)]]"> + <section class="three-line single-column"> + <h2>$i18n{deviceReporting}</h2> + <div class="subtitle"> + $i18n{deviceConfiguration} </div> - </template> - </section> - </template> -</if> - <template is="dom-if" - if="[[showBrowserReportingInfo_(browserReportingInfo_)]]"> - <h2>$i18n{browserReporting}</h2> - <section class="card three-line single-column"> - <div class="subtitle"> - $i18n{browserReportingExplanation} - </div> - <template is="dom-repeat" items="[[browserReportingInfo_]]"> - <div class="browser-report"> - <iron-icon icon="[[item.icon]]"></iron-icon> - <ul> - <template is="dom-repeat" items="[[item.messageIds]]" - as="messageId"> - <li inner-h-t-m-l="[[i18nAdvanced(messageId)]]"></li> - </template> - </ul> - </div> - </template> - </section> - </template> - <template is="dom-if" - if="[[showExtensionReportingInfo_(extensions_)]]"> - <h2>$i18n{extensionReporting}</h2> - <section class="card three-line single-column"> - <div class="subtitle">[[extensionReportingSubtitle_]]</div> - <div class="extensions-list"> - <div class="list-item header"> - <div class="extension-name">$i18n{extensionName}</div> - <div class="extension-permissions"> - $i18n{extensionPermissions} + <template is="dom-repeat" items="[[deviceReportingInfo_]]"> + <div class="device-reporting"> + <span> + <iron-icon icon="[[getIconForDeviceReportingType_( + item.reportingType)]]"></iron-icon> + [[i18n(item.messageId)]] + </span> </div> - </div> - <template is="dom-repeat" items="[[extensions_]]"> - <div class="list-item"> - <div class="extension-name"> - <img src="[[item.icon]]" - aria-describedby="a11yAssociation"> - <span>[[item.name]]</span> - </div> - <div class="extension-permissions"> - <ul> - <template is="dom-repeat" items="[[item.permissions]]" - as="permission"> - <li>[[permission]]</li> - </template> - </ul> - </div> </template> - </div> - </section> - </template> -<if expr="chromeos"> - <template is="dom-if" if="[[localTrustRoots_]]"> - <h2>$i18n{localTrustRoots}</h2> - <section class="card three-line single-column"> - <div id="trust-roots-configuration">[[localTrustRoots_]]</div> - </section> - </template> + </section> + </template> </if> + <template is="dom-if" + if="[[showBrowserReportingInfo_(browserReportingInfo_)]]"> + <section class="three-line single-column"> + <h2>$i18n{browserReporting}</h2> + <div class="subtitle"> + $i18n{browserReportingExplanation} + </div> + <template is="dom-repeat" items="[[browserReportingInfo_]]"> + <div class="browser-report"> + <iron-icon icon="[[item.icon]]"></iron-icon> + <ul> + <template is="dom-repeat" items="[[item.messageIds]]" + as="messageId"> + <li inner-h-t-m-l="[[i18nAdvanced(messageId)]]"></li> + </template> + </ul> + </div> + </template> + </section> + </template> + <template is="dom-if" + if="[[showExtensionReportingInfo_(extensions_)]]"> + <section class="three-line single-column"> + <h2>$i18n{extensionReporting}</h2> + <div class="subtitle">[[extensionReportingSubtitle_]]</div> + <div class="extensions-list"> + <div class="list-item header"> + <div class="extension-name">$i18n{extensionName}</div> + <div class="extension-permissions"> + $i18n{extensionPermissions} + </div> + </div> + <template is="dom-repeat" items="[[extensions_]]"> + <div class="list-item"> + <div class="extension-name"> + <img src="[[item.icon]]" + aria-describedby="a11yAssociation"> + <span>[[item.name]]</span> + </div> + <div class="extension-permissions"> + <ul> + <template is="dom-repeat" items="[[item.permissions]]" + as="permission"> + <li>[[permission]]</li> + </template> + </ul> + </div> + </template> + </div> + </section> + </template> +<if expr="chromeos"> + <template is="dom-if" if="[[localTrustRoots_]]"> + <section class="three-line single-column"> + <h2>$i18n{localTrustRoots}</h2> + <div id="trust-roots-configuration">[[localTrustRoots_]]</div> + </section> + </template> +</if> + </div> </div> </main> </template>
diff --git a/chrome/browser/resources/md_extensions/activity_log/activity_log_history.js b/chrome/browser/resources/md_extensions/activity_log/activity_log_history.js index a0e1f1a..3cbf6ec 100644 --- a/chrome/browser/resources/md_extensions/activity_log/activity_log_history.js +++ b/chrome/browser/resources/md_extensions/activity_log/activity_log_history.js
@@ -282,10 +282,13 @@ * @param {boolean} expanded */ expandItems_: function(expanded) { - this.activityData_.filter(item => item.countsByUrl.size > 0) - .forEach((item, index) => { - this.set(`activityData_.${index}.expanded`, expanded); - }); + // Do not use .filter here as we need the original index of the item + // in |activityData_|. + this.activityData_.forEach((item, index) => { + if (item.countsByUrl.size > 0) { + this.set(`activityData_.${index}.expanded`, expanded); + } + }); this.$$('cr-action-menu').close(); },
diff --git a/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.html b/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.html index b7f08d7..35fb811 100644 --- a/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.html +++ b/chrome/browser/resources/md_extensions/activity_log/activity_log_history_item.html
@@ -4,7 +4,6 @@ <link rel="import" href="chrome://resources/cr_elements/cr_icons_css.html"> <link rel="import" href="chrome://resources/cr_elements/shared_vars_css.html"> <link rel="import" href="chrome://resources/html/cr.html"> -<link rel="import" href="chrome://resources/polymer/v1_0/iron-collapse/iron-collapse.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button-light.html"> <link rel="import" href="../shared_style.html"> <link rel="import" href="../shared_vars.html"> @@ -100,20 +99,18 @@ </button> </paper-icon-button-light> </div> - <iron-collapse opened="[[data.expanded]]"> - <div id="page-url-list" hidden$="[[!isExpandable_]]"> - <template is="dom-repeat" items="[[getPageUrls_(data)]]"> - <div class="page-url"> - <a class="page-url-link" href="[[item.page]]" target="_blank" - title="[[item.page]]">[[item.page]]</a> - <span class="page-url-count" - hidden$="[[!shouldShowPageUrlCount_(data)]]"> - [[item.count]] - </span> - </div> - </template> - </div> - </iron-collapse> + <div id="page-url-list" hidden$="[[!data.expanded]]"> + <template is="dom-repeat" items="[[getPageUrls_(data)]]"> + <div class="page-url"> + <a class="page-url-link" href="[[item.page]]" target="_blank" + title="[[item.page]]">[[item.page]]</a> + <span class="page-url-count" + hidden$="[[!shouldShowPageUrlCount_(data)]]"> + [[item.count]] + </span> + </div> + </template> + </div> </template> <script src="activity_log_history_item.js"></script> </dom-module>
diff --git a/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js b/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js index e6fd90d..aceca3f 100644 --- a/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js +++ b/chrome/browser/resources/settings/privacy_page/security_keys_set_pin_dialog.js
@@ -226,6 +226,13 @@ /** @private */ validateNewPIN_: function() { this.newPINValid_ = isValidPIN(this.newPIN_); + // The new PIN might have been changed to match the confirmation PIN, thus + // changing it might make the confirmation PIN valid. An empty value is + // considered valid to stop it immediately turning red before the user has + // entered anything, but |updatePINButtonValid_| knows that it needs to be + // non-empty before the dialog can be submitted. + this.confirmPINValid_ = this.confirmPIN_.length == 0 || + (this.newPINValid_ && this.confirmPIN_ == this.newPIN_); this.updatePINButtonValid_(); },
diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index 79255e4..5f9e87a 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -298,6 +298,7 @@ } void SpellcheckCustomDictionary::WaitUntilReadyToSync(base::OnceClosure done) { + DCHECK(!wait_until_ready_to_sync_cb_); if (is_loaded_) std::move(done).Run(); else
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.cc b/chrome/browser/supervised_user/supervised_user_settings_service.cc index 5fc0f0e..53a76b4 100644 --- a/chrome/browser/supervised_user/supervised_user_settings_service.cc +++ b/chrome/browser/supervised_user/supervised_user_settings_service.cc
@@ -198,6 +198,17 @@ store_->RemoveObserver(this); } +void SupervisedUserSettingsService::WaitUntilReadyToSync( + base::OnceClosure done) { + DCHECK(!wait_until_ready_to_sync_cb_); + if (IsReady()) { + std::move(done).Run(); + } else { + // Wait until OnInitializationCompleted(). + wait_until_ready_to_sync_cb_ = std::move(done); + } +} + SyncMergeResult SupervisedUserSettingsService::MergeDataAndStartSyncing( ModelType type, const SyncDataList& initial_sync_data, @@ -412,6 +423,10 @@ } DCHECK(IsReady()); + + if (wait_until_ready_to_sync_cb_) + std::move(wait_until_ready_to_sync_cb_).Run(); + InformSubscribers(); }
diff --git a/chrome/browser/supervised_user/supervised_user_settings_service.h b/chrome/browser/supervised_user/supervised_user_settings_service.h index c5ef215..7f2a5d1e 100644 --- a/chrome/browser/supervised_user/supervised_user_settings_service.h +++ b/chrome/browser/supervised_user/supervised_user_settings_service.h
@@ -130,6 +130,7 @@ void Shutdown() override; // SyncableService implementation: + void WaitUntilReadyToSync(base::OnceClosure done) override; syncer::SyncMergeResult MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, @@ -178,6 +179,9 @@ bool initialization_failed_; + // Set when WaitUntilReadyToSync() is invoked before initialization completes. + base::OnceClosure wait_until_ready_to_sync_cb_; + // A set of local settings that are fixed and not configured remotely. std::unique_ptr<base::DictionaryValue> local_settings_;
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc index 44ed5136..1c2678e 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc
@@ -104,6 +104,10 @@ const char kFamiliesSecureUrl[] = "https://families.google.com/"; const char kFamiliesUrl[] = "http://families.google.com/"; +// Play Store terms of service path: +const char kPlayStoreHost[] = "play.google.com"; +const char kPlayTermsPath[] = "/about/play-terms"; + // This class encapsulates all the state that is required during construction of // a new SupervisedUserURLFilter::Contents. class FilterBuilder { @@ -338,6 +342,16 @@ if (base::ContainsKey(*kWhitelistedOrigins, effective_url.GetOrigin())) return ALLOW; + // Check Play Store terms of service. + // path_piece is checked separetly from the host to match international pages + // like https://play.google.com/intl/pt-BR_pt/about/play-terms/. + if (effective_url.SchemeIs(url::kHttpsScheme) && + effective_url.host_piece() == kPlayStoreHost && + effective_url.path_piece().find(kPlayTermsPath) != + base::StringPiece::npos) { + return ALLOW; + } + // Check manual blacklists and whitelists. FilteringBehavior manual_result = GetManualFilteringBehaviorForURL(effective_url);
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc b/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc index 064178d..9dc2b45 100644 --- a/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc +++ b/chrome/browser/supervised_user/supervised_user_url_filter_unittest.cc
@@ -688,3 +688,18 @@ EXPECT_FALSE(IsURLWhitelisted("https://families.google.com:8080/")); EXPECT_FALSE(IsURLWhitelisted("https://subdomain.families.google.com/")); } + +TEST_F(SupervisedUserURLFilterTest, PlayTermsAlwaysAllowed) { + filter_.SetDefaultFilteringBehavior(SupervisedUserURLFilter::BLOCK); + EXPECT_TRUE(IsURLWhitelisted("https://play.google.com/about/play-terms")); + EXPECT_TRUE(IsURLWhitelisted("https://play.google.com/about/play-terms/")); + EXPECT_TRUE(IsURLWhitelisted( + "https://play.google.com/intl/pt-BR_pt/about/play-terms/")); + EXPECT_TRUE( + IsURLWhitelisted("https://play.google.com/about/play-terms/index.html")); + EXPECT_FALSE(IsURLWhitelisted("http://play.google.com/about/play-terms/")); + EXPECT_FALSE( + IsURLWhitelisted("https://subdomain.play.google.com/about/play-terms/")); + EXPECT_FALSE(IsURLWhitelisted("https://play.google.com/")); + EXPECT_FALSE(IsURLWhitelisted("https://play.google.com/about")); +}
diff --git a/chrome/browser/supervised_user/supervised_user_whitelist_service.cc b/chrome/browser/supervised_user/supervised_user_whitelist_service.cc index 083d533..878fcee0 100644 --- a/chrome/browser/supervised_user/supervised_user_whitelist_service.cc +++ b/chrome/browser/supervised_user/supervised_user_whitelist_service.cc
@@ -143,6 +143,12 @@ return syncer::SyncData::CreateLocalData(id, name, specifics); } +void SupervisedUserWhitelistService::WaitUntilReadyToSync( + base::OnceClosure done) { + // This service handles sync events at any time. + std::move(done).Run(); +} + syncer::SyncMergeResult SupervisedUserWhitelistService::MergeDataAndStartSyncing( syncer::ModelType type,
diff --git a/chrome/browser/supervised_user/supervised_user_whitelist_service.h b/chrome/browser/supervised_user/supervised_user_whitelist_service.h index f0de032..76b7d01 100644 --- a/chrome/browser/supervised_user/supervised_user_whitelist_service.h +++ b/chrome/browser/supervised_user/supervised_user_whitelist_service.h
@@ -78,6 +78,7 @@ const std::string& name); // SyncableService implementation: + void WaitUntilReadyToSync(base::OnceClosure done) override; syncer::SyncMergeResult MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data,
diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc index 65d95fa..afa1a3b 100644 --- a/chrome/browser/sync/profile_sync_service_android.cc +++ b/chrome/browser/sync/profile_sync_service_android.cc
@@ -23,7 +23,6 @@ #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/session_sync_service_factory.h" #include "chrome/grit/generated_resources.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/prefs/pref_service.h" #include "components/signin/core/browser/account_info.h" #include "components/strings/grit/components_strings.h" @@ -31,6 +30,7 @@ #include "components/sync/device_info/device_info.h" #include "components/sync/device_info/device_info_sync_service.h" #include "components/sync/device_info/device_info_tracker.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_service_utils.h" #include "components/sync/engine/net/network_resources.h" #include "components/sync_sessions/session_sync_service.h"
diff --git a/chrome/browser/sync/profile_sync_service_android.h b/chrome/browser/sync/profile_sync_service_android.h index 847508b..e8699b63 100644 --- a/chrome/browser/sync/profile_sync_service_android.h +++ b/chrome/browser/sync/profile_sync_service_android.h
@@ -13,11 +13,8 @@ class Profile; -namespace browser_sync { -class ProfileSyncService; -} - namespace syncer { +class ProfileSyncService; class SyncSetupInProgressHandle; } @@ -190,7 +187,7 @@ Profile* profile_; // A reference to the sync service for this profile. - browser_sync::ProfileSyncService* sync_service_; + syncer::ProfileSyncService* sync_service_; // Prevents Sync from running until configuration is complete. std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_;
diff --git a/chrome/browser/sync/profile_sync_service_factory.cc b/chrome/browser/sync/profile_sync_service_factory.cc index d79329e..350feca3 100644 --- a/chrome/browser/sync/profile_sync_service_factory.cc +++ b/chrome/browser/sync/profile_sync_service_factory.cc
@@ -42,13 +42,13 @@ #include "chrome/browser/web_data_service_factory.h" #include "chrome/common/buildflags.h" #include "components/autofill/core/common/autofill_features.h" -#include "components/browser_sync/browser_sync_switches.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/invalidation/impl/invalidation_switches.h" #include "components/invalidation/impl/profile_identity_provider.h" #include "components/invalidation/impl/profile_invalidation_provider.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/network_time/network_time_tracker.h" +#include "components/sync/driver/profile_sync_service.h" +#include "components/sync/driver/sync_driver_switches.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" @@ -73,8 +73,6 @@ #include "chrome/browser/chromeos/printing/synced_printers_manager_factory.h" #endif // defined(OS_CHROMEOS) -using browser_sync::ProfileSyncService; - namespace { void UpdateNetworkTimeOnUIThread(base::Time network_time, @@ -113,9 +111,9 @@ } // static -ProfileSyncService* +syncer::ProfileSyncService* ProfileSyncServiceFactory::GetAsProfileSyncServiceForProfile(Profile* profile) { - return static_cast<ProfileSyncService*>(GetForProfile(profile)); + return static_cast<syncer::ProfileSyncService*>(GetForProfile(profile)); } ProfileSyncServiceFactory::ProfileSyncServiceFactory() @@ -169,7 +167,7 @@ KeyedService* ProfileSyncServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { - ProfileSyncService::InitParams init_params; + syncer::ProfileSyncService::InitParams init_params; Profile* profile = Profile::FromBrowserContext(context); @@ -210,7 +208,7 @@ if (local_sync_backend_folder.empty()) return nullptr; - init_params.start_behavior = ProfileSyncService::AUTO_START; + init_params.start_behavior = syncer::ProfileSyncService::AUTO_START; } #endif // defined(OS_WIN) @@ -256,11 +254,12 @@ // need to take care that ProfileSyncService doesn't get tripped up between // those two cases. Bug 88109. init_params.start_behavior = browser_defaults::kSyncAutoStarts - ? ProfileSyncService::AUTO_START - : ProfileSyncService::MANUAL_START; + ? syncer::ProfileSyncService::AUTO_START + : syncer::ProfileSyncService::MANUAL_START; } - auto pss = std::make_unique<ProfileSyncService>(std::move(init_params)); + auto pss = + std::make_unique<syncer::ProfileSyncService>(std::move(init_params)); pss->Initialize(); return pss.release(); }
diff --git a/chrome/browser/sync/profile_sync_service_factory.h b/chrome/browser/sync/profile_sync_service_factory.h index ccbf832..2e2f416a 100644 --- a/chrome/browser/sync/profile_sync_service_factory.h +++ b/chrome/browser/sync/profile_sync_service_factory.h
@@ -19,10 +19,10 @@ namespace browser_sync { class ChromeSyncClient; -class ProfileSyncService; } // namespace browser_sync namespace syncer { +class ProfileSyncService; class SyncService; } // namespace syncer @@ -36,7 +36,7 @@ static syncer::SyncService* GetForProfile(Profile* profile); // Returns the ProfileSyncService for the given profile. DO NOT USE unless // absolutely necessary! Prefer GetForProfile instead. - static browser_sync::ProfileSyncService* GetAsProfileSyncServiceForProfile( + static syncer::ProfileSyncService* GetAsProfileSyncServiceForProfile( Profile* profile); // Returns whether a SyncService has already been created for the profile.
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.cc b/chrome/browser/sync/test/integration/bookmarks_helper.cc index 2d8dad4..672757d2 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.cc +++ b/chrome/browser/sync/test/integration/bookmarks_helper.cc
@@ -39,12 +39,12 @@ #include "components/bookmarks/browser/bookmark_model_observer.h" #include "components/bookmarks/browser/bookmark_utils.h" #include "components/bookmarks/managed/managed_bookmark_service.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/favicon/core/favicon_service.h" #include "components/favicon_base/favicon_util.h" #include "components/history/core/browser/history_db_task.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/history_types.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/test/fake_server/entity_builder_factory.h" #include "components/sync_bookmarks/bookmark_change_processor.h" #include "content/public/test/test_utils.h" @@ -1011,7 +1011,7 @@ } ServerBookmarksEqualityChecker::ServerBookmarksEqualityChecker( - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, fake_server::FakeServer* fake_server, const std::vector<ExpectedBookmark>& expected_bookmarks, syncer::Cryptographer* cryptographer)
diff --git a/chrome/browser/sync/test/integration/bookmarks_helper.h b/chrome/browser/sync/test/integration/bookmarks_helper.h index ab030fee..4637207 100644 --- a/chrome/browser/sync/test/integration/bookmarks_helper.h +++ b/chrome/browser/sync/test/integration/bookmarks_helper.h
@@ -290,7 +290,7 @@ // the server-side data should be encrypted, and the provided cryptographer // will be used to decrypt the data prior to checking for equality. ServerBookmarksEqualityChecker( - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, fake_server::FakeServer* fake_server, const std::vector<ExpectedBookmark>& expected_bookmarks, syncer::Cryptographer* cryptographer);
diff --git a/chrome/browser/sync/test/integration/encryption_helper.cc b/chrome/browser/sync/test/integration/encryption_helper.cc index f2fd767a..92e2f002 100644 --- a/chrome/browser/sync/test/integration/encryption_helper.cc +++ b/chrome/browser/sync/test/integration/encryption_helper.cc
@@ -7,10 +7,10 @@ #include "base/base64.h" #include "chrome/browser/sync/test/integration/encryption_helper.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/sync/base/passphrase_enums.h" #include "components/sync/base/sync_base_switches.h" #include "components/sync/base/system_encryptor.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/engine/sync_engine_switches.h" #include "testing/gtest/include/gtest/gtest.h" @@ -141,7 +141,7 @@ } // namespace encryption_helper ServerNigoriChecker::ServerNigoriChecker( - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, fake_server::FakeServer* fake_server, syncer::PassphraseType expected_passphrase_type) : SingleClientStatusChangeChecker(service), @@ -164,7 +164,7 @@ } PassphraseRequiredStateChecker::PassphraseRequiredStateChecker( - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, bool desired_state) : SingleClientStatusChangeChecker(service), desired_state_(desired_state) {}
diff --git a/chrome/browser/sync/test/integration/encryption_helper.h b/chrome/browser/sync/test/integration/encryption_helper.h index e379f10..9cbc283 100644 --- a/chrome/browser/sync/test/integration/encryption_helper.h +++ b/chrome/browser/sync/test/integration/encryption_helper.h
@@ -52,7 +52,7 @@ // available on the server. class ServerNigoriChecker : public SingleClientStatusChangeChecker { public: - ServerNigoriChecker(browser_sync::ProfileSyncService* service, + ServerNigoriChecker(syncer::ProfileSyncService* service, fake_server::FakeServer* fake_server, syncer::PassphraseType expected_passphrase_type); @@ -67,7 +67,7 @@ // Checker used to block until Sync requires or stops requiring a passphrase. class PassphraseRequiredStateChecker : public SingleClientStatusChangeChecker { public: - PassphraseRequiredStateChecker(browser_sync::ProfileSyncService* service, + PassphraseRequiredStateChecker(syncer::ProfileSyncService* service, bool desired_state); bool IsExitConditionSatisfied() override;
diff --git a/chrome/browser/sync/test/integration/local_sync_test.cc b/chrome/browser/sync/test/integration/local_sync_test.cc index 2956452f..f1a587d 100644 --- a/chrome/browser/sync/test/integration/local_sync_test.cc +++ b/chrome/browser/sync/test/integration/local_sync_test.cc
@@ -14,12 +14,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" #include "components/browser_sync/browser_sync_switches.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_driver_switches.h" namespace { -using browser_sync::ProfileSyncService; +using syncer::ProfileSyncService; class SyncTransportActiveChecker : public SingleClientStatusChangeChecker { public:
diff --git a/chrome/browser/sync/test/integration/multi_client_status_change_checker.cc b/chrome/browser/sync/test/integration/multi_client_status_change_checker.cc index 98f49f0b..4cfe14fb 100644 --- a/chrome/browser/sync/test/integration/multi_client_status_change_checker.cc +++ b/chrome/browser/sync/test/integration/multi_client_status_change_checker.cc
@@ -5,12 +5,12 @@ #include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h" #include "base/logging.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" MultiClientStatusChangeChecker::MultiClientStatusChangeChecker( - std::vector<browser_sync::ProfileSyncService*> services) + std::vector<syncer::ProfileSyncService*> services) : services_(services), scoped_observer_(this) { - for (browser_sync::ProfileSyncService* service : services) { + for (syncer::ProfileSyncService* service : services) { scoped_observer_.Add(service); } }
diff --git a/chrome/browser/sync/test/integration/multi_client_status_change_checker.h b/chrome/browser/sync/test/integration/multi_client_status_change_checker.h index 97b98d4..27c7a5e 100644 --- a/chrome/browser/sync/test/integration/multi_client_status_change_checker.h +++ b/chrome/browser/sync/test/integration/multi_client_status_change_checker.h
@@ -13,9 +13,9 @@ #include "chrome/browser/sync/test/integration/status_change_checker.h" #include "components/sync/driver/sync_service_observer.h" -namespace browser_sync { +namespace syncer { class ProfileSyncService; -} // namespace browser_sync +} // namespace syncer // This class provides some common functionality for StatusChangeCheckers that // observe many ProfileSyncServices. This class is abstract. Its descendants @@ -24,7 +24,7 @@ public syncer::SyncServiceObserver { public: explicit MultiClientStatusChangeChecker( - std::vector<browser_sync::ProfileSyncService*> services); + std::vector<syncer::ProfileSyncService*> services); ~MultiClientStatusChangeChecker() override; // Called when waiting times out. @@ -38,14 +38,13 @@ std::string GetDebugMessage() const override = 0; protected: - const std::vector<browser_sync::ProfileSyncService*>& services() { + const std::vector<syncer::ProfileSyncService*>& services() { return services_; } private: - std::vector<browser_sync::ProfileSyncService*> services_; - ScopedObserver<browser_sync::ProfileSyncService, - MultiClientStatusChangeChecker> + std::vector<syncer::ProfileSyncService*> services_; + ScopedObserver<syncer::ProfileSyncService, MultiClientStatusChangeChecker> scoped_observer_; };
diff --git a/chrome/browser/sync/test/integration/p2p_sync_refresher.cc b/chrome/browser/sync/test/integration/p2p_sync_refresher.cc index a58fb0a3..a8e14e4 100644 --- a/chrome/browser/sync/test/integration/p2p_sync_refresher.cc +++ b/chrome/browser/sync/test/integration/p2p_sync_refresher.cc
@@ -7,13 +7,12 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" #include "chrome/browser/sync/test/integration/sync_test.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/engine/cycle/sync_cycle_snapshot.h" #include "content/public/browser/notification_service.h" -P2PSyncRefresher::P2PSyncRefresher( - Profile* profile, - browser_sync::ProfileSyncService* sync_service) +P2PSyncRefresher::P2PSyncRefresher(Profile* profile, + syncer::ProfileSyncService* sync_service) : profile_(profile), sync_service_(sync_service) { sync_service_->AddObserver(this); }
diff --git a/chrome/browser/sync/test/integration/p2p_sync_refresher.h b/chrome/browser/sync/test/integration/p2p_sync_refresher.h index de7ad53..b925c6a 100644 --- a/chrome/browser/sync/test/integration/p2p_sync_refresher.h +++ b/chrome/browser/sync/test/integration/p2p_sync_refresher.h
@@ -10,9 +10,9 @@ class Profile; -namespace browser_sync { +namespace syncer { class ProfileSyncService; -} // namespace browser_sync +} // namespace syncer // This class observes ProfileSyncService events and emits refresh notifications // to other test profiles for any committed changes it observes. @@ -21,8 +21,7 @@ // intended to make it easy to manage with a scoped_ptr. class P2PSyncRefresher : public syncer::SyncServiceObserver { public: - P2PSyncRefresher(Profile* profile, - browser_sync::ProfileSyncService* sync_service); + P2PSyncRefresher(Profile* profile, syncer::ProfileSyncService* sync_service); ~P2PSyncRefresher() override; // Implementation of syncer::SyncServiceObserver @@ -30,7 +29,7 @@ private: Profile* const profile_; // weak - browser_sync::ProfileSyncService* sync_service_; // weak + syncer::ProfileSyncService* sync_service_; // weak DISALLOW_COPY_AND_ASSIGN(P2PSyncRefresher); };
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc index d401d8c..bf5400d 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc
@@ -27,7 +27,7 @@ #include "services/identity/public/cpp/identity_manager.h" #include "services/identity/public/cpp/identity_test_utils.h" -using browser_sync::ProfileSyncService; +using syncer::ProfileSyncService; using syncer::SyncCycleSnapshot; namespace {
diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.h b/chrome/browser/sync/test/integration/profile_sync_service_harness.h index 304f517..ec5fae6 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.h +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.h
@@ -12,8 +12,8 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/optional.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/sync/base/model_type.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/engine/cycle/sync_cycle_snapshot.h" class Profile; @@ -140,7 +140,7 @@ bool AwaitSyncTransportActive(); // Returns the ProfileSyncService member of the sync client. - browser_sync::ProfileSyncService* service() const { return service_; } + syncer::ProfileSyncService* service() const { return service_; } // Returns the debug name for this profile. Used for logging. const std::string& profile_debug_name() const { return profile_debug_name_; } @@ -199,7 +199,7 @@ Profile* const profile_; // ProfileSyncService object associated with |profile_|. - browser_sync::ProfileSyncService* const service_; + syncer::ProfileSyncService* const service_; // Prevents Sync from running until configuration is complete. std::unique_ptr<syncer::SyncSetupInProgressHandle> sync_blocker_;
diff --git a/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc b/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc index ac1002b..3005938 100644 --- a/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc +++ b/chrome/browser/sync/test/integration/quiesce_status_change_checker.cc
@@ -12,7 +12,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/engine/cycle/sync_cycle_snapshot.h" #include "components/sync/test/fake_server/fake_server.h" @@ -41,8 +41,8 @@ } // Returns true if these services have matching progress markers. -bool ProgressMarkersMatch(const browser_sync::ProfileSyncService* service1, - const browser_sync::ProfileSyncService* service2) { +bool ProgressMarkersMatch(const syncer::ProfileSyncService* service1, + const syncer::ProfileSyncService* service2) { // GetActiveDataTypes() is always empty during configuration, so progress // markers cannot be compared. if (service1->GetTransportState() != @@ -87,7 +87,7 @@ : public UpdatedProgressMarkerChecker { public: NestedUpdatedProgressMarkerChecker( - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, const base::RepeatingClosure& check_exit_condition_cb) : UpdatedProgressMarkerChecker(service), check_exit_condition_cb_(check_exit_condition_cb) {} @@ -102,7 +102,7 @@ }; QuiesceStatusChangeChecker::QuiesceStatusChangeChecker( - std::vector<browser_sync::ProfileSyncService*> services) + std::vector<syncer::ProfileSyncService*> services) : MultiClientStatusChangeChecker(services) { DCHECK_LE(1U, services.size()); for (size_t i = 0; i < services.size(); ++i) { @@ -117,7 +117,7 @@ bool QuiesceStatusChangeChecker::IsExitConditionSatisfied() { // Check that all progress markers are up to date. - std::vector<browser_sync::ProfileSyncService*> enabled_services; + std::vector<syncer::ProfileSyncService*> enabled_services; for (const auto& checker : checkers_) { enabled_services.push_back(checker->service());
diff --git a/chrome/browser/sync/test/integration/quiesce_status_change_checker.h b/chrome/browser/sync/test/integration/quiesce_status_change_checker.h index d0cf747..d1227c7f 100644 --- a/chrome/browser/sync/test/integration/quiesce_status_change_checker.h +++ b/chrome/browser/sync/test/integration/quiesce_status_change_checker.h
@@ -14,9 +14,9 @@ #include "base/time/time.h" #include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h" -namespace browser_sync { +namespace syncer { class ProfileSyncService; -} // namespace browser_sync +} // namespace syncer // Waits until all provided clients have finished committing any unsynced items // and downloading each others' udpates. @@ -27,7 +27,7 @@ class QuiesceStatusChangeChecker : public MultiClientStatusChangeChecker { public: explicit QuiesceStatusChangeChecker( - std::vector<browser_sync::ProfileSyncService*> services); + std::vector<syncer::ProfileSyncService*> services); ~QuiesceStatusChangeChecker() override; // Implementation of StatusChangeChecker.
diff --git a/chrome/browser/sync/test/integration/session_hierarchy_match_checker.cc b/chrome/browser/sync/test/integration/session_hierarchy_match_checker.cc index ee2e9aa..9d1622f 100644 --- a/chrome/browser/sync/test/integration/session_hierarchy_match_checker.cc +++ b/chrome/browser/sync/test/integration/session_hierarchy_match_checker.cc
@@ -6,7 +6,7 @@ SessionHierarchyMatchChecker::SessionHierarchyMatchChecker( const fake_server::SessionsHierarchy& sessions_hierarchy, - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, fake_server::FakeServer* fake_server) : SingleClientStatusChangeChecker(service), sessions_hierarchy_(sessions_hierarchy),
diff --git a/chrome/browser/sync/test/integration/session_hierarchy_match_checker.h b/chrome/browser/sync/test/integration/session_hierarchy_match_checker.h index b8243f7..9a69b2e4 100644 --- a/chrome/browser/sync/test/integration/session_hierarchy_match_checker.h +++ b/chrome/browser/sync/test/integration/session_hierarchy_match_checker.h
@@ -15,7 +15,7 @@ public: SessionHierarchyMatchChecker( const fake_server::SessionsHierarchy& sessions_hierarchy, - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, fake_server::FakeServer* fake_server); // StatusChangeChecker implementation.
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 59c9f7d..37ed86d7 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
@@ -12,9 +12,9 @@ #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/common/autofill_prefs.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/prefs/pref_service.h" #include "components/sync/base/model_type.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_driver_switches.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -23,8 +23,7 @@ class AutofillProfileDisabledChecker : public SingleClientStatusChangeChecker { public: - explicit AutofillProfileDisabledChecker( - browser_sync::ProfileSyncService* service) + explicit AutofillProfileDisabledChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} ~AutofillProfileDisabledChecker() override = default;
diff --git a/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc b/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc index 6cb7659c..b440d80 100644 --- a/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_custom_passphrase_sync_test.cc
@@ -5,10 +5,10 @@ #include "chrome/browser/sync/test/integration/bookmarks_helper.h" #include "chrome/browser/sync/test/integration/encryption_helper.h" #include "chrome/browser/sync/test/integration/sync_test.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/sync/base/cryptographer.h" #include "components/sync/base/passphrase_enums.h" #include "components/sync/base/system_encryptor.h" +#include "components/sync/driver/profile_sync_service.h" namespace { @@ -125,7 +125,7 @@ .Wait(); } - browser_sync::ProfileSyncService* GetSyncService() { + syncer::ProfileSyncService* GetSyncService() { return SyncTest::GetSyncService(0); }
diff --git a/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc b/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc index 689957e..0d4af5f 100644 --- a/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_directory_sync_test.cc
@@ -16,7 +16,7 @@ #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/model/model_type_store_service.h" #include "components/sync/syncable/directory.h" #include "sql/test/test_helpers.h" @@ -62,8 +62,7 @@ // A status change checker that waits for an unrecoverable sync error to occur. class SyncUnrecoverableErrorChecker : public SingleClientStatusChangeChecker { public: - explicit SyncUnrecoverableErrorChecker( - browser_sync::ProfileSyncService* service) + explicit SyncUnrecoverableErrorChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} bool IsExitConditionSatisfied() override { @@ -78,7 +77,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientDirectorySyncTest, StopThenDisableDeletesDirectory) { ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; - browser_sync::ProfileSyncService* sync_service = GetSyncService(0); + syncer::ProfileSyncService* sync_service = GetSyncService(0); FilePath directory_path = sync_service->GetSyncClientForTest() ->GetSyncDataPath(); ASSERT_TRUE(FolderContainsFiles(directory_path)); @@ -107,7 +106,7 @@ // Flush the directory to the backing store and wait until the flush // completes. - browser_sync::ProfileSyncService* sync_service = GetSyncService(0); + syncer::ProfileSyncService* sync_service = GetSyncService(0); sync_service->FlushDirectory(); scoped_refptr<base::SingleThreadTaskRunner> sync_thread_task_runner = sync_service->GetSyncThreadTaskRunnerForTest();
diff --git a/chrome/browser/sync/test/integration/single_client_history_delete_directives_sync_test.cc b/chrome/browser/sync/test/integration/single_client_history_delete_directives_sync_test.cc index 5775266..277101e 100644 --- a/chrome/browser/sync/test/integration/single_client_history_delete_directives_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_history_delete_directives_sync_test.cc
@@ -35,10 +35,9 @@ class HistoryDeleteDirectivesEqualityChecker : public SingleClientStatusChangeChecker { public: - HistoryDeleteDirectivesEqualityChecker( - browser_sync::ProfileSyncService* service, - fake_server::FakeServer* fake_server, - size_t num_expected_directives) + HistoryDeleteDirectivesEqualityChecker(syncer::ProfileSyncService* service, + fake_server::FakeServer* fake_server, + size_t num_expected_directives) : SingleClientStatusChangeChecker(service), fake_server_(fake_server), num_expected_directives_(num_expected_directives) {}
diff --git a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc index ccb19d7..57c1655 100644 --- a/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_sessions_sync_test.cc
@@ -91,7 +91,7 @@ public: IsHistoryURLSyncedChecker(const std::string& url, fake_server::FakeServer* fake_server, - browser_sync::ProfileSyncService* service) + syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service), url_(url), fake_server_(fake_server) {}
diff --git a/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc b/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc index 7705b4f0..bbb953a 100644 --- a/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_standalone_transport_sync_test.cc
@@ -10,8 +10,8 @@ #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "chrome/browser/sync/test/integration/sync_test.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/sync/base/model_type.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_driver_switches.h" namespace { @@ -27,7 +27,7 @@ class SyncDisabledByUserChecker : public SingleClientStatusChangeChecker { public: - explicit SyncDisabledByUserChecker(browser_sync::ProfileSyncService* service) + explicit SyncDisabledByUserChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} bool IsExitConditionSatisfied() override {
diff --git a/chrome/browser/sync/test/integration/single_client_status_change_checker.cc b/chrome/browser/sync/test/integration/single_client_status_change_checker.cc index 9de4ee41..312dc99 100644 --- a/chrome/browser/sync/test/integration/single_client_status_change_checker.cc +++ b/chrome/browser/sync/test/integration/single_client_status_change_checker.cc
@@ -7,11 +7,11 @@ #include <vector> SingleClientStatusChangeChecker::SingleClientStatusChangeChecker( - browser_sync::ProfileSyncService* service) + syncer::ProfileSyncService* service) : MultiClientStatusChangeChecker({service}) {} SingleClientStatusChangeChecker::~SingleClientStatusChangeChecker() {} -browser_sync::ProfileSyncService* SingleClientStatusChangeChecker::service() { +syncer::ProfileSyncService* SingleClientStatusChangeChecker::service() { return services()[0]; }
diff --git a/chrome/browser/sync/test/integration/single_client_status_change_checker.h b/chrome/browser/sync/test/integration/single_client_status_change_checker.h index d537ed942..4a647bf6 100644 --- a/chrome/browser/sync/test/integration/single_client_status_change_checker.h +++ b/chrome/browser/sync/test/integration/single_client_status_change_checker.h
@@ -12,9 +12,9 @@ #include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h" #include "components/sync/driver/sync_service_observer.h" -namespace browser_sync { +namespace syncer { class ProfileSyncService; -} // namespace browser_sync +} // namespace syncer // This class provides some common functionality for StatusChangeCheckers that // observe only one ProfileSyncService. This class is abstract. Its @@ -22,15 +22,14 @@ class SingleClientStatusChangeChecker : public MultiClientStatusChangeChecker { public: - explicit SingleClientStatusChangeChecker( - browser_sync::ProfileSyncService* service); + explicit SingleClientStatusChangeChecker(syncer::ProfileSyncService* service); ~SingleClientStatusChangeChecker() override; // StatusChangeChecker implementations and stubs. bool IsExitConditionSatisfied() override = 0; std::string GetDebugMessage() const override = 0; - browser_sync::ProfileSyncService* service(); + syncer::ProfileSyncService* service(); }; #endif // CHROME_BROWSER_SYNC_TEST_INTEGRATION_SINGLE_CLIENT_STATUS_CHANGE_CHECKER_H_
diff --git a/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc b/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc index 4ff01a0d..47264bd 100644 --- a/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_user_consents_sync_test.cc
@@ -38,7 +38,7 @@ class UserConsentEqualityChecker : public SingleClientStatusChangeChecker { public: UserConsentEqualityChecker( - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, FakeServer* fake_server, std::vector<UserConsentSpecifics> expected_specifics) : SingleClientStatusChangeChecker(service), fake_server_(fake_server) {
diff --git a/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc b/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc index 15a0773..94618a0 100644 --- a/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_user_events_sync_test.cc
@@ -58,7 +58,7 @@ class UserEventEqualityChecker : public SingleClientStatusChangeChecker { public: - UserEventEqualityChecker(browser_sync::ProfileSyncService* service, + UserEventEqualityChecker(syncer::ProfileSyncService* service, FakeServer* fake_server, std::vector<UserEventSpecifics> expected_specifics) : SingleClientStatusChangeChecker(service), fake_server_(fake_server) { @@ -121,7 +121,7 @@ class UserEventCaseChecker : public SingleClientStatusChangeChecker { public: UserEventCaseChecker( - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, FakeServer* fake_server, std::multiset<UserEventSpecifics::EventCase> expected_cases) : SingleClientStatusChangeChecker(service),
diff --git a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc index 014ba7b8..36dccc4 100644 --- a/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_wallet_sync_test.cc
@@ -27,9 +27,9 @@ #include "components/autofill/core/common/autofill_features.h" #include "components/autofill/core/common/autofill_prefs.h" #include "components/autofill/core/common/autofill_switches.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/prefs/pref_service.h" #include "components/sync/base/model_type.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/protocol/model_type_state.pb.h" #include "components/sync/test/fake_server/fake_server.h" @@ -108,8 +108,7 @@ class WaitForNextWalletUpdateChecker : public StatusChangeChecker, public syncer::SyncServiceObserver { public: - explicit WaitForNextWalletUpdateChecker( - browser_sync::ProfileSyncService* service) + explicit WaitForNextWalletUpdateChecker(syncer::ProfileSyncService* service) : service_(service), initial_marker_(GetInitialMarker(service)), scoped_observer_(this) { @@ -140,7 +139,7 @@ private: static std::string GetInitialMarker( - const browser_sync::ProfileSyncService* service) { + const syncer::ProfileSyncService* service) { // GetLastCycleSnapshot() returns by value, so make sure to capture it for // iterator use. const syncer::SyncCycleSnapshot snap = service->GetLastCycleSnapshot(); @@ -153,10 +152,9 @@ return marker_it->second; } - const browser_sync::ProfileSyncService* service_; + const syncer::ProfileSyncService* service_; const std::string initial_marker_; - ScopedObserver<browser_sync::ProfileSyncService, - WaitForNextWalletUpdateChecker> + ScopedObserver<syncer::ProfileSyncService, WaitForNextWalletUpdateChecker> scoped_observer_; };
diff --git a/chrome/browser/sync/test/integration/sync_auth_test.cc b/chrome/browser/sync/test/integration/sync_auth_test.cc index e20b778b..216e50a 100644 --- a/chrome/browser/sync/test/integration/sync_auth_test.cc +++ b/chrome/browser/sync/test/integration/sync_auth_test.cc
@@ -12,7 +12,7 @@ #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_token_status.h" #include "google_apis/gaia/google_service_auth_error.h" #include "net/http/http_status_code.h" @@ -52,7 +52,7 @@ // Waits until local changes are committed or an auth error is encountered. class TestForAuthError : public UpdatedProgressMarkerChecker { public: - explicit TestForAuthError(browser_sync::ProfileSyncService* service) + explicit TestForAuthError(syncer::ProfileSyncService* service) : UpdatedProgressMarkerChecker(service) {} // StatusChangeChecker implementation. @@ -69,7 +69,7 @@ class SyncTransportActiveChecker : public SingleClientStatusChangeChecker { public: - explicit SyncTransportActiveChecker(browser_sync::ProfileSyncService* service) + explicit SyncTransportActiveChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} // StatusChangeChecker implementation. @@ -312,7 +312,7 @@ class NoAuthErrorChecker : public SingleClientStatusChangeChecker { public: - explicit NoAuthErrorChecker(browser_sync::ProfileSyncService* service) + explicit NoAuthErrorChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} // StatusChangeChecker implementation.
diff --git a/chrome/browser/sync/test/integration/sync_errors_test.cc b/chrome/browser/sync/test/integration/sync_errors_test.cc index 66864000..bf1f998d 100644 --- a/chrome/browser/sync/test/integration/sync_errors_test.cc +++ b/chrome/browser/sync/test/integration/sync_errors_test.cc
@@ -13,17 +13,17 @@ #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "chrome/common/pref_names.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/history/core/common/pref_names.h" #include "components/prefs/pref_member.h" #include "components/prefs/pref_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/protocol/sync_protocol_error.h" #include "google_apis/gaia/google_service_auth_error.h" using bookmarks::BookmarkNode; using bookmarks_helper::AddFolder; using bookmarks_helper::SetTitle; -using browser_sync::ProfileSyncService; +using syncer::ProfileSyncService; namespace {
diff --git a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc index 80ad392..d36d9388 100644 --- a/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc +++ b/chrome/browser/sync/test/integration/sync_exponential_backoff_test.cc
@@ -10,7 +10,7 @@ #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/test/fake_server/fake_server_http_post_provider.h" #include "content/public/test/network_connection_change_simulator.h" #include "net/base/network_change_notifier.h" @@ -40,7 +40,7 @@ // exponential backoff after it encounters an error. class ExponentialBackoffChecker : public SingleClientStatusChangeChecker { public: - explicit ExponentialBackoffChecker(browser_sync::ProfileSyncService* pss) + explicit ExponentialBackoffChecker(syncer::ProfileSyncService* pss) : SingleClientStatusChangeChecker(pss) { const SyncCycleSnapshot& snap = service()->GetLastCycleSnapshot(); retry_verifier_.Initialize(snap);
diff --git a/chrome/browser/sync/test/integration/sync_integration_test_util.cc b/chrome/browser/sync/test/integration/sync_integration_test_util.cc index 9fd987e..d13b69d 100644 --- a/chrome/browser/sync/test/integration/sync_integration_test_util.cc +++ b/chrome/browser/sync/test/integration/sync_integration_test_util.cc
@@ -8,7 +8,7 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/sync/test/integration/themes_helper.h" #include "chrome/browser/themes/theme_service_factory.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "content/public/test/test_utils.h" void SetCustomTheme(Profile* profile, int theme_index) { @@ -38,7 +38,7 @@ } PassphraseRequiredChecker::PassphraseRequiredChecker( - browser_sync::ProfileSyncService* service) + syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} bool PassphraseRequiredChecker::IsExitConditionSatisfied() { @@ -50,7 +50,7 @@ } PassphraseAcceptedChecker::PassphraseAcceptedChecker( - browser_sync::ProfileSyncService* service) + syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} bool PassphraseAcceptedChecker::IsExitConditionSatisfied() {
diff --git a/chrome/browser/sync/test/integration/sync_integration_test_util.h b/chrome/browser/sync/test/integration/sync_integration_test_util.h index 63df4c9..fa8b54b6 100644 --- a/chrome/browser/sync/test/integration/sync_integration_test_util.h +++ b/chrome/browser/sync/test/integration/sync_integration_test_util.h
@@ -13,9 +13,9 @@ class Profile; -namespace browser_sync { +namespace syncer { class ProfileSyncService; -} // namespace browser_sync +} // namespace syncer // Sets a custom theme and wait until the asynchronous process is done. void SetCustomTheme(Profile* profile, int theme_index = 0); @@ -38,7 +38,7 @@ // Checker to block until service is waiting for a passphrase. class PassphraseRequiredChecker : public SingleClientStatusChangeChecker { public: - explicit PassphraseRequiredChecker(browser_sync::ProfileSyncService* service); + explicit PassphraseRequiredChecker(syncer::ProfileSyncService* service); // StatusChangeChecker implementation. bool IsExitConditionSatisfied() override; @@ -48,7 +48,7 @@ // Checker to block until service has accepted a new passphrase. class PassphraseAcceptedChecker : public SingleClientStatusChangeChecker { public: - explicit PassphraseAcceptedChecker(browser_sync::ProfileSyncService* service); + explicit PassphraseAcceptedChecker(syncer::ProfileSyncService* service); // StatusChangeChecker implementation. bool IsExitConditionSatisfied() override;
diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 5ca49cd..951fa3d 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc
@@ -46,7 +46,6 @@ #include "chrome/test/base/search_test_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "components/bookmarks/test/bookmark_test_helpers.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/google/core/browser/google_url_tracker.h" #include "components/invalidation/impl/invalidation_switches.h" #include "components/invalidation/impl/profile_identity_provider.h" @@ -56,6 +55,7 @@ #include "components/os_crypt/os_crypt_mocker.h" #include "components/search_engines/template_url_service.h" #include "components/sync/base/invalidation_helper.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_user_settings.h" #include "components/sync/engine/sync_engine_switches.h" @@ -88,7 +88,7 @@ #include "chrome/browser/ui/app_list/test/fake_app_list_model_updater.h" #endif // BUILDFLAG(ENABLE_APP_LIST) -using browser_sync::ProfileSyncService; +using syncer::ProfileSyncService; namespace switches { const char kPasswordFileForTest[] = "password-file-for-test";
diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h index 356d2ff..543f356 100644 --- a/chrome/browser/sync/test/integration/sync_test.h +++ b/chrome/browser/sync/test/integration/sync_test.h
@@ -56,15 +56,15 @@ class ScopedTempDir; } // namespace base -namespace browser_sync { -class ProfileSyncService; -} // namespace browser_sync - namespace fake_server { class FakeServer; class FakeServerInvalidationService; } // namespace fake_server +namespace syncer { +class ProfileSyncService; +} // namespace syncer + // This is the base class for integration tests for all sync data types. Derived // classes must be defined for each sync data type. Individual tests are defined // using the IN_PROC_BROWSER_TEST_F macro. @@ -134,10 +134,10 @@ std::vector<ProfileSyncServiceHarness*> GetSyncClients(); // Returns a ProfileSyncService at the given index. - browser_sync::ProfileSyncService* GetSyncService(int index); + syncer::ProfileSyncService* GetSyncService(int index); // Returns the set of ProfileSyncServices. - std::vector<browser_sync::ProfileSyncService*> GetSyncServices(); + std::vector<syncer::ProfileSyncService*> GetSyncServices(); // Returns a pointer to the sync profile that is used to verify changes to // individual sync profiles. Callee owns the object and manages its lifetime.
diff --git a/chrome/browser/sync/test/integration/two_client_polling_sync_test.cc b/chrome/browser/sync/test/integration/two_client_polling_sync_test.cc index 85519c9..8924e7e 100644 --- a/chrome/browser/sync/test/integration/two_client_polling_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_polling_sync_test.cc
@@ -11,8 +11,8 @@ #include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/common/webui_url_constants.h" #include "components/autofill/core/common/autofill_prefs.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/sync/base/sync_prefs.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/engine/polling_constants.h" #include "components/sync/protocol/client_commands.pb.h" #include "components/sync/test/fake_server/sessions_hierarchy.h" @@ -39,7 +39,7 @@ class SessionCountMatchChecker : public SingleClientStatusChangeChecker { public: SessionCountMatchChecker(int expected_count, - browser_sync::ProfileSyncService* service, + syncer::ProfileSyncService* service, fake_server::FakeServer* fake_server) : SingleClientStatusChangeChecker(service), expected_count_(expected_count),
diff --git a/chrome/browser/sync/test/integration/two_client_uss_sync_test.cc b/chrome/browser/sync/test/integration/two_client_uss_sync_test.cc index 9eebf75..d46d105 100644 --- a/chrome/browser/sync/test/integration/two_client_uss_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_uss_sync_test.cc
@@ -15,7 +15,7 @@ #include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_test.h" #include "components/browser_sync/profile_sync_components_factory_impl.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/model/fake_model_type_sync_bridge.h" #include "components/sync/model/metadata_change_list.h" #include "components/sync/model/model_error.h" @@ -192,7 +192,7 @@ // Wait for PREFERENCES to no longer be running. class PrefsNotRunningChecker : public SingleClientStatusChangeChecker { public: - explicit PrefsNotRunningChecker(browser_sync::ProfileSyncService* service) + explicit PrefsNotRunningChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} bool IsExitConditionSatisfied() override { @@ -207,7 +207,7 @@ // Wait for sync cycle failure. class SyncCycleFailedChecker : public SingleClientStatusChangeChecker { public: - explicit SyncCycleFailedChecker(browser_sync::ProfileSyncService* service) + explicit SyncCycleFailedChecker(syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service) {} bool IsExitConditionSatisfied() override {
diff --git a/chrome/browser/sync/test/integration/updated_progress_marker_checker.cc b/chrome/browser/sync/test/integration/updated_progress_marker_checker.cc index 82fc834..ac20da15 100644 --- a/chrome/browser/sync/test/integration/updated_progress_marker_checker.cc +++ b/chrome/browser/sync/test/integration/updated_progress_marker_checker.cc
@@ -5,11 +5,11 @@ #include "chrome/browser/sync/test/integration/updated_progress_marker_checker.h" #include "base/bind.h" -#include "components/browser_sync/profile_sync_service.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/engine/cycle/sync_cycle_snapshot.h" UpdatedProgressMarkerChecker::UpdatedProgressMarkerChecker( - browser_sync::ProfileSyncService* service) + syncer::ProfileSyncService* service) : SingleClientStatusChangeChecker(service), weak_ptr_factory_(this) { // HasUnsyncedItemsForTest() posts a task to the sync thread which guarantees // that all tasks posted to the sync thread before this constructor have been
diff --git a/chrome/browser/sync/test/integration/updated_progress_marker_checker.h b/chrome/browser/sync/test/integration/updated_progress_marker_checker.h index 2529e7a..fe657424 100644 --- a/chrome/browser/sync/test/integration/updated_progress_marker_checker.h +++ b/chrome/browser/sync/test/integration/updated_progress_marker_checker.h
@@ -23,8 +23,7 @@ // of this checker. Please do not use it in new tests. class UpdatedProgressMarkerChecker : public SingleClientStatusChangeChecker { public: - explicit UpdatedProgressMarkerChecker( - browser_sync::ProfileSyncService* service); + explicit UpdatedProgressMarkerChecker(syncer::ProfileSyncService* service); ~UpdatedProgressMarkerChecker() override; // StatusChangeChecker implementation.
diff --git a/chrome/browser/themes/theme_syncable_service.cc b/chrome/browser/themes/theme_syncable_service.cc index 908a81f..dc7e3fdf 100644 --- a/chrome/browser/themes/theme_syncable_service.cc +++ b/chrome/browser/themes/theme_syncable_service.cc
@@ -22,6 +22,7 @@ #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_system.h" #include "extensions/common/manifest_url_handlers.h" +#include "extensions/common/one_shot_event.h" using std::string; @@ -59,6 +60,11 @@ } } +void ThemeSyncableService::WaitUntilReadyToSync(base::OnceClosure done) { + extensions::ExtensionSystem::Get(profile_)->ready().Post(FROM_HERE, + std::move(done)); +} + syncer::SyncMergeResult ThemeSyncableService::MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data,
diff --git a/chrome/browser/themes/theme_syncable_service.h b/chrome/browser/themes/theme_syncable_service.h index 67bd3ae..635adfd 100644 --- a/chrome/browser/themes/theme_syncable_service.h +++ b/chrome/browser/themes/theme_syncable_service.h
@@ -36,6 +36,7 @@ void OnThemeChange(); // syncer::SyncableService implementation. + void WaitUntilReadyToSync(base::OnceClosure done) override; syncer::SyncMergeResult MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data,
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 7e4fa3a..850eb60 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -692,8 +692,8 @@ "android/passwords/manual_filling_view_android.h", "android/passwords/password_generation_dialog_view_android.cc", "android/passwords/password_generation_dialog_view_android.h", - "android/passwords/password_generation_popup_view_android.cc", - "android/passwords/password_generation_popup_view_android.h", + "android/passwords/password_generation_editing_popup_view_android.cc", + "android/passwords/password_generation_editing_popup_view_android.h", "android/simple_message_box_android.cc", "android/snackbars/auto_signin_prompt_controller.cc", "android/snackbars/auto_signin_prompt_controller.h", @@ -1674,8 +1674,6 @@ "webui/chromeos/login/update_screen_handler.h", "webui/chromeos/login/user_board_screen_handler.cc", "webui/chromeos/login/user_board_screen_handler.h", - "webui/chromeos/login/user_image_screen_handler.cc", - "webui/chromeos/login/user_image_screen_handler.h", "webui/chromeos/login/welcome_screen_handler.cc", "webui/chromeos/login/welcome_screen_handler.h", "webui/chromeos/login/wrong_hwid_screen_handler.cc", @@ -1888,6 +1886,8 @@ "views/profiles/badged_profile_photo.h", "views/profiles/dice_accounts_menu.cc", "views/profiles/dice_accounts_menu.h", + "views/profiles/incognito_menu_view.cc", + "views/profiles/incognito_menu_view.h", "views/profiles/profile_chooser_view.cc", "views/profiles/profile_chooser_view.h", "views/profiles/profile_menu_view_base.cc",
diff --git a/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.cc b/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.cc index becba6e..298eb2d 100644 --- a/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.cc +++ b/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.cc
@@ -4,22 +4,22 @@ #include "chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h" -#include <numeric> +#include <utility> #include "base/android/jni_android.h" #include "base/android/jni_string.h" +#include "base/callback.h" #include "chrome/browser/android/resource_mapper.h" #include "chrome/browser/ui/android/view_android_helper.h" #include "chrome/browser/ui/autofill/autofill_popup_controller.h" #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" -#include "components/autofill/core/browser/popup_item_ids.h" #include "components/autofill/core/browser/suggestion.h" #include "jni/AutofillKeyboardAccessoryBridge_jni.h" #include "ui/android/view_android.h" #include "ui/android/window_android.h" #include "ui/base/resource/resource_bundle.h" -#include "ui/gfx/geometry/rect.h" +using base::android::ConvertUTF16ToJavaString; using base::android::JavaParamRef; using base::android::JavaRef; using base::android::ScopedJavaLocalRef; @@ -27,75 +27,43 @@ namespace autofill { AutofillKeyboardAccessoryView::AutofillKeyboardAccessoryView( - AutofillPopupController* controller, - unsigned int animation_duration_millis, - bool should_limit_label_width) - : controller_(controller), - animation_duration_millis_(animation_duration_millis), - should_limit_label_width_(should_limit_label_width), - deleting_index_(-1) { - JNIEnv* env = base::android::AttachCurrentThread(); - java_object_.Reset(Java_AutofillKeyboardAccessoryBridge_create(env)); + AutofillPopupController* controller) + : controller_(controller) { + java_object_.Reset(Java_AutofillKeyboardAccessoryBridge_create( + base::android::AttachCurrentThread())); } AutofillKeyboardAccessoryView::~AutofillKeyboardAccessoryView() { - JNIEnv* env = base::android::AttachCurrentThread(); - Java_AutofillKeyboardAccessoryBridge_resetNativeViewPointer(env, - java_object_); + Java_AutofillKeyboardAccessoryBridge_resetNativeViewPointer( + base::android::AttachCurrentThread(), java_object_); +} + +void AutofillKeyboardAccessoryView::Initialize( + unsigned int animation_duration_millis, + bool should_limit_label_width) { + ui::ViewAndroid* view_android = controller_->container_view(); + DCHECK(view_android); + Java_AutofillKeyboardAccessoryBridge_init( + base::android::AttachCurrentThread(), java_object_, + reinterpret_cast<intptr_t>(this), + view_android->GetWindowAndroid()->GetJavaObject(), + animation_duration_millis, should_limit_label_width); +} + +void AutofillKeyboardAccessoryView::Hide() { + Java_AutofillKeyboardAccessoryBridge_dismiss( + base::android::AttachCurrentThread(), java_object_); } void AutofillKeyboardAccessoryView::Show() { JNIEnv* env = base::android::AttachCurrentThread(); - ui::ViewAndroid* view_android = controller_->container_view(); - DCHECK(view_android); - Java_AutofillKeyboardAccessoryBridge_init( - env, java_object_, reinterpret_cast<intptr_t>(this), - view_android->GetWindowAndroid()->GetJavaObject(), - animation_duration_millis_, should_limit_label_width_); - - OnSuggestionsChanged(); -} - -void AutofillKeyboardAccessoryView::Hide() { - controller_ = nullptr; - JNIEnv* env = base::android::AttachCurrentThread(); - Java_AutofillKeyboardAccessoryBridge_dismiss(env, java_object_); -} - -void AutofillKeyboardAccessoryView::OnSelectedRowChanged( - base::Optional<int> previous_row_selection, - base::Optional<int> current_row_selection) {} - -void AutofillKeyboardAccessoryView::OnSuggestionsChanged() { - JNIEnv* env = base::android::AttachCurrentThread(); - size_t count = controller_->GetLineCount(); ScopedJavaLocalRef<jobjectArray> data_array = - Java_AutofillKeyboardAccessoryBridge_createAutofillSuggestionArray(env, - count); - auto is_front_item = [controller = controller_](int i) { - const Suggestion& suggestion = controller->GetSuggestionAt(i); - return suggestion.frontend_id == POPUP_ITEM_ID_CLEAR_FORM || - suggestion.frontend_id == POPUP_ITEM_ID_CREATE_HINT; - }; + Java_AutofillKeyboardAccessoryBridge_createAutofillSuggestionArray( + env, controller_->GetLineCount()); - positions_.resize(count); - std::iota(positions_.begin(), positions_.end(), 0); - // Only one front item may exist! - DCHECK_LT(std::count_if(positions_.begin(), positions_.end(), is_front_item), - 2); - - // Place the "CLEAR FORM" or "CREATE HINT" item first in the list. - auto item = std::find_if(positions_.begin(), positions_.end(), is_front_item); - if (item != positions_.end()) - std::rotate(positions_.begin(), item, item + 1); - - for (size_t i = 0; i < positions_.size(); ++i) { - const Suggestion& suggestion = controller_->GetSuggestionAt(positions_[i]); - - base::string16 label = controller_->GetElidedLabelAt(i); - if (label.empty()) - label = suggestion.additional_label; - + size_t position = 0; + for (int i = 0; i < controller_->GetLineCount(); ++i) { + const Suggestion& suggestion = controller_->GetSuggestionAt(i); int android_icon_id = 0; if (!suggestion.icon.empty()) { android_icon_id = ResourceMapper::MapFromChromiumId( @@ -103,64 +71,55 @@ } Java_AutofillKeyboardAccessoryBridge_addToAutofillSuggestionArray( - env, data_array, i, - base::android::ConvertUTF16ToJavaString(env, suggestion.value), - base::android::ConvertUTF16ToJavaString(env, label), android_icon_id, - suggestion.frontend_id, - controller_->GetRemovalConfirmationText(positions_[i], nullptr, - nullptr)); + env, data_array, position++, + ConvertUTF16ToJavaString(env, controller_->GetElidedValueAt(i)), + ConvertUTF16ToJavaString(env, controller_->GetElidedLabelAt(i)), + android_icon_id, suggestion.frontend_id, + controller_->GetRemovalConfirmationText(i, nullptr, nullptr)); } - Java_AutofillKeyboardAccessoryBridge_show(env, java_object_, data_array, controller_->IsRTL()); } +void AutofillKeyboardAccessoryView::ConfirmDeletion( + const base::string16& confirmation_title, + const base::string16& confirmation_body, + base::OnceClosure confirm_deletion) { + JNIEnv* env = base::android::AttachCurrentThread(); + confirm_deletion_ = std::move(confirm_deletion); + Java_AutofillKeyboardAccessoryBridge_confirmDeletion( + env, java_object_, ConvertUTF16ToJavaString(env, confirmation_title), + ConvertUTF16ToJavaString(env, confirmation_body)); +} + void AutofillKeyboardAccessoryView::SuggestionSelected( JNIEnv* env, const JavaParamRef<jobject>& obj, jint list_index) { - // Race: Hide() may have already run. - if (controller_) - controller_->AcceptSuggestion(positions_[list_index]); + controller_->AcceptSuggestion(list_index); } void AutofillKeyboardAccessoryView::DeletionRequested( JNIEnv* env, const JavaParamRef<jobject>& obj, jint list_index) { - if (!controller_) - return; - - base::string16 confirmation_title, confirmation_body; - if (!controller_->GetRemovalConfirmationText( - positions_[list_index], &confirmation_title, &confirmation_body)) { - return; - } - - deleting_index_ = positions_[list_index]; - Java_AutofillKeyboardAccessoryBridge_confirmDeletion( - env, java_object_, - base::android::ConvertUTF16ToJavaString(env, confirmation_title), - base::android::ConvertUTF16ToJavaString(env, confirmation_body)); + controller_->RemoveSuggestion(list_index); } void AutofillKeyboardAccessoryView::DeletionConfirmed( JNIEnv* env, const JavaParamRef<jobject>& obj) { - if (!controller_) + if (confirm_deletion_.is_null()) { + LOG(DFATAL) << "DeletionConfirmed called but no deletion is pending!"; return; - - CHECK_GE(deleting_index_, 0); - controller_->RemoveSuggestion(deleting_index_); + } + std::move(confirm_deletion_).Run(); } void AutofillKeyboardAccessoryView::ViewDismissed( JNIEnv* env, const JavaParamRef<jobject>& obj) { - if (controller_) - controller_->ViewDestroyed(); - - delete this; + controller_->ViewDestroyed(); } } // namespace autofill
diff --git a/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h b/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h index ac4f292..df5f953 100644 --- a/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h +++ b/chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h
@@ -10,8 +10,10 @@ #include <vector> #include "base/android/scoped_java_ref.h" +#include "base/callback.h" #include "base/compiler_specific.h" #include "base/macros.h" +#include "chrome/browser/autofill/autofill_keyboard_accessory_adapter.h" #include "chrome/browser/ui/autofill/autofill_popup_view.h" namespace autofill { @@ -21,55 +23,49 @@ // A suggestion view that acts as an alternative to the field-attached popup // window. This view appears above the keyboard and spans the width of the // screen, condensing rather than overlaying the content area. -class AutofillKeyboardAccessoryView : public AutofillPopupView { +class AutofillKeyboardAccessoryView + : public AutofillKeyboardAccessoryAdapter::AccessoryView { public: - AutofillKeyboardAccessoryView(AutofillPopupController* controller, - unsigned int animation_duration_millis, - bool should_limit_label_width); + explicit AutofillKeyboardAccessoryView(AutofillPopupController* controller); + ~AutofillKeyboardAccessoryView() override; + + // Implementation of AutofillKeyboardAccessoryAdapter::AccessoryView. + void Initialize(unsigned int animation_duration_millis, + bool should_limit_label_width) override; + void Hide() override; + void Show() override; + void ConfirmDeletion(const base::string16& confirmation_title, + const base::string16& confirmation_body, + base::OnceClosure confirm_deletion) override; // -------------------------------------------------------------------------- // Methods called from Java via JNI // -------------------------------------------------------------------------- + // Called when an autofill item was selected. void SuggestionSelected(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, jint list_index); + // Called when the deletion of an autofill item was requested. void DeletionRequested(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj, jint list_index); + // Called when the deletion of an autofill item was confirmed. void DeletionConfirmed(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); + // Called when this view was dismissed. void ViewDismissed(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); - protected: - // AutofillPopupView implementation. - void Show() override; - void Hide() override; - void OnSelectedRowChanged(base::Optional<int> previous_row_selection, - base::Optional<int> current_row_selection) override; - void OnSuggestionsChanged() override; - private: - ~AutofillKeyboardAccessoryView() override; + // Weak reference to owner of this class. Always outlives this view. + AutofillPopupController* controller_; - AutofillPopupController* controller_; // weak. - - // If 0, don't animate suggestion view. - const unsigned int animation_duration_millis_; - - // If true, limits label width to 1/2 device's width. - const bool should_limit_label_width_; - - // The index of the last item the user long-pressed (they will be shown a - // confirmation dialog). - int deleting_index_; - - // Mapping from Java list index to autofill suggestion index. - std::vector<int> positions_; + // Call to confirm a requested deletion. + base::OnceClosure confirm_deletion_; // The corresponding java object. base::android::ScopedJavaGlobalRef<jobject> java_object_;
diff --git a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc index bb2be610..e804e04 100644 --- a/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc +++ b/chrome/browser/ui/android/autofill/autofill_popup_view_android.cc
@@ -10,6 +10,7 @@ #include "base/android/jni_string.h" #include "base/command_line.h" #include "chrome/browser/android/resource_mapper.h" +#include "chrome/browser/autofill/autofill_keyboard_accessory_adapter.h" #include "chrome/browser/ui/android/autofill/autofill_keyboard_accessory_view.h" #include "chrome/browser/ui/android/view_android_helper.h" #include "chrome/browser/ui/autofill/autofill_popup_controller.h" @@ -178,9 +179,12 @@ AutofillPopupView* AutofillPopupView::Create( AutofillPopupController* controller) { if (IsKeyboardAccessoryEnabled()) { - return new AutofillKeyboardAccessoryView( + auto adapter = std::make_unique<AutofillKeyboardAccessoryAdapter>( controller, GetKeyboardAccessoryAnimationDuration(), ShouldLimitKeyboardAccessorySuggestionLabelWidth()); + adapter->SetAccessoryView( + std::make_unique<AutofillKeyboardAccessoryView>(adapter.get())); + return adapter.release(); } auto popup_view = std::make_unique<AutofillPopupViewAndroid>(controller);
diff --git a/chrome/browser/ui/android/passwords/password_generation_popup_view_android.cc b/chrome/browser/ui/android/passwords/password_generation_editing_popup_view_android.cc similarity index 62% rename from chrome/browser/ui/android/passwords/password_generation_popup_view_android.cc rename to chrome/browser/ui/android/passwords/password_generation_editing_popup_view_android.cc index 48b6d6f..a5fa527 100644 --- a/chrome/browser/ui/android/passwords/password_generation_popup_view_android.cc +++ b/chrome/browser/ui/android/passwords/password_generation_editing_popup_view_android.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/ui/android/passwords/password_generation_popup_view_android.h" +#include "chrome/browser/ui/android/passwords/password_generation_editing_popup_view_android.h" #include <jni.h> @@ -21,11 +21,12 @@ using base::android::JavaParamRef; using base::android::ScopedJavaLocalRef; -PasswordGenerationPopupViewAndroid::PasswordGenerationPopupViewAndroid( - PasswordGenerationPopupController* controller) +PasswordGenerationEditingPopupViewAndroid:: + PasswordGenerationEditingPopupViewAndroid( + PasswordGenerationPopupController* controller) : controller_(controller) {} -void PasswordGenerationPopupViewAndroid::Dismissed( +void PasswordGenerationEditingPopupViewAndroid::Dismissed( JNIEnv* env, const JavaParamRef<jobject>& obj) { if (controller_) @@ -34,16 +35,10 @@ delete this; } -void PasswordGenerationPopupViewAndroid::PasswordSelected( - JNIEnv* env, - const JavaParamRef<jobject>& object) { - if (controller_) - controller_->PasswordAccepted(); -} +PasswordGenerationEditingPopupViewAndroid:: + ~PasswordGenerationEditingPopupViewAndroid() {} -PasswordGenerationPopupViewAndroid::~PasswordGenerationPopupViewAndroid() {} - -void PasswordGenerationPopupViewAndroid::Show() { +void PasswordGenerationEditingPopupViewAndroid::Show() { ui::ViewAndroid* view_android = controller_->container_view(); DCHECK(view_android); @@ -60,8 +55,8 @@ UpdateBoundsAndRedrawPopup(); } -void PasswordGenerationPopupViewAndroid::Hide() { - controller_ = NULL; +void PasswordGenerationEditingPopupViewAndroid::Hide() { + controller_ = nullptr; JNIEnv* env = base::android::AttachCurrentThread(); if (!java_object_.is_null()) { Java_PasswordGenerationPopupBridge_hide(env, java_object_); @@ -71,9 +66,9 @@ } } -void PasswordGenerationPopupViewAndroid::UpdateState() {} +void PasswordGenerationEditingPopupViewAndroid::UpdateState() {} -void PasswordGenerationPopupViewAndroid::UpdateBoundsAndRedrawPopup() { +void PasswordGenerationEditingPopupViewAndroid::UpdateBoundsAndRedrawPopup() { if (java_object_.is_null()) return; @@ -86,24 +81,16 @@ DCHECK(view_android); view_android->SetAnchorRect(view, controller_->element_bounds()); JNIEnv* env = base::android::AttachCurrentThread(); - ScopedJavaLocalRef<jstring> password = - base::android::ConvertUTF16ToJavaString(env, controller_->password()); - ScopedJavaLocalRef<jstring> suggestion = - base::android::ConvertUTF16ToJavaString(env, - controller_->SuggestedText()); ScopedJavaLocalRef<jstring> help = base::android::ConvertUTF16ToJavaString(env, controller_->HelpText()); - Java_PasswordGenerationPopupBridge_show( - env, java_object_, controller_->IsRTL(), - controller_->state() == - PasswordGenerationPopupController::kOfferGeneration, - password, suggestion, help); + Java_PasswordGenerationPopupBridge_show(env, java_object_, + controller_->IsRTL(), help); } -void PasswordGenerationPopupViewAndroid::PasswordSelectionUpdated() {} +void PasswordGenerationEditingPopupViewAndroid::PasswordSelectionUpdated() {} -bool PasswordGenerationPopupViewAndroid::IsPointInPasswordBounds( +bool PasswordGenerationEditingPopupViewAndroid::IsPointInPasswordBounds( const gfx::Point& point) { NOTREACHED(); return false; @@ -112,5 +99,5 @@ // static PasswordGenerationPopupView* PasswordGenerationPopupView::Create( PasswordGenerationPopupController* controller) { - return new PasswordGenerationPopupViewAndroid(controller); + return new PasswordGenerationEditingPopupViewAndroid(controller); }
diff --git a/chrome/browser/ui/android/passwords/password_generation_popup_view_android.h b/chrome/browser/ui/android/passwords/password_generation_editing_popup_view_android.h similarity index 69% rename from chrome/browser/ui/android/passwords/password_generation_popup_view_android.h rename to chrome/browser/ui/android/passwords/password_generation_editing_popup_view_android.h index 79a3bf5..38c073d 100644 --- a/chrome/browser/ui/android/passwords/password_generation_popup_view_android.h +++ b/chrome/browser/ui/android/passwords/password_generation_editing_popup_view_android.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_UI_ANDROID_PASSWORDS_PASSWORD_GENERATION_POPUP_VIEW_ANDROID_H_ -#define CHROME_BROWSER_UI_ANDROID_PASSWORDS_PASSWORD_GENERATION_POPUP_VIEW_ANDROID_H_ +#ifndef CHROME_BROWSER_UI_ANDROID_PASSWORDS_PASSWORD_GENERATION_EDITING_POPUP_VIEW_ANDROID_H_ +#define CHROME_BROWSER_UI_ANDROID_PASSWORDS_PASSWORD_GENERATION_EDITING_POPUP_VIEW_ANDROID_H_ #include <jni.h> @@ -15,23 +15,23 @@ class PasswordGenerationPopupController; -// The android implementation of the password generation UI. -class PasswordGenerationPopupViewAndroid : public PasswordGenerationPopupView { +// The android implementation of the password generation explanation popup. +// Note that as opposed to the desktop generation popup, this one is not used +// for displaying a password suggestion, but only for displaying help text +// while the user is editing a generated password. +class PasswordGenerationEditingPopupViewAndroid + : public PasswordGenerationPopupView { public: // Builds the UI for the |controller|. - explicit PasswordGenerationPopupViewAndroid( + explicit PasswordGenerationEditingPopupViewAndroid( PasswordGenerationPopupController* controller); // Called from JNI when the popup was dismissed. void Dismissed(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); - // Called from JNI when the suggested password was selected. - void PasswordSelected(JNIEnv* env, - const base::android::JavaParamRef<jobject>& object); - private: // The popup owns itself. - virtual ~PasswordGenerationPopupViewAndroid(); + virtual ~PasswordGenerationEditingPopupViewAndroid(); // PasswordGenerationPopupView implementation. void Show() override; @@ -50,7 +50,7 @@ // Popup view to be anchored to the container. ui::ViewAndroid::ScopedAnchorView popup_; - DISALLOW_COPY_AND_ASSIGN(PasswordGenerationPopupViewAndroid); + DISALLOW_COPY_AND_ASSIGN(PasswordGenerationEditingPopupViewAndroid); }; -#endif // CHROME_BROWSER_UI_ANDROID_PASSWORDS_PASSWORD_GENERATION_POPUP_VIEW_ANDROID_H_ +#endif // CHROME_BROWSER_UI_ANDROID_PASSWORDS_PASSWORD_GENERATION_EDITING_POPUP_VIEW_ANDROID_H_
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.cc b/chrome/browser/ui/app_list/app_list_syncable_service.cc index 5547057..6af4d55 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.cc +++ b/chrome/browser/ui/app_list/app_list_syncable_service.cc
@@ -393,6 +393,9 @@ } HandleUpdateFinished(); + + if (wait_until_ready_to_sync_cb_) + std::move(wait_until_ready_to_sync_cb_).Run(); } void AppListSyncableService::AddObserverAndStart(Observer* observer) { @@ -779,6 +782,17 @@ InstallDefaultPageBreaks(); } +void AppListSyncableService::WaitUntilReadyToSync(base::OnceClosure done) { + DCHECK(!wait_until_ready_to_sync_cb_); + + if (IsInitialized()) { + std::move(done).Run(); + } else { + // Wait until initialization is completed in BuildModel(); + wait_until_ready_to_sync_cb_ = std::move(done); + } +} + syncer::SyncMergeResult AppListSyncableService::MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data,
diff --git a/chrome/browser/ui/app_list/app_list_syncable_service.h b/chrome/browser/ui/app_list/app_list_syncable_service.h index 1773294..965b24e 100644 --- a/chrome/browser/ui/app_list/app_list_syncable_service.h +++ b/chrome/browser/ui/app_list/app_list_syncable_service.h
@@ -167,6 +167,7 @@ const SyncItemMap& sync_items() const { return sync_items_; } // syncer::SyncableService + void WaitUntilReadyToSync(base::OnceClosure done) override; syncer::SyncMergeResult MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, @@ -321,6 +322,7 @@ bool first_app_list_sync_; const bool is_app_service_enabled_; std::string oem_folder_name_; + base::OnceClosure wait_until_ready_to_sync_cb_; // List of observers. base::ObserverList<Observer>::Unchecked observer_list_;
diff --git a/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc b/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc index b3ec1c68..d1a3031 100644 --- a/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc +++ b/chrome/browser/ui/app_list/arc/arc_package_syncable_service.cc
@@ -121,6 +121,8 @@ } void ArcPackageSyncableService::WaitUntilReadyToSync(base::OnceClosure done) { + DCHECK(!wait_until_ready_to_sync_cb_); + if (prefs_->package_list_initial_refreshed()) { std::move(done).Run(); return;
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index 697dbdcd..44dca67 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h
@@ -263,7 +263,7 @@ CROSTINI_UPGRADE = 89, HATS_BUBBLE = 90, CROSTINI_APP_RESTART = 91, - INCOGNITO_WINDOW_COUNTER = 92, + INCOGNITO_WINDOW_COUNT = 92, CROSTINI_APP_UNINSTALLER = 93, CROSTINI_CONTAINER_UPGRADE = 94, // Add values above this line with a corresponding label in
diff --git a/chrome/browser/ui/chrome_bubble_manager.cc b/chrome/browser/ui/chrome_bubble_manager.cc index 7025a7c2..eb2ae5a 100644 --- a/chrome/browser/ui/chrome_bubble_manager.cc +++ b/chrome/browser/ui/chrome_bubble_manager.cc
@@ -179,3 +179,6 @@ LogBubbleCloseReason(bubble, reason); } + +void ChromeBubbleManager::ChromeBubbleMetrics::OnBubbleShown( + BubbleReference bubble) {}
diff --git a/chrome/browser/ui/chrome_bubble_manager.h b/chrome/browser/ui/chrome_bubble_manager.h index db668eb9..9a51659 100644 --- a/chrome/browser/ui/chrome_bubble_manager.h +++ b/chrome/browser/ui/chrome_bubble_manager.h
@@ -42,6 +42,7 @@ void OnBubbleNeverShown(BubbleReference bubble) override; void OnBubbleClosed(BubbleReference bubble, BubbleCloseReason reason) override; + void OnBubbleShown(BubbleReference bubble) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeBubbleMetrics);
diff --git a/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm b/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm index 233ba61..e05cba5 100644 --- a/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm +++ b/chrome/browser/ui/cocoa/browser_window_mac_browsertest.mm
@@ -15,7 +15,9 @@ #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/test/base/in_process_browser_test.h" #include "content/public/browser/notification_service.h" +#include "content/public/common/content_switches.h" #include "content/public/test/test_utils.h" +#include "ui/base/test/ns_ax_tree_validator.h" // Test harness for Mac-specific behaviors of BrowserWindow. class BrowserWindowMacTest : public InProcessBrowserTest { @@ -61,3 +63,33 @@ // which currently asks |super|. That is, NSWindow. Which says YES. EXPECT_TRUE([window validateUserInterfaceItem:bookmark_menu_item]); } + +class BrowserWindowMacA11yTest : public BrowserWindowMacTest { + public: + BrowserWindowMacA11yTest() = default; + ~BrowserWindowMacA11yTest() override = default; + + void SetUpCommandLine(base::CommandLine* command_line) override { + BrowserWindowMacTest::SetUpCommandLine(command_line); + command_line->AppendSwitch(switches::kForceRendererAccessibility); + } + + private: + DISALLOW_COPY_AND_ASSIGN(BrowserWindowMacA11yTest); +}; + +IN_PROC_BROWSER_TEST_F(BrowserWindowMacA11yTest, A11yTreeIsWellFormed) { + NSWindow* window = browser()->window()->GetNativeWindow().GetNativeNSWindow(); + size_t nodes_visited = 0; + base::Optional<ui::NSAXTreeProblemDetails> details = + ui::ValidateNSAXTree(window, &nodes_visited); + EXPECT_FALSE(details.has_value()) << details->ToString(); + + // There should be at least a handful of AX nodes in the tree - fail this test + // if for some reason (eg) the window has no children, which would otherwise + // be a well-formed AX tree. + EXPECT_GE(nodes_visited, 10U); + + if (HasFailure()) + ui::PrintNSAXTree(window); +}
diff --git a/chrome/browser/ui/sync/sync_promo_ui_unittest.cc b/chrome/browser/ui/sync/sync_promo_ui_unittest.cc index 08c01016..12bfed6 100644 --- a/chrome/browser/ui/sync/sync_promo_ui_unittest.cc +++ b/chrome/browser/ui/sync/sync_promo_ui_unittest.cc
@@ -13,7 +13,7 @@ #include "build/build_config.h" #include "chrome/common/chrome_switches.h" #include "chrome/test/base/testing_profile.h" -#include "components/browser_sync/browser_sync_switches.h" +#include "components/sync/driver/sync_driver_switches.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc index e9aadc1..b4e24ac 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
@@ -42,7 +42,7 @@ const int BackForwardMenuModel::kMaxHistoryItems = 12; const int BackForwardMenuModel::kMaxChapterStops = 5; -static const int kMaxWidth = 700; +static const int kMaxBackForwardMenuWidth = 700; BackForwardMenuModel::BackForwardMenuModel(Browser* browser, ModelType model_type) @@ -101,8 +101,9 @@ NavigationEntry* entry = GetNavigationEntry(index); base::string16 menu_text(entry->GetTitleForDisplay()); menu_text = ui::EscapeMenuLabelAmpersands(menu_text); - menu_text = gfx::ElideText(menu_text, gfx::FontList(), kMaxWidth, - gfx::ELIDE_TAIL, gfx::Typesetter::NATIVE); + menu_text = + gfx::ElideText(menu_text, gfx::FontList(), kMaxBackForwardMenuWidth, + gfx::ELIDE_TAIL, gfx::Typesetter::NATIVE); return menu_text; }
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc index fd3bcb40..66ba960 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views_unittest.cc
@@ -9,9 +9,8 @@ #include "base/no_destructor.h" #include "base/strings/string_util.h" #include "build/build_config.h" -#include "chrome/browser/ui/autofill/autofill_popup_controller.h" +#include "chrome/browser/autofill/mock_autofill_popup_controller.h" #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" -#include "chrome/browser/ui/views/autofill/autofill_popup_view_native_views.h" #include "chrome/test/views/chrome_views_test_base.h" #include "components/autofill/core/browser/popup_item_ids.h" #include "components/autofill/core/browser/suggestion.h" @@ -46,76 +45,6 @@ {autofill::POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY, 1}, }; -class MockAutofillPopupController : public autofill::AutofillPopupController { - public: - MockAutofillPopupController() { - gfx::FontList::SetDefaultFontDescription("Arial, Times New Roman, 15px"); - layout_model_ = std::make_unique<autofill::AutofillPopupLayoutModel>( - this, false /* is_credit_card_field */); - } - - // AutofillPopupViewDelegate - MOCK_METHOD0(Hide, void()); - MOCK_METHOD0(ViewDestroyed, void()); - MOCK_METHOD1(SetSelectionAtPoint, void(const gfx::Point& point)); - MOCK_METHOD0(AcceptSelectedLine, bool()); - MOCK_METHOD0(SelectionCleared, void()); - MOCK_CONST_METHOD0(HasSelection, bool()); - MOCK_CONST_METHOD0(popup_bounds, gfx::Rect()); - MOCK_CONST_METHOD0(container_view, gfx::NativeView()); - const gfx::RectF& element_bounds() const override { - static base::NoDestructor<gfx::RectF> bounds({100, 100, 250, 50}); - return *bounds; - } - MOCK_CONST_METHOD0(IsRTL, bool()); - const std::vector<autofill::Suggestion> GetSuggestions() override { - return suggestions_; - } -#if !defined(OS_ANDROID) - MOCK_METHOD1(SetTypesetter, void(gfx::Typesetter typesetter)); - MOCK_METHOD1(GetElidedValueWidthForRow, int(int row)); - MOCK_METHOD1(GetElidedLabelWidthForRow, int(int row)); -#endif - - // AutofillPopupController - MOCK_METHOD0(OnSuggestionsChanged, void()); - MOCK_METHOD1(AcceptSuggestion, void(int index)); - - int GetLineCount() const override { return suggestions_.size(); } - - const autofill::Suggestion& GetSuggestionAt(int row) const override { - return suggestions_[row]; - } - - const base::string16& GetElidedValueAt(int i) const override { - return suggestions_[i].value; - } - - const base::string16& GetElidedLabelAt(int row) const override { - return base::EmptyString16(); - } - - MOCK_METHOD3(GetRemovalConfirmationText, - bool(int index, base::string16* title, base::string16* body)); - MOCK_METHOD1(RemoveSuggestion, bool(int index)); - MOCK_CONST_METHOD1(GetBackgroundColorIDForRow, - ui::NativeTheme::ColorId(int index)); - MOCK_METHOD1(SetSelectedLine, void(base::Optional<int> selected_line)); - MOCK_CONST_METHOD0(selected_line, base::Optional<int>()); - const autofill::AutofillPopupLayoutModel& layout_model() const override { - return *layout_model_; - } - - void set_suggestions(const std::vector<int>& ids) { - for (const auto& id : ids) - suggestions_.push_back(autofill::Suggestion("", "", "", id)); - } - - private: - std::unique_ptr<autofill::AutofillPopupLayoutModel> layout_model_; - std::vector<autofill::Suggestion> suggestions_; -}; - class AutofillPopupViewNativeViewsTest : public ChromeViewsTestBase { public: AutofillPopupViewNativeViewsTest() = default; @@ -158,7 +87,7 @@ } std::unique_ptr<autofill::AutofillPopupViewNativeViews> view_; - MockAutofillPopupController autofill_popup_controller_; + autofill::MockAutofillPopupController autofill_popup_controller_; views::Widget widget_; std::unique_ptr<ui::test::EventGenerator> generator_;
diff --git a/chrome/browser/ui/views/intent_picker_bubble_view.cc b/chrome/browser/ui/views/intent_picker_bubble_view.cc index 564402e..bde11fa5 100644 --- a/chrome/browser/ui/views/intent_picker_bubble_view.cc +++ b/chrome/browser/ui/views/intent_picker_bubble_view.cc
@@ -46,7 +46,7 @@ // Main components sizes constexpr int kTitlePadding = 16; constexpr int kRowHeight = 32; -constexpr int kMaxWidth = 320; +constexpr int kMaxIntentPickerLabelButtonWidth = 320; constexpr gfx::Insets kSeparatorPadding(16, 0, 16, 0); constexpr SkColor kSeparatorColor = SkColorSetARGB(0x1F, 0x0, 0x0, 0x0); @@ -82,7 +82,7 @@ base::UTF8ToUTF16(base::StringPiece(display_name))), launch_name_(launch_name) { SetHorizontalAlignment(gfx::ALIGN_LEFT); - SetMinSize(gfx::Size(kMaxWidth, kRowHeight)); + SetMinSize(gfx::Size(kMaxIntentPickerLabelButtonWidth, kRowHeight)); SetInkDropMode(InkDropMode::ON); if (!icon->IsEmpty()) SetImage(views::ImageButton::STATE_NORMAL, *icon->ToImageSkia()); @@ -283,7 +283,7 @@ views::ColumnSet* cs = layout->AddColumnSet(kColumnSetId); cs->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, views::GridLayout::kFixedSize, views::GridLayout::FIXED, - kMaxWidth, 0); + kMaxIntentPickerLabelButtonWidth, 0); layout->StartRowWithPadding(views::GridLayout::kFixedSize, kColumnSetId, views::GridLayout::kFixedSize, kTitlePadding); @@ -298,7 +298,7 @@ cs_padded->AddPaddingColumn(views::GridLayout::kFixedSize, kTitlePadding); cs_padded->AddColumn(views::GridLayout::FILL, views::GridLayout::CENTER, views::GridLayout::kFixedSize, views::GridLayout::FIXED, - kMaxWidth - 2 * kTitlePadding, 0); + kMaxIntentPickerLabelButtonWidth - 2 * kTitlePadding, 0); layout->StartRowWithPadding(views::GridLayout::kFixedSize, kColumnSetIdPadded, views::GridLayout::kFixedSize, 0);
diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc index 372bbb90d..cb49fcc 100644 --- a/chrome/browser/ui/views/location_bar/location_icon_view.cc +++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc
@@ -117,7 +117,7 @@ bool LocationIconView::ShouldShowText() const { const auto* location_bar_model = delegate_->GetLocationBarModel(); - if (!location_bar_model->input_in_progress()) { + if (!delegate_->IsEditingOrEmpty()) { const GURL& url = location_bar_model->GetURL(); if (url.SchemeIs(content::kChromeUIScheme) || url.SchemeIs(extensions::kExtensionScheme) ||
diff --git a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc index 94914237..6b8e699 100644 --- a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc +++ b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.cc
@@ -174,6 +174,7 @@ case State::START_DOWNLOADING: case State::DOWNLOADING: case State::UNZIPPING: + case State::REGISTERING: return ui::DIALOG_BUTTON_CANCEL; case State::FINISHED: return ui::DIALOG_BUTTON_OK; @@ -187,7 +188,8 @@ switch (state_) { case State::START_DOWNLOADING: case State::DOWNLOADING: - case State::UNZIPPING: { + case State::UNZIPPING: + case State::REGISTERING: { DCHECK_EQ(button, ui::DIALOG_BUTTON_CANCEL); return l10n_util::GetStringUTF16(IDS_APP_CANCEL); } @@ -225,6 +227,9 @@ plugin_vm_image_manager_->CancelDownload(); if (state_ == State::UNZIPPING) plugin_vm_image_manager_->CancelUnzipping(); + + // TODO(https://crbug.com/947014): Cancel registering. + return true; } @@ -306,8 +311,11 @@ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK_EQ(state_, State::UNZIPPING); - state_ = State::FINISHED; + state_ = State::REGISTERING; OnStateUpdated(); + + // TODO(https://crbug.com/947014): Add call to register PluginVm image. + OnRegistered(true); } void PluginVmLauncherView::OnUnzippingFailed() { @@ -317,11 +325,27 @@ OnStateUpdated(); } +void PluginVmLauncherView::OnRegistered(bool success) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK_EQ(state_, State::REGISTERING); + + if (!success) { + state_ = State::ERROR; + OnStateUpdated(); + return; + } + + state_ = State::FINISHED; + OnStateUpdated(); + // TODO(https://crbug.com/904848): Mark image as registered. +} + base::string16 PluginVmLauncherView::GetBigMessage() { switch (state_) { case State::START_DOWNLOADING: case State::DOWNLOADING: case State::UNZIPPING: + case State::REGISTERING: return l10n_util::GetStringUTF16( IDS_PLUGIN_VM_LAUNCHER_ENVIRONMENT_SETTING_TITLE); case State::FINISHED: @@ -345,9 +369,9 @@ SetMessageLabel(); SetBigImage(); - const bool progress_bar_visible = state_ == State::START_DOWNLOADING || - state_ == State::DOWNLOADING || - state_ == State::UNZIPPING; + const bool progress_bar_visible = + state_ == State::START_DOWNLOADING || state_ == State::DOWNLOADING || + state_ == State::UNZIPPING || state_ == State::REGISTERING; progress_bar_->SetVisible(progress_bar_visible); // Values outside the range [0,1] display an infinite loading animation. progress_bar_->SetValue(-1); @@ -376,6 +400,9 @@ case State::UNZIPPING: return l10n_util::GetStringUTF16( IDS_PLUGIN_VM_LAUNCHER_UNZIPPING_MESSAGE); + case State::REGISTERING: + return l10n_util::GetStringUTF16( + IDS_PLUGIN_VM_LAUNCHER_REGISTERING_MESSAGE); case State::FINISHED: return l10n_util::GetStringUTF16(IDS_PLUGIN_VM_LAUNCHER_FINISHED_MESSAGE); case State::ERROR:
diff --git a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h index 84fecd10..1e7cc751 100644 --- a/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h +++ b/chrome/browser/ui/views/plugin_vm/plugin_vm_launcher_view.h
@@ -56,6 +56,7 @@ START_DOWNLOADING, // PluginVm image downloading should be started. DOWNLOADING, // PluginVm image downloading is in progress. UNZIPPING, // Downloaded PluginVm image unzipping is in progress. + REGISTERING, // PluginVm image registering is in progress. FINISHED, // PluginVm environment setting has been finished. ERROR, // Something unexpected happened. }; @@ -68,6 +69,8 @@ void AddedToWidget() override; private: + void OnRegistered(bool success); + base::string16 GetMessage() const; base::string16 GetDownloadProgressMessage(uint64_t downlaoded_bytes, int64_t content_length) const;
diff --git a/chrome/browser/ui/views/profiles/incognito_menu_view.cc b/chrome/browser/ui/views/profiles/incognito_menu_view.cc new file mode 100644 index 0000000..82405b06 --- /dev/null +++ b/chrome/browser/ui/views/profiles/incognito_menu_view.cc
@@ -0,0 +1,109 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/profiles/incognito_menu_view.h" + +#include <algorithm> +#include <string> +#include <utility> + +#include "base/bind.h" +#include "base/macros.h" +#include "base/metrics/histogram_macros.h" +#include "base/metrics/user_metrics.h" +#include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" +#include "chrome/app/vector_icons/vector_icons.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/views/chrome_layout_provider.h" +#include "chrome/browser/ui/views/hover_button.h" +#include "chrome/grit/generated_resources.h" +#include "ui/base/l10n/l10n_util.h" + +IncognitoMenuView::IncognitoMenuView(views::Button* anchor_button, + const gfx::Rect& anchor_rect, + gfx::NativeView parent_window, + Browser* browser) + : ProfileMenuViewBase(anchor_button, anchor_rect, parent_window, browser) { + DCHECK(browser->profile()->IsIncognito()); + + chrome::RecordDialogCreation( + chrome::DialogIdentifier::INCOGNITO_WINDOW_COUNT); + + base::RecordAction(base::UserMetricsAction("IncognitoMenu_Show")); +} + +IncognitoMenuView::~IncognitoMenuView() = default; + +void IncognitoMenuView::Reset() { + ProfileMenuViewBase::Reset(); + title_card_ = nullptr; + close_button_ = nullptr; +} + +void IncognitoMenuView::Init() { + Reset(); + AddIncognitoWindowCountView(); + RepopulateViewFromMenuItems(); +} + +views::View* IncognitoMenuView::GetInitiallyFocusedView() { + return ShouldProvideInitiallyFocusedView() ? title_card_ : nullptr; +} + +base::string16 IncognitoMenuView::GetAccessibleWindowTitle() const { + return l10n_util::GetStringUTF16(IDS_INCOGNITO_BUBBLE_ACCESSIBLE_TITLE); +} + +void IncognitoMenuView::ButtonPressed(views::Button* sender, + const ui::Event& event) { + DCHECK_EQ(sender, close_button_); + + // Skipping before-unload trigger to give incognito mode users a chance to + // quickly close all incognito windows without needing to confirm closing the + // open forms. + BrowserList::CloseAllBrowsersWithIncognitoProfile( + browser()->profile(), base::DoNothing(), base::DoNothing(), + true /* skip_beforeunload */); +} + +void IncognitoMenuView::AddIncognitoWindowCountView() { + ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); + int incognito_window_count = + BrowserList::GetIncognitoSessionsActiveForProfile(browser()->profile()); + // The icon color is set to match the menu text, which guarantees sufficient + // contrast and a consistent visual appearance. + const SkColor icon_color = provider->GetTypographyProvider().GetColor( + *this, views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY); + + auto incognito_icon = std::make_unique<views::ImageView>(); + incognito_icon->SetImage( + gfx::CreateVectorIcon(kIncognitoProfileIcon, icon_color)); + + // TODO(https://crbug.com/915120): This Button is never clickable. Replace + // by an alternative list item. + std::unique_ptr<HoverButton> title_card = std::make_unique<HoverButton>( + nullptr, std::move(incognito_icon), + l10n_util::GetStringUTF16(IDS_INCOGNITO_PROFILE_MENU_TITLE), + incognito_window_count > 1 + ? l10n_util::GetPluralStringFUTF16(IDS_INCOGNITO_WINDOW_COUNT_MESSAGE, + incognito_window_count) + : base::string16()); + title_card->SetEnabled(false); + title_card_ = title_card.get(); + + ProfileMenuViewBase::MenuItems menu_items; + menu_items.push_back(std::move(title_card)); + AddMenuItems(menu_items, true); + + std::unique_ptr<HoverButton> close_button = std::make_unique<HoverButton>( + this, gfx::CreateVectorIcon(kCloseAllIcon, 16, gfx::kChromeIconGrey), + l10n_util::GetStringUTF16(IDS_INCOGNITO_PROFILE_MENU_CLOSE_BUTTON)); + close_button_ = close_button.get(); + + menu_items.clear(); + menu_items.push_back(std::move(close_button)); + AddMenuItems(menu_items, true); +}
diff --git a/chrome/browser/ui/views/profiles/incognito_menu_view.h b/chrome/browser/ui/views/profiles/incognito_menu_view.h new file mode 100644 index 0000000..0e45dff --- /dev/null +++ b/chrome/browser/ui/views/profiles/incognito_menu_view.h
@@ -0,0 +1,56 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_INCOGNITO_MENU_VIEW_H_ +#define CHROME_BROWSER_UI_VIEWS_PROFILES_INCOGNITO_MENU_VIEW_H_ + +#include <stddef.h> + +#include <memory> + +#include "base/macros.h" +#include "chrome/browser/ui/views/profiles/profile_menu_view_base.h" + +namespace views { +class LabelButton; +} + +class Browser; + +// TODO(https://crbug.com/934689): Separation of providing content for different +// menus and the UI effort to view it between this class and +// |ProfileMenuViewBase| is in progress. + +// This bubble view is displayed when the user clicks on the avatar button in +// incognito mode and displays the incognito menu. +class IncognitoMenuView : public ProfileMenuViewBase, + public views::ButtonListener { + public: + IncognitoMenuView(views::Button* anchor_button, + const gfx::Rect& anchor_rect, + gfx::NativeView parent_window, + Browser* browser); + ~IncognitoMenuView() override; + + private: + // views::BubbleDialogDelegateView: + void Init() override; + views::View* GetInitiallyFocusedView() override; + base::string16 GetAccessibleWindowTitle() const override; + + // views::ButtonListener: + void ButtonPressed(views::Button* sender, const ui::Event& event) override; + + void Reset(); + + // Adds the incognito window count view. + void AddIncognitoWindowCountView(); + + views::LabelButton* title_card_; + views::LabelButton* close_button_; + + DISALLOW_COPY_AND_ASSIGN(IncognitoMenuView); +}; + +#endif // CHROME_BROWSER_UI_VIEWS_PROFILES_INCOGNITO_MENU_VIEW_H_
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc index 46701e7..c54d2592 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -26,7 +26,6 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_dialogs.h" -#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" #include "chrome/browser/ui/sync/sync_promo_ui.h" #include "chrome/browser/ui/views/accessibility/non_accessible_image_view.h" @@ -57,10 +56,6 @@ // Helpers -------------------------------------------------------------------- -constexpr int kFixedMenuWidthPreDice = 240; -constexpr int kFixedMenuWidthDice = 288; -constexpr int kIconSize = 16; - // Spacing between the edge of the user menu and the top/bottom or left/right of // the menu items. constexpr int kMenuEdgeMargin = 16; @@ -87,14 +82,6 @@ return BadgedProfilePhoto::BADGE_TYPE_NONE; } -gfx::ImageSkia CreateVectorIcon(const gfx::VectorIcon& icon) { - return gfx::CreateVectorIcon( - icon, kIconSize, - ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeEnabled() - ? gfx::kGoogleGrey500 - : gfx::kChromeIconGrey); -} - } // namespace // ProfileChooserView --------------------------------------------------------- @@ -102,32 +89,6 @@ // static bool ProfileChooserView::close_on_deactivate_for_testing_ = true; -// static -void ProfileChooserView::ShowBubble( - profiles::BubbleViewMode view_mode, - const signin::ManageAccountsParams& manage_accounts_params, - signin_metrics::AccessPoint access_point, - views::Button* anchor_button, - gfx::NativeView parent_window, - const gfx::Rect& anchor_rect, - Browser* browser, - bool is_source_keyboard) { - if (IsShowing()) - return; - - DCHECK_EQ(browser->profile()->IsIncognito(), - view_mode == profiles::BUBBLE_VIEW_MODE_INCOGNITO); - - ProfileChooserView* bubble = new ProfileChooserView( - anchor_button, anchor_rect, parent_window, browser, view_mode, - manage_accounts_params.service_type, access_point); - views::BubbleDialogDelegateView::CreateBubble(bubble)->Show(); - base::RecordAction(base::UserMetricsAction("ProfileChooser_Show")); - - if (is_source_keyboard) - bubble->FocusFirstProfileButton(); -} - ProfileChooserView::ProfileChooserView(views::Button* anchor_button, const gfx::Rect& anchor_rect, gfx::NativeView parent_window, @@ -142,13 +103,13 @@ dice_enabled_(AccountConsistencyModeManager::IsDiceEnabledForProfile( browser->profile())) { chrome::RecordDialogCreation(chrome::DialogIdentifier::PROFILE_CHOOSER); - set_menu_width(dice_enabled_ ? kFixedMenuWidthDice : kFixedMenuWidthPreDice); - ResetView(); + base::RecordAction(base::UserMetricsAction("ProfileChooser_Show")); } ProfileChooserView::~ProfileChooserView() = default; -void ProfileChooserView::ResetView() { +void ProfileChooserView::Reset() { + ProfileMenuViewBase::Reset(); open_other_profile_indexes_map_.clear(); sync_error_button_ = nullptr; signin_current_profile_button_ = nullptr; @@ -167,6 +128,7 @@ } void ProfileChooserView::Init() { + Reset(); set_close_on_deactivate(close_on_deactivate_for_testing_); avatar_menu_.reset(new AvatarMenu( @@ -210,15 +172,6 @@ return; } - if (browser()->profile()->IsOffTheRecord() && - !browser()->profile()->IsGuestSession() && - view_to_display != profiles::BUBBLE_VIEW_MODE_INCOGNITO) { - LOG(WARNING) << "Expected incognito menu in incognito mode."; - return; - } - - ResetView(); - ResetMenu(); view_mode_ = view_to_display; switch (view_mode_) { case profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN: @@ -228,12 +181,13 @@ // See |SigninViewController::ShouldShowSigninForMode|. NOTREACHED(); break; + case profiles::BUBBLE_VIEW_MODE_INCOGNITO: + // Covered in IncognitoView. + NOTREACHED(); + break; case profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER: AddProfileChooserView(avatar_menu); break; - case profiles::BUBBLE_VIEW_MODE_INCOGNITO: - AddIncognitoWindowCountView(); - break; } RepopulateViewFromMenuItems(); } @@ -251,7 +205,7 @@ } } -void ProfileChooserView::FocusFirstProfileButton() { +void ProfileChooserView::FocusButtonOnKeyboardOpen() { if (first_profile_button_) first_profile_button_->RequestFocus(); } @@ -267,23 +221,13 @@ } views::View* ProfileChooserView::GetInitiallyFocusedView() { -#if defined(OS_MACOSX) - // On Mac, buttons are not focusable when full keyboard access is turned off, - // causing views::Widget to fall back to focusing the first focusable View. - // This behavior is not desired in the |ProfileChooserView| because of its - // menu-like design using |HoverButtons|. Avoid this by returning null when - // full keyboard access is off. - if (!GetFocusManager() || !GetFocusManager()->keyboard_accessible()) - return nullptr; -#endif - return signin_current_profile_button_; + return ShouldProvideInitiallyFocusedView() ? signin_current_profile_button_ + : nullptr; } base::string16 ProfileChooserView::GetAccessibleWindowTitle() const { return l10n_util::GetStringUTF16( - view_mode_ == profiles::BUBBLE_VIEW_MODE_INCOGNITO - ? IDS_INCOGNITO_BUBBLE_ACCESSIBLE_TITLE - : IDS_PROFILES_PROFILE_BUBBLE_ACCESSIBLE_TITLE); + IDS_PROFILES_PROFILE_BUBBLE_ACCESSIBLE_TITLE); } void ProfileChooserView::ButtonPressed(views::Button* sender, @@ -311,14 +255,6 @@ // If this is a guest session, close all the guest browser windows. if (browser()->profile()->IsGuestSession()) { profiles::CloseGuestProfileWindows(); - } else if (browser()->profile()->GetProfileType() == - Profile::INCOGNITO_PROFILE) { - // Skipping before-unload trigger to give incognito mode users a chance to - // close all incognito windows without needing to confirm closing the open - // forms. - BrowserList::CloseAllBrowsersWithIncognitoProfile( - browser()->profile(), base::DoNothing(), base::DoNothing(), - true /* skip_beforeunload */); } else { base::RecordAction( base::UserMetricsAction("ProfileChooser_ManageClicked")); @@ -414,43 +350,6 @@ } } -void ProfileChooserView::AddIncognitoWindowCountView() { - ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); - int incognito_window_count = - BrowserList::GetIncognitoSessionsActiveForProfile(browser()->profile()); - auto incognito_icon = std::make_unique<views::ImageView>(); - // The icon color is set to match the menu text, which guarantees sufficient - // contrast and a consistent visual appearance. - const SkColor icon_color = provider->GetTypographyProvider().GetColor( - *this, views::style::CONTEXT_LABEL, views::style::STYLE_PRIMARY); - incognito_icon->SetImage( - gfx::CreateVectorIcon(kIncognitoProfileIcon, icon_color)); - - // TODO(https://crbug.com/915120): This Button is never clickable. Replace - // by an alternative list item. - std::unique_ptr<HoverButton> profile_card = std::make_unique<HoverButton>( - nullptr, std::move(incognito_icon), - l10n_util::GetStringUTF16(IDS_INCOGNITO_PROFILE_MENU_TITLE), - incognito_window_count > 1 - ? l10n_util::GetPluralStringFUTF16(IDS_INCOGNITO_WINDOW_COUNT_MESSAGE, - incognito_window_count) - : base::string16()); - profile_card->SetEnabled(false); - - ProfileMenuViewBase::MenuItems menu_items; - menu_items.push_back(std::move(profile_card)); - AddMenuItems(menu_items, true); - - std::unique_ptr<HoverButton> close_button = std::make_unique<HoverButton>( - this, gfx::CreateVectorIcon(kCloseAllIcon, 16, gfx::kChromeIconGrey), - l10n_util::GetStringUTF16(IDS_INCOGNITO_PROFILE_MENU_CLOSE_BUTTON)); - users_button_ = close_button.get(); - - menu_items.clear(); - menu_items.push_back(std::move(close_button)); - AddMenuItems(menu_items, true); -} - void ProfileChooserView::AddProfileChooserView(AvatarMenu* avatar_menu) { // Separate items into active and alternatives. const AvatarMenu::Item* active_item = nullptr; @@ -516,8 +415,8 @@ // Adds the sync problem icon. views::ImageView* sync_problem_icon = new views::ImageView(); - sync_problem_icon->SetImage( - gfx::CreateVectorIcon(kSyncProblemIcon, kIconSize, gfx::kGoogleRed700)); + sync_problem_icon->SetImage(gfx::CreateVectorIcon( + kSyncProblemIcon, GetDefaultIconSize(), gfx::kGoogleRed700)); view->AddChildView(sync_problem_icon); // Adds a vertical view to organize the error title, message, and button. @@ -859,7 +758,8 @@ const AvatarMenu::Item& item = avatar_menu->GetItemAt(i); if (!item.active) { gfx::Image image = profiles::GetSizedAvatarIcon( - item.icon, true, kIconSize, kIconSize, profiles::SHAPE_CIRCLE); + item.icon, true, GetDefaultIconSize(), GetDefaultIconSize(), + profiles::SHAPE_CIRCLE); std::unique_ptr<HoverButton> button = std::make_unique<HoverButton>( this, *image.ToImageSkia(), profiles::GetProfileSwitcherTextForItem(item)); @@ -899,7 +799,7 @@ if (display_lock) { std::unique_ptr<HoverButton> button = std::make_unique<HoverButton>( this, - gfx::CreateVectorIcon(vector_icons::kLockIcon, kIconSize, + gfx::CreateVectorIcon(vector_icons::kLockIcon, GetDefaultIconSize(), gfx::kChromeIconGrey), l10n_util::GetStringUTF16(IDS_PROFILES_PROFILE_SIGNOUT_BUTTON)); lock_button_ = button.get();
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.h b/chrome/browser/ui/views/profiles/profile_chooser_view.h index f1c2967..62aee0b 100644 --- a/chrome/browser/ui/views/profiles/profile_chooser_view.h +++ b/chrome/browser/ui/views/profiles/profile_chooser_view.h
@@ -41,30 +41,6 @@ public views::ButtonListener, public identity::IdentityManager::Observer { public: - // Shows the bubble if one is not already showing. This allows us to easily - // make a button toggle the bubble on and off when clicked: we unconditionally - // call this function when the button is clicked and if the bubble isn't - // showing it will appear while if it is showing, nothing will happen here and - // the existing bubble will auto-close due to focus loss. - // There are 2 ways to position the Bubble, if |anchor_button| is set, then - // |parent_window| and |anchor_rect| are ignored. Otherwise, |parent_window| - // and |anchor_rect| have to be set. - static void ShowBubble( - profiles::BubbleViewMode view_mode, - const signin::ManageAccountsParams& manage_accounts_params, - signin_metrics::AccessPoint access_point, - views::Button* anchor_button, - gfx::NativeView parent_window, - const gfx::Rect& anchor_rect, - Browser* browser, - bool is_source_keyboard); - - private: - friend class ProfileChooserViewExtensionsTest; - - typedef std::vector<size_t> Indexes; - typedef std::map<views::Button*, int> ButtonIndexes; - ProfileChooserView(views::Button* anchor_button, const gfx::Rect& anchor_rect, gfx::NativeView parent_window, @@ -74,6 +50,15 @@ signin_metrics::AccessPoint access_point); ~ProfileChooserView() override; + private: + friend class ProfileChooserViewExtensionsTest; + + typedef std::vector<size_t> Indexes; + typedef std::map<views::Button*, int> ButtonIndexes; + + // ProfileMenuViewBase: + void FocusButtonOnKeyboardOpen() override; + // views::BubbleDialogDelegateView: void Init() override; void OnWidgetClosing(views::Widget* widget) override; @@ -95,7 +80,7 @@ // Tests set this to "false" for more consistent operation. static bool close_on_deactivate_for_testing_; - void ResetView(); + void Reset(); // Shows the bubble with the |view_to_display|. void ShowView(profiles::BubbleViewMode view_to_display, @@ -103,15 +88,9 @@ // Shows the bubble view or opens a tab based on given |mode|. void ShowViewOrOpenTab(profiles::BubbleViewMode mode); - // Focuses the first profile button in the menu list. - void FocusFirstProfileButton(); - // Adds the profile chooser view. void AddProfileChooserView(AvatarMenu* avatar_menu); - // Adds the incognito window count view. - void AddIncognitoWindowCountView(); - // Adds the main profile card for the profile |avatar_item|. |is_guest| is // used to determine whether to show any Sign in/Sign out/Manage accounts // links.
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc index b5a48b0c..e93d132 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
@@ -10,8 +10,12 @@ #include "base/macros.h" #include "build/build_config.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/account_consistency_mode_manager.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" +#include "chrome/browser/ui/views/profiles/incognito_menu_view.h" +#include "chrome/browser/ui/views/profiles/profile_chooser_view.h" #include "chrome/grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/display/display.h" @@ -25,6 +29,10 @@ // Helpers -------------------------------------------------------------------- +constexpr int kFixedMenuWidthPreDice = 240; +constexpr int kFixedMenuWidthDice = 288; +constexpr int kIconSize = 16; + // If the bubble is too large to fit on the screen, it still needs to be at // least this tall to show one row. constexpr int kMinimumScrollableContentHeight = 40; @@ -34,6 +42,37 @@ // ProfileMenuViewBase --------------------------------------------------------- // static +void ProfileMenuViewBase::ShowBubble( + profiles::BubbleViewMode view_mode, + const signin::ManageAccountsParams& manage_accounts_params, + signin_metrics::AccessPoint access_point, + views::Button* anchor_button, + gfx::NativeView parent_window, + const gfx::Rect& anchor_rect, + Browser* browser, + bool is_source_keyboard) { + if (IsShowing()) + return; + + DCHECK_EQ(browser->profile()->IsIncognito(), + view_mode == profiles::BUBBLE_VIEW_MODE_INCOGNITO); + + ProfileMenuViewBase* bubble; + if (view_mode == profiles::BUBBLE_VIEW_MODE_INCOGNITO) { + bubble = new IncognitoMenuView(anchor_button, anchor_rect, parent_window, + browser); + } else { + bubble = new ProfileChooserView( + anchor_button, anchor_rect, parent_window, browser, view_mode, + manage_accounts_params.service_type, access_point); + } + + views::BubbleDialogDelegateView::CreateBubble(bubble)->Show(); + if (is_source_keyboard) + bubble->FocusButtonOnKeyboardOpen(); +} + +// static bool ProfileMenuViewBase::IsShowing() { return g_profile_bubble_ != nullptr; } @@ -75,6 +114,10 @@ // The arrow keys can be used to tab between items. AddAccelerator(ui::Accelerator(ui::VKEY_DOWN, ui::EF_NONE)); AddAccelerator(ui::Accelerator(ui::VKEY_UP, ui::EF_NONE)); + + bool dice_enabled = AccountConsistencyModeManager::IsDiceEnabledForProfile( + browser->profile()); + menu_width_ = dice_enabled ? kFixedMenuWidthDice : kFixedMenuWidthPreDice; } ProfileMenuViewBase::~ProfileMenuViewBase() { @@ -150,7 +193,7 @@ return std::max(kMinimumScrollableContentHeight, available_space); } -void ProfileMenuViewBase::ResetMenu() { +void ProfileMenuViewBase::Reset() { menu_item_groups_.clear(); } @@ -216,3 +259,28 @@ Layout(); } } + +gfx::ImageSkia ProfileMenuViewBase::CreateVectorIcon( + const gfx::VectorIcon& icon) { + return gfx::CreateVectorIcon( + icon, kIconSize, + ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeEnabled() + ? gfx::kGoogleGrey500 + : gfx::kChromeIconGrey); +} + +int ProfileMenuViewBase::GetDefaultIconSize() { + return kIconSize; +} + +bool ProfileMenuViewBase::ShouldProvideInitiallyFocusedView() const { +#if defined(OS_MACOSX) + // On Mac, buttons are not focusable when full keyboard access is turned off, + // causing views::Widget to fall back to focusing the first focusable View. + // This behavior is not desired in profile menus because of the menu-like + // design using |HoverButtons|. + if (!GetFocusManager() || !GetFocusManager()->keyboard_accessible()) + return false; +#endif + return true; +} \ No newline at end of file
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.h b/chrome/browser/ui/views/profiles/profile_menu_view_base.h index 1b9cd83..d46f94f 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.h +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.h
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/close_bubble_on_tab_activation_helper.h" #include "content/public/browser/web_contents_delegate.h" +#include "ui/gfx/paint_vector_icon.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/link_listener.h" @@ -34,6 +35,24 @@ public views::BubbleDialogDelegateView, public views::StyledLabelListener { public: + // Shows the bubble if one is not already showing. This allows us to easily + // make a button toggle the bubble on and off when clicked: we unconditionally + // call this function when the button is clicked and if the bubble isn't + // showing it will appear while if it is showing, nothing will happen here and + // the existing bubble will auto-close due to focus loss. + // There are 2 ways to position the Bubble, if |anchor_button| is set, then + // |parent_window| and |anchor_rect| are ignored. Otherwise, |parent_window| + // and |anchor_rect| have to be set. + static void ShowBubble( + profiles::BubbleViewMode view_mode, + const signin::ManageAccountsParams& manage_accounts_params, + signin_metrics::AccessPoint access_point, + views::Button* anchor_button, + gfx::NativeView parent_window, + const gfx::Rect& anchor_rect, + Browser* browser, + bool is_source_keyboard); + static bool IsShowing(); static void Hide(); @@ -48,7 +67,7 @@ Browser* browser); ~ProfileMenuViewBase() override; - void ResetMenu(); + void Reset(); // Adds a set of menu items, either as a |new_group| (using a separator) or // appended to the last added items. Takes ownership of the items and passes // them to the underlying view when menu is built using @@ -64,14 +83,24 @@ views::Button* anchor_button() const { return anchor_button_; } - // TODO(https://crbug.com/934689): Remove menu_width functions and make - // decision inside this class. + bool ShouldProvideInitiallyFocusedView() const; + + // TODO(https://crbug.com/934689): Remove menu_width function and make + // decisions inside this class. int menu_width() { return menu_width_; } - void set_menu_width(int menu_width) { menu_width_ = menu_width; } + + gfx::ImageSkia CreateVectorIcon(const gfx::VectorIcon& icon); + + // TODO(https://crbug.com/934689): Remove function and make decisions inside + // this class. + int GetDefaultIconSize(); private: friend class ProfileChooserViewExtensionsTest; + // Requests focus for a button when opened by keyboard. + virtual void FocusButtonOnKeyboardOpen() {} + // views::BubbleDialogDelegateView: void WindowClosing() override; void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override;
diff --git a/chrome/browser/ui/views/tabs/tab_icon.cc b/chrome/browser/ui/views/tabs/tab_icon.cc index 62a1c255..abc8f3a 100644 --- a/chrome/browser/ui/views/tabs/tab_icon.cc +++ b/chrome/browser/ui/views/tabs/tab_icon.cc
@@ -107,6 +107,7 @@ SetIcon(data.url, data.favicon); SetNetworkState(data.network_state); SetIsCrashed(data.IsCrashed()); + has_tab_renderer_data_ = true; const bool showing_load = ShowingLoadingAnimation(); @@ -392,10 +393,16 @@ hiding_fraction_ = 0.0; } else { // Transitioned from non-crashed to crashed. - if (!crash_animation_) - crash_animation_ = std::make_unique<CrashAnimation>(this); - if (!crash_animation_->is_animating()) - crash_animation_->Start(); + if (!has_tab_renderer_data_) { + // This is the initial SetData(), so show the crashed icon directly + // without animating. + should_display_crashed_favicon_ = true; + } else { + if (!crash_animation_) + crash_animation_ = std::make_unique<CrashAnimation>(this); + if (!crash_animation_->is_animating()) + crash_animation_->Start(); + } } SchedulePaint(); }
diff --git a/chrome/browser/ui/views/tabs/tab_icon.h b/chrome/browser/ui/views/tabs/tab_icon.h index 0a71546..1acd727 100644 --- a/chrome/browser/ui/views/tabs/tab_icon.h +++ b/chrome/browser/ui/views/tabs/tab_icon.h
@@ -161,6 +161,8 @@ SkColor bg_color_ = SK_ColorBLACK; + bool has_tab_renderer_data_ = false; + DISALLOW_COPY_AND_ASSIGN(TabIcon); };
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc index 86ec987..607215a 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.cc +++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -805,15 +805,6 @@ base::STLSetDifference<ui::ListSelectionModel::SelectedIndices>( new_selection.selected_indices(), selected_tabs_.selected_indices()); - // Fire accessibility events that reflect the changes to selection. - for (auto tab_index : no_longer_selected) { - tab_at(tab_index)->NotifyAccessibilityEvent( - ax::mojom::Event::kSelectionRemove, true); - } - for (auto tab_index : newly_selected) { - tab_at(tab_index)->NotifyAccessibilityEvent(ax::mojom::Event::kSelectionAdd, - true); - } tab_at(new_selection.active()) ->NotifyAccessibilityEvent(ax::mojom::Event::kSelection, true); selected_tabs_ = new_selection; @@ -828,6 +819,16 @@ } } +void TabStrip::OnWidgetActivationChanged(views::Widget* widget, bool active) { + if (active && selected_tabs_.active() >= 0) { + // When the browser window is activated, fire a selection event on the + // currently active tab, to help enable per-tab modes in assistive + // technologies. + tab_at(selected_tabs_.active()) + ->NotifyAccessibilityEvent(ax::mojom::Event::kSelection, true); + } +} + void TabStrip::SetTabNeedsAttention(int model_index, bool attention) { tab_at(model_index)->SetTabNeedsAttention(attention); } @@ -2791,6 +2792,14 @@ UpdateHoverCard(nullptr, false); } +void TabStrip::AddedToWidget() { + GetWidget()->AddObserver(this); +} + +void TabStrip::RemovedFromWidget() { + GetWidget()->RemoveObserver(this); +} + void TabStrip::OnGestureEvent(ui::GestureEvent* event) { SetResetToShrinkOnExit(false); switch (event->type()) {
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h index 2c0b4feb0..977a336f 100644 --- a/chrome/browser/ui/views/tabs/tab_strip.h +++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -34,6 +34,7 @@ #include "ui/views/view.h" #include "ui/views/view_model.h" #include "ui/views/view_targeter_delegate.h" +#include "ui/views/widget/widget_observer.h" class NewTabButton; class StackedTabStripLayout; @@ -72,6 +73,7 @@ public views::MouseWatcherListener, public views::ViewObserver, public views::ViewTargeterDelegate, + public views::WidgetObserver, public TabController, public BrowserRootView::DropTarget, public ui::MaterialDesignControllerObserver { @@ -625,6 +627,8 @@ void OnMouseMoved(const ui::MouseEvent& event) override; void OnMouseEntered(const ui::MouseEvent& event) override; void OnMouseExited(const ui::MouseEvent& event) override; + void AddedToWidget() override; + void RemovedFromWidget() override; // ui::EventHandler: void OnGestureEvent(ui::GestureEvent* event) override; @@ -635,6 +639,9 @@ // views::ViewObserver: void OnViewIsDeleting(views::View* observed_view) override; + // views::WidgetObserver: + void OnWidgetActivationChanged(views::Widget* widget, bool active) override; + // ui::MaterialDesignControllerObserver: void OnTouchUiChanged() override;
diff --git a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc index 74b792de..17f6058b 100644 --- a/chrome/browser/ui/views/tabs/tab_strip_unittest.cc +++ b/chrome/browser/ui/views/tabs/tab_strip_unittest.cc
@@ -62,16 +62,21 @@ if (event_type == ax::mojom::Event::kSelectionRemove) { remove_count_++; } + if (event_type == ax::mojom::Event::kSelection) { + change_count_++; + } if (event_type == ax::mojom::Event::kSelectionAdd) { add_count_++; } } int add_count() { return add_count_; } + int change_count() { return change_count_; } int remove_count() { return remove_count_; } private: int add_count_ = 0; + int change_count_ = 0; int remove_count_ = 0; DISALLOW_COPY_AND_ASSIGN(TestAXEventObserver); @@ -278,7 +283,8 @@ ui::ListSelectionModel selection; selection.SetSelectedIndex(1); tab_strip_->SetSelection(selection); - EXPECT_EQ(1, observer.add_count()); + EXPECT_EQ(0, observer.add_count()); + EXPECT_EQ(1, observer.change_count()); EXPECT_EQ(0, observer.remove_count()); // When removing tabs, SetSelection() is called before RemoveTabAt(), as @@ -286,8 +292,15 @@ selection.SetSelectedIndex(0); tab_strip_->SetSelection(selection); tab_strip_->RemoveTabAt(nullptr, 1, true); - EXPECT_EQ(2, observer.add_count()); - EXPECT_EQ(1, observer.remove_count()); + EXPECT_EQ(0, observer.add_count()); + EXPECT_EQ(2, observer.change_count()); + EXPECT_EQ(0, observer.remove_count()); + + // When activating widget, refire selection event on tab. + widget_->OnNativeWidgetActivationChanged(true); + EXPECT_EQ(0, observer.add_count()); + EXPECT_EQ(3, observer.change_count()); + EXPECT_EQ(0, observer.remove_count()); } TEST_P(TabStripTest, AccessibilityData) {
diff --git a/chrome/browser/ui/views/toolbar/reload_button.cc b/chrome/browser/ui/views/toolbar/reload_button.cc index 8f301b3..0071f52 100644 --- a/chrome/browser/ui/views/toolbar/reload_button.cc +++ b/chrome/browser/ui/views/toolbar/reload_button.cc
@@ -89,9 +89,6 @@ void ReloadButton::LoadImages() { ChangeModeInternal(visible_mode_); - - SchedulePaint(); - PreferredSizeChanged(); } void ReloadButton::OnMouseExited(const ui::MouseEvent& event) {
diff --git a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc index 6293cb9..57c6e84 100644 --- a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.cc
@@ -4,12 +4,35 @@ #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" +#include "chrome/browser/chromeos/login/screens/base_screen.h" +#include "chrome/browser/ui/webui/chromeos/login/base_webui_handler.h" +#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" + namespace chromeos { BaseScreenHandler::BaseScreenHandler(OobeScreen oobe_screen, JSCallsContainer* js_calls_container) : BaseWebUIHandler(js_calls_container), oobe_screen_(oobe_screen) {} -BaseScreenHandler::~BaseScreenHandler() {} +BaseScreenHandler::~BaseScreenHandler() = default; + +void BaseScreenHandler::SetBaseScreen(BaseScreen* base_screen) { + if (base_screen_ == base_screen) + return; + base_screen_ = base_screen; +} + +void BaseScreenHandler::RegisterMessages() { + if (!user_acted_method_path_.empty()) { + AddCallback(user_acted_method_path_, &BaseScreenHandler::HandleUserAction); + } + + BaseWebUIHandler::RegisterMessages(); +} + +void BaseScreenHandler::HandleUserAction(const std::string& action_id) { + if (base_screen_) + base_screen_->OnUserAction(action_id); +} } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h index dcbbded..027f4a8b 100644 --- a/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/base_screen_handler.h
@@ -11,6 +11,8 @@ namespace chromeos { +class BaseScreen; + // Base class for the OOBE/Login WebUI handlers which provide methods specific // to a particular OobeScreen. class BaseScreenHandler : public BaseWebUIHandler { @@ -21,10 +23,35 @@ OobeScreen oobe_screen() const { return oobe_screen_; } + void SetBaseScreen(BaseScreen* base_screen); + + // BaseWebUIHandler: + void RegisterMessages() override; + + protected: + // Set the method identifier for a userActed callback. The actual callback + // will be registered in RegisterMessages so this should be called in the + // constructor. This takes the full method path, ie, + // "login.WelcomeScreen.userActed". + // + // If this is not called then userActed-style callbacks will not be available + // for the screen. + void set_user_acted_method_path(const std::string& user_acted_method_path) { + user_acted_method_path_ = user_acted_method_path; + } + private: + // Handles user action. + void HandleUserAction(const std::string& action_id); + + // Path that is used to invoke user actions. + std::string user_acted_method_path_; + // OobeScreen that this handler corresponds to. OobeScreen oobe_screen_ = OobeScreen::SCREEN_UNKNOWN; + BaseScreen* base_screen_ = nullptr; + DISALLOW_COPY_AND_ASSIGN(BaseScreenHandler); };
diff --git a/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc b/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc index 0ef7a22..021907c 100644 --- a/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/base_webui_handler.cc
@@ -8,7 +8,6 @@ #include "base/logging.h" #include "base/values.h" -#include "chrome/browser/chromeos/login/screens/base_screen.h" #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "components/login/localized_values_builder.h" #include "content/public/browser/web_ui.h" @@ -32,10 +31,6 @@ } void BaseWebUIHandler::RegisterMessages() { - if (!user_acted_method_path_.empty()) { - AddCallback(user_acted_method_path_, &BaseScreenHandler::HandleUserAction); - } - DeclareJSCallbacks(); } @@ -68,12 +63,6 @@ return oobe_ui->current_screen(); } -void BaseWebUIHandler::SetBaseScreen(BaseScreen* base_screen) { - if (base_screen_ == base_screen) - return; - base_screen_ = base_screen; -} - void BaseWebUIHandler::InsertIntoList(std::vector<base::Value>*) {} void BaseWebUIHandler::MaybeRecordIncomingEvent( @@ -96,9 +85,4 @@ callback.Run(args); } -void BaseWebUIHandler::HandleUserAction(const std::string& action_id) { - if (base_screen_) - base_screen_->OnUserAction(action_id); -} - } // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h b/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h index 014392c..2d9a98b 100644 --- a/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/base_webui_handler.h
@@ -29,7 +29,6 @@ namespace chromeos { -class BaseScreen; class OobeUI; // Base class for all oobe/login WebUI handlers. These handlers are the binding @@ -37,9 +36,6 @@ // // If the deriving type is associated with a specific OobeScreen, it should // derive from BaseScreenHandler instead of BaseWebUIHandler. -// -// TODO(jdufault): Move all OobeScreen related concepts out of BaseWebUIHandler -// and into BaseScreenHandler. class BaseWebUIHandler : public content::WebUIMessageHandler { public: explicit BaseWebUIHandler(JSCallsContainer* js_calls_container); @@ -63,17 +59,6 @@ } protected: - // Set the method identifier for a userActed callback. The actual callback - // will be registered in RegisterMessages so this should be called in the - // constructor. This takes the full method path, ie, - // "login.WelcomeScreen.userActed". - // - // If this is not called then userActed-style callbacks will not be available - // for the screen. - void set_user_acted_method_path(const std::string& user_acted_method_path) { - user_acted_method_path_ = user_acted_method_path; - } - // All subclasses should implement this method to provide localized values. virtual void DeclareLocalizedValues( ::login::LocalizedValuesBuilder* builder) = 0; @@ -151,8 +136,6 @@ // Whether page is ready. bool page_is_ready() const { return page_is_ready_; } - void SetBaseScreen(BaseScreen* base_screen); - private: friend class OobeUI; @@ -193,17 +176,9 @@ ::login::CallbackWrapper<Args...>(callback, args); } - // Handles user action. - void HandleUserAction(const std::string& action_id); - - // Path that is used to invoke user actions. - std::string user_acted_method_path_; - // Keeps whether page is ready. bool page_is_ready_ = false; - BaseScreen* base_screen_ = nullptr; - // The string id used in the async asset load in JS. If it is set to a // non empty value, the Initialize will be deferred until the underlying load // is finished.
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index ee57c6b..fdf3b37 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc
@@ -76,7 +76,6 @@ #include "chrome/browser/ui/webui/chromeos/login/update_required_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/update_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.h" -#include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/wrong_hwid_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/user_image_source.h" @@ -390,9 +389,6 @@ std::make_unique<AppDownloadingScreenHandler>(js_calls_container_.get())); AddScreenHandler( - std::make_unique<UserImageScreenHandler>(js_calls_container_.get())); - - AddScreenHandler( std::make_unique<UserBoardScreenHandler>(js_calls_container_.get())); AddScreenHandler( @@ -654,10 +650,6 @@ return GetView<MultiDeviceSetupScreenHandler>(); } -UserImageView* OobeUI::GetUserImageView() { - return GetView<UserImageScreenHandler>(); -} - ErrorScreen* OobeUI::GetErrorScreen() { return error_screen_.get(); }
diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h index ba071a8..b208078 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h
@@ -65,7 +65,6 @@ class SyncConsentScreenView; class TermsOfServiceScreenView; class UserBoardView; -class UserImageView; class UpdateView; class UpdateRequiredView; class SupervisionTransitionScreenView; @@ -122,7 +121,6 @@ ArcTermsOfServiceScreenView* GetArcTermsOfServiceScreenView(); RecommendAppsScreenView* GetRecommendAppsScreenView(); AppDownloadingScreenView* GetAppDownloadingScreenView(); - UserImageView* GetUserImageView(); ErrorScreen* GetErrorScreen(); WrongHWIDScreenView* GetWrongHWIDScreenView(); AutoEnrollmentCheckScreenView* GetAutoEnrollmentCheckScreenView();
diff --git a/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc index 2042a7db..857cdfe0 100644 --- a/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/user_board_screen_handler.cc
@@ -94,12 +94,12 @@ void UserBoardScreenHandler::Bind(UserSelectionScreen* screen) { screen_ = screen; - BaseWebUIHandler::SetBaseScreen(screen_); + SetBaseScreen(screen_); } void UserBoardScreenHandler::Unbind() { screen_ = nullptr; - BaseWebUIHandler::SetBaseScreen(nullptr); + SetBaseScreen(nullptr); } base::WeakPtr<UserBoardView> UserBoardScreenHandler::GetWeakPtr() {
diff --git a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc deleted file mode 100644 index 19cd8be..0000000 --- a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.cc +++ /dev/null
@@ -1,201 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h" - -#include <utility> - -#include "base/base64.h" -#include "base/command_line.h" -#include "base/logging.h" -#include "base/metrics/histogram_macros.h" -#include "base/stl_util.h" -#include "base/values.h" -#include "chrome/browser/chromeos/accessibility/accessibility_manager.h" -#include "chrome/browser/chromeos/login/existing_user_controller.h" -#include "chrome/browser/chromeos/login/oobe_screen.h" -#include "chrome/browser/chromeos/login/screens/user_image_screen.h" -#include "chrome/browser/chromeos/login/ui/login_display_webui.h" -#include "chrome/browser/chromeos/login/users/default_user_image/default_user_images.h" -#include "chrome/common/chrome_switches.h" -#include "chrome/common/url_constants.h" -#include "chrome/grit/browser_resources.h" -#include "chrome/grit/generated_resources.h" -#include "chromeos/audio/chromeos_sounds.h" -#include "components/login/localized_values_builder.h" -#include "components/strings/grit/components_strings.h" -#include "components/user_manager/user.h" -#include "net/base/data_url.h" -#include "services/audio/public/cpp/sounds/sounds_manager.h" -#include "ui/base/resource/resource_bundle.h" -#include "url/gurl.h" - -namespace chromeos { - -UserImageScreenHandler::UserImageScreenHandler( - JSCallsContainer* js_calls_container) - : BaseScreenHandler(kScreenId, js_calls_container) { - ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); - audio::SoundsManager* manager = audio::SoundsManager::Get(); - manager->Initialize(SOUND_OBJECT_DELETE, - bundle.GetRawDataResource(IDR_SOUND_OBJECT_DELETE_WAV)); - manager->Initialize(SOUND_CAMERA_SNAP, - bundle.GetRawDataResource(IDR_SOUND_CAMERA_SNAP_WAV)); -} - -UserImageScreenHandler::~UserImageScreenHandler() { - if (screen_) - screen_->OnViewDestroyed(this); -} - -void UserImageScreenHandler::Initialize() { - if (show_on_init_) { - Show(); - show_on_init_ = false; - } -} - -void UserImageScreenHandler::Bind(UserImageScreen* screen) { - screen_ = screen; - BaseScreenHandler::SetBaseScreen(screen_); -} - -void UserImageScreenHandler::Unbind() { - screen_ = nullptr; - BaseScreenHandler::SetBaseScreen(nullptr); -} - -void UserImageScreenHandler::Show() { - if (!page_is_ready()) { - show_on_init_ = true; - return; - } - screen_show_time_ = base::Time::Now(); - ShowScreen(kScreenId); - - // When shown, query camera presence. - if (screen_ && is_ready_) - screen_->OnScreenReady(); -} - -void UserImageScreenHandler::Hide() { -} - -void UserImageScreenHandler::DeclareLocalizedValues( - ::login::LocalizedValuesBuilder* builder) { - builder->Add("userImageScreenTitle", IDS_USER_IMAGE_SCREEN_TITLE); - builder->Add("userImageScreenDescription", - IDS_USER_IMAGE_SCREEN_DESCRIPTION); - builder->Add("takePhoto", IDS_OPTIONS_CHANGE_PICTURE_TAKE_PHOTO); - builder->Add("captureVideo", IDS_OPTIONS_CHANGE_PICTURE_CAPTURE_VIDEO); - builder->Add("discardPhoto", IDS_OPTIONS_CHANGE_PICTURE_DISCARD_PHOTO); - builder->Add("switchModeToCamera", - IDS_OPTIONS_CHANGE_PICTURE_SWITCH_MODE_TO_CAMERA); - builder->Add("switchModeToVideo", - IDS_OPTIONS_CHANGE_PICTURE_SWITCH_MODE_TO_VIDEO); - builder->Add("profilePhoto", IDS_IMAGE_SCREEN_PROFILE_PHOTO); - builder->Add("profilePhotoLoading", - IDS_IMAGE_SCREEN_PROFILE_LOADING_PHOTO); - builder->Add("okButtonText", IDS_OK); - builder->Add("photoFromCamera", IDS_OPTIONS_CHANGE_PICTURE_PHOTO_FROM_CAMERA); - builder->Add("syncingPreferences", IDS_IMAGE_SCREEN_SYNCING_PREFERENCES); -} - -void UserImageScreenHandler::RegisterMessages() { - AddCallback("getImages", &UserImageScreenHandler::HandleGetImages); - AddCallback("screenReady", &UserImageScreenHandler::HandleScreenReady); - AddCallback("discardPhoto", &UserImageScreenHandler::HandleDiscardPhoto); - AddCallback("photoTaken", &UserImageScreenHandler::HandlePhotoTaken); - AddCallback("selectImage", &UserImageScreenHandler::HandleSelectImage); - AddCallback("onUserImageAccepted", - &UserImageScreenHandler::HandleImageAccepted); - AddCallback("onUserImageScreenShown", - &UserImageScreenHandler::HandleScreenShown); -} - -// TODO(antrim) : It looks more like parameters for "Init" rather than callback. -void UserImageScreenHandler::HandleGetImages() { - base::DictionaryValue result; - result.SetInteger("first", default_user_image::GetFirstDefaultImage()); - std::unique_ptr<base::ListValue> default_images = - default_user_image::GetAsDictionary(true /* all */); - result.Set("images", std::move(default_images)); - CallJS("login.UserImageScreen.setDefaultImages", result); -} - -void UserImageScreenHandler::HandleScreenReady() { - is_ready_ = true; - if (screen_) - screen_->OnScreenReady(); -} - -void UserImageScreenHandler::HandlePhotoTaken(const std::string& image_url) { - AccessibilityManager::Get()->PlayEarcon( - SOUND_CAMERA_SNAP, PlaySoundOption::ONLY_IF_SPOKEN_FEEDBACK_ENABLED); - - std::string raw_data; - base::StringPiece url(image_url); - const char kDataUrlPrefix[] = "data:image/png;base64,"; - const size_t kDataUrlPrefixLength = base::size(kDataUrlPrefix) - 1; - if (!url.starts_with(kDataUrlPrefix) || - !base::Base64Decode(url.substr(kDataUrlPrefixLength), &raw_data)) { - LOG(WARNING) << "Invalid image URL"; - return; - } - - if (screen_) - screen_->OnPhotoTaken(raw_data); -} - -void UserImageScreenHandler::HandleDiscardPhoto() { - AccessibilityManager::Get()->PlayEarcon( - SOUND_OBJECT_DELETE, PlaySoundOption::ONLY_IF_SPOKEN_FEEDBACK_ENABLED); -} - -void UserImageScreenHandler::HandleSelectImage(const std::string& image_type, - const std::string& image_url, - bool is_user_selection) { - if (screen_) - screen_->OnImageSelected(image_type, image_url, is_user_selection); -} - -void UserImageScreenHandler::HandleImageAccepted() { - if (screen_) - screen_->OnImageAccepted(); -} - -void UserImageScreenHandler::HandleScreenShown() { - DCHECK(!screen_show_time_.is_null()); - - base::TimeDelta delta = base::Time::Now() - screen_show_time_; - VLOG(1) << "Screen load time: " << delta.InSecondsF(); - UMA_HISTOGRAM_TIMES("UserImage.ScreenIsShownTime", delta); -} - -void UserImageScreenHandler::HideCurtain() { - CallJS("login.UserImageScreen.hideCurtain"); -} - -void UserImageScreenHandler::SetIsCameraPresent(bool value) { - CallJS("login.UserImageScreen.setIsCameraPresent", value); -} - -void UserImageScreenHandler::SetProfilePictureDataURL( - const std::string& value) { - CallJS("login.UserImageScreen.setProfilePictureDataURL", value); -} - -void UserImageScreenHandler::SetIsProfilePictureAvailable(bool value) { - CallJS("login.UserImageScreen.setIsProfilePictureAvailable", value); -} - -void UserImageScreenHandler::SetSelectedImageIndex(int value) { - CallJS("login.UserImageScreen.setSelectedImageIndex", value); -} - -void UserImageScreenHandler::SetSelectedImageURL(const std::string& value) { - CallJS("login.UserImageScreen.setSelectedImageURL", value); -} - -} // namespace chromeos
diff --git a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h deleted file mode 100644 index 337a27e2..0000000 --- a/chrome/browser/ui/webui/chromeos/login/user_image_screen_handler.h +++ /dev/null
@@ -1,86 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ -#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_ - -#include <string> - -#include "base/macros.h" -#include "base/memory/weak_ptr.h" -#include "base/time/time.h" -#include "chrome/browser/chromeos/login/screens/user_image_view.h" -#include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" -#include "ui/gfx/image/image_skia.h" -#include "ui/gfx/native_widget_types.h" - -namespace chromeos { - -// WebUI implementation of UserImageView. It is used to interact with the JS -// page allowing user to select an avatar. -class UserImageScreenHandler : public UserImageView, public BaseScreenHandler { - public: - explicit UserImageScreenHandler(JSCallsContainer* js_calls_container); - ~UserImageScreenHandler() override; - - private: - // BaseScreenHandler implementation: - void Initialize() override; - void DeclareLocalizedValues( - ::login::LocalizedValuesBuilder* builder) override; - - // WebUIMessageHandler implementation: - void RegisterMessages() override; - - // UserImageView implementation: - void Bind(UserImageScreen* screen) override; - void Unbind() override; - void Show() override; - void Hide() override; - void HideCurtain() override; - void SetIsCameraPresent(bool value) override; - void SetProfilePictureDataURL(const std::string& value) override; - void SetIsProfilePictureAvailable(bool value) override; - void SetSelectedImageIndex(int value) override; - void SetSelectedImageURL(const std::string& value) override; - - // Sends image data to the page. - void HandleGetImages(); - - // Screen ready to be shown. - void HandleScreenReady(); - - // Handles photo taken with WebRTC UI. - void HandlePhotoTaken(const std::string& image_url); - - // Handles 'discard-photo' button click. - void HandleDiscardPhoto(); - - // Handles clicking on default user image. - void HandleSelectImage(const std::string& image_type, - const std::string& image_url, - bool is_user_selection); - - // Called when user accept the image closing the screen. - void HandleImageAccepted(); - - // Called when the user image screen has been loaded and shown. - void HandleScreenShown(); - - UserImageScreen* screen_ = nullptr; - - // Keeps whether screen should be shown right after initialization. - bool show_on_init_ = false; - - // Keeps whether screen has loaded all default images and redy to be shown. - bool is_ready_ = false; - - base::Time screen_show_time_; - - DISALLOW_COPY_AND_ASSIGN(UserImageScreenHandler); -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_HANDLER_H_
diff --git a/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc b/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc index 3b37b29..b7c85e2 100644 --- a/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc +++ b/chrome/browser/ui/webui/sync_internals_message_handler_unittest.cc
@@ -13,7 +13,6 @@ #include "chrome/browser/sync/user_event_service_factory.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/testing_profile.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/sync/driver/about_sync_util.h" #include "components/sync/driver/fake_sync_service.h" #include "components/sync/driver/sync_service.h"
diff --git a/chrome/browser/vr/ui_host/vr_ui_host_impl.cc b/chrome/browser/vr/ui_host/vr_ui_host_impl.cc index 0febaa4..9086d5d 100644 --- a/chrome/browser/vr/ui_host/vr_ui_host_impl.cc +++ b/chrome/browser/vr/ui_host/vr_ui_host_impl.cc
@@ -13,6 +13,8 @@ #include "chrome/browser/permissions/permission_manager.h" #include "chrome/browser/permissions/permission_result.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/vr/metrics/session_metrics_helper.h" #include "chrome/browser/vr/service/browser_xr_runtime.h" #include "chrome/browser/vr/service/xr_runtime_manager.h" @@ -101,6 +103,8 @@ SessionMetricsHelper::FromWebContents(web_contents_); metrics_helper->SetWebVREnabled(false); metrics_helper->SetVRActive(false); + if (Browser* browser = chrome::FindBrowserWithWebContents(web_contents_)) + browser->GetBubbleManager()->RemoveBubbleManagerObserver(this); } if (contents) { auto* metrics_helper = SessionMetricsHelper::FromWebContents(contents); @@ -112,6 +116,8 @@ metrics_helper->SetVRActive(true); } metrics_helper->RecordVrStartAction(VrStartAction::kPresentationRequest); + if (Browser* browser = chrome::FindBrowserWithWebContents(contents)) + browser->GetBubbleManager()->AddBubbleManagerObserver(this); } } @@ -227,6 +233,17 @@ RemoveHeadsetNotificationPrompt(); } +void VRUiHostImpl::OnBubbleNeverShown(BubbleReference bubble) {} + +void VRUiHostImpl::OnBubbleClosed(BubbleReference bubble, + BubbleCloseReason reason) { + OnBubbleRemoved(); +} + +void VRUiHostImpl::OnBubbleShown(BubbleReference bubble) { + OnBubbleAdded(); +} + void VRUiHostImpl::RemoveHeadsetNotificationPrompt() { if (!is_external_prompt_showing_in_headset_) return;
diff --git a/chrome/browser/vr/ui_host/vr_ui_host_impl.h b/chrome/browser/vr/ui_host/vr_ui_host_impl.h index 07d12bb..4c5a8f01 100644 --- a/chrome/browser/vr/ui_host/vr_ui_host_impl.h +++ b/chrome/browser/vr/ui_host/vr_ui_host_impl.h
@@ -14,6 +14,7 @@ #include "chrome/browser/vr/model/capturing_state_model.h" #include "chrome/browser/vr/service/browser_xr_runtime.h" #include "chrome/browser/vr/service/vr_ui_host.h" +#include "components/bubble/bubble_manager.h" #include "content/public/browser/web_contents.h" #include "services/device/public/mojom/geolocation_config.mojom.h" @@ -25,7 +26,8 @@ // component. Used on the browser's main thread. class VRUiHostImpl : public VRUiHost, public PermissionRequestManager::Observer, - public BrowserXRRuntimeObserver { + public BrowserXRRuntimeObserver, + public BubbleManager::BubbleManagerObserver { public: VRUiHostImpl(device::mojom::XRDeviceId device_id, device::mojom::XRCompositorHostPtr compositor); @@ -50,6 +52,12 @@ void OnBubbleAdded() override; void OnBubbleRemoved() override; + // content::BubbleManager::BubbleManagerObserver + void OnBubbleNeverShown(BubbleReference bubble) override; + void OnBubbleClosed(BubbleReference bubble, + BubbleCloseReason reason) override; + void OnBubbleShown(BubbleReference bubble) override; + void RemoveHeadsetNotificationPrompt(); void SetLocationInfoOnUi();
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index 3e2a10a..26ea647 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -455,14 +455,6 @@ base::FEATURE_ENABLED_BY_DEFAULT}; #endif -// If enabled, the list of content suggestions on the New Tab page will contain -// pages that the user downloaded for later use. -// DO NOT check directly whether this feature is enabled (i.e. do not use -// base::FeatureList::IsEnabled()). It is enabled conditionally. Use -// |AreOfflinePageDownloadsEnabled| instead. -const base::Feature kOfflinePageDownloadSuggestionsFeature{ - "NTPOfflinePageDownloadSuggestions", base::FEATURE_ENABLED_BY_DEFAULT}; - #if defined(OS_ANDROID) // Enables or disabled the OOM intervention. const base::Feature kOomIntervention{"OomIntervention",
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index 050a486..cd95d848 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -292,9 +292,6 @@ COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kNtlmV2Enabled; #endif -COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::Feature kOfflinePageDownloadSuggestionsFeature; - #if defined(OS_ANDROID) COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kOomIntervention; #endif
diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json index dbcbead..75765c8 100644 --- a/chrome/common/extensions/api/_permission_features.json +++ b/chrome/common/extensions/api/_permission_features.json
@@ -310,8 +310,6 @@ "extension_types": ["extension"], "platforms" : ["win", "mac", "linux"], "whitelist" : [ - "FD15C63ABA854733FDCBC1D4D34A71E963A12ABD", // https://crbug.com/825015 - "08455FA7CB8734168378F731B00B354CEEE0088F", // https://crbug.com/825015 - Test Extension "86D63D90308742AA65B8B29AE2D39FED2D6DC310", // https://crbug.com/882461 SecureConnect "031E5E4A54C39E4F46E11CE643584E9187915908", // https://crbug.com/882461 SecureConnect "349E89FE0296161007623C0B4096B617D7CECD54", // https://crbug.com/882461 SecureConnect
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 95974f2..61022af 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -574,8 +574,6 @@ "//components/module_installer/android:module_installer_stub_java", "//v8:v8_external_startup_data_assets", ] - - enable_multidex = true } else { # Not Android. sources += [ # The list of sources which is only used by chrome browser tests on @@ -1878,18 +1876,6 @@ "../browser/chromeos/login/screens/recommend_apps_screen_browsertest.cc", "../browser/chromeos/login/screens/update_screen_browsertest.cc", "../browser/chromeos/login/screens/user_selection_screen_browsertest.cc", - "../browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h", - "../browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric_cpu.cpp", - "../browser/chromeos/login/screenshot_testing/SkImageDiffer.cpp", - "../browser/chromeos/login/screenshot_testing/SkImageDiffer.h", - "../browser/chromeos/login/screenshot_testing/SkPMetric.cpp", - "../browser/chromeos/login/screenshot_testing/SkPMetric.h", - "../browser/chromeos/login/screenshot_testing/SkPMetricUtil_gen.h", - "../browser/chromeos/login/screenshot_testing/login_screen_areas.h", - "../browser/chromeos/login/screenshot_testing/screenshot_tester.cc", - "../browser/chromeos/login/screenshot_testing/screenshot_tester.h", - "../browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.cc", - "../browser/chromeos/login/screenshot_testing/screenshot_testing_mixin.h", "../browser/chromeos/login/session/chrome_session_manager_browsertest.cc", "../browser/chromeos/login/session_login_browsertest.cc", "../browser/chromeos/login/signin/device_id_browsertest.cc", @@ -3243,6 +3229,7 @@ "../browser/android/customtabs/dynamicmodule/module_metrics_unittest.cc", "../browser/android/search_permissions/search_permissions_service_unittest.cc", "../browser/autofill/autofill_credit_card_filling_infobar_delegate_mobile_unittest.cc", + "../browser/autofill/autofill_keyboard_accessory_adapter_unittest.cc", "../browser/autofill/autofill_save_card_infobar_delegate_mobile_unittest.cc", "../browser/autofill/manual_filling_controller_impl_unittest.cc", "../browser/media/android/cdm/media_drm_origin_id_manager_unittest.cc", @@ -3274,8 +3261,6 @@ } else { deps += [ "//v8:v8_external_startup_data_assets" ] } - - enable_multidex = true } else { # !is_android sources += [
diff --git a/chrome/test/chromedriver/BUILD.gn b/chrome/test/chromedriver/BUILD.gn index 5c32bd73..d0e8fcb 100644 --- a/chrome/test/chromedriver/BUILD.gn +++ b/chrome/test/chromedriver/BUILD.gn
@@ -15,7 +15,7 @@ "js/dispatch_touch_event.js", "js/execute_async_script.js", "js/focus.js", - "js/get_element_center_location.js", + "js/get_element_location.js", "js/get_element_region.js", "js/is_option_element_toggleable.js", ]
diff --git a/chrome/test/chromedriver/element_util.cc b/chrome/test/chromedriver/element_util.cc index 9339c31a..33a4c7b 100644 --- a/chrome/test/chromedriver/element_util.cc +++ b/chrome/test/chromedriver/element_util.cc
@@ -248,6 +248,29 @@ return Status(kOk); } +Status GetElementLocationInViewCenterHelper(const std::string& frame, + WebView* web_view, + const std::string& element_id, + bool center, + WebPoint* location) { + Status status = CheckElement(element_id); + if (status.IsError()) + return status; + base::ListValue args; + args.Append(CreateElement(element_id)); + args.AppendBoolean(center); + std::unique_ptr<base::Value> result; + status = + web_view->CallFunction(frame, kGetElementLocationScript, args, &result); + if (status.IsError()) + return status; + if (!ParseFromValue(result.get(), location)) { + return Status(kUnknownError, + "failed to parse value of getElementLocationInViewCenter"); + } + return Status(kOk); +} + } // namespace std::string GetElementKey() { @@ -803,20 +826,50 @@ WebView* web_view, const std::string& element_id, WebPoint* location) { - Status status = CheckElement(element_id); + WebPoint center_location; + Status status = GetElementLocationInViewCenterHelper( + session->GetCurrentFrameId(), web_view, element_id, true, + ¢er_location); if (status.IsError()) return status; - base::ListValue args; - args.Append(CreateElement(element_id)); - std::unique_ptr<base::Value> result; - status = - web_view->CallFunction(session->GetCurrentFrameId(), - kGetElementCenterLocationScript, args, &result); - if (status.IsError()) - return status; - if (!ParseFromValue(result.get(), location)) { - return Status(kUnknownError, - "failed to parse value of getElementLocationInViewCenter"); + const char kFindSubFrameScript[] = + "function(xpath) {" + " return document.evaluate(xpath, document, null," + " XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;" + "}"; + for (auto rit = session->frames.rbegin(); rit != session->frames.rend(); + ++rit) { + base::ListValue args; + args.AppendString(base::StringPrintf("//*[@cd_frame_id_ = '%s']", + rit->chromedriver_frame_id.c_str())); + std::unique_ptr<base::Value> result; + status = web_view->CallFunction(rit->parent_frame_id, kFindSubFrameScript, + args, &result); + if (status.IsError()) + return status; + const base::DictionaryValue* element_dict; + if (!result->GetAsDictionary(&element_dict)) + return Status(kUnknownError, "no element reference returned by script"); + std::string frame_element_id; + if (!element_dict->GetString(GetElementKey(), &frame_element_id)) + return Status(kUnknownError, "failed to locate a sub frame"); + + // Modify |center_location| by the frame's border. + int border_left = -1; + int border_top = -1; + status = GetElementBorder(rit->parent_frame_id, web_view, frame_element_id, + &border_left, &border_top); + if (status.IsError()) + return status; + center_location.Offset(border_left, border_top); + + WebPoint frame_offset; + status = GetElementLocationInViewCenterHelper( + rit->parent_frame_id, web_view, frame_element_id, false, &frame_offset); + if (status.IsError()) + return status; + center_location.Offset(frame_offset.x, frame_offset.y); } + *location = center_location; return Status(kOk); }
diff --git a/chrome/test/chromedriver/js/get_element_center_location_test.html b/chrome/test/chromedriver/js/get_element_center_location_test.html deleted file mode 100644 index 577f9b56..0000000 --- a/chrome/test/chromedriver/js/get_element_center_location_test.html +++ /dev/null
@@ -1,55 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> -<style> -#parent { - position: absolute; - background: blue; - width: 300px; - height: 300px; - top: 300px; - left: 100px; -} - -#child { - position: absolute; - background: red; - top: 60px; - left: 50px; - width: 200px; - height: 100px; -} - -</style> -</head> -<script src='test.js'></script> -<script src='get_element_center_location.js'></script> -<script> - -function testElementParent() { - var parent = document.getElementById('parent'); - var center = getElementCenterLocation(parent); - var x = 100 + 0.5 * 300; - var y = 300 + 0.5 * 300; - assertEquals(Math.floor(x), Math.floor(center.x)); - assertEquals(Math.floor(y), Math.floor(center.y)); -} - -function testElementChild() { - var child = document.getElementById('child'); - var center = getElementCenterLocation(child); - var x = 150 + 0.5 * 200; - var y = 360 + 0.5 * 100; - assertEquals(Math.floor(x), Math.floor(center.x)); - assertEquals(Math.floor(y), Math.floor(center.y)); -} - -</script> -<body> -<h2>position: absolute;</h2> -<p>The Parent element has position: absolute.</p> -<div id="parent">Parent: position: absolute, top: 300px, left: 100px. - <div id="child">Child: position: absolute, top: 60px, left: 50px.</div> -</div> -</body> -</html>
diff --git a/chrome/test/chromedriver/js/get_element_center_location.js b/chrome/test/chromedriver/js/get_element_location.js similarity index 67% rename from chrome/test/chromedriver/js/get_element_center_location.js rename to chrome/test/chromedriver/js/get_element_location.js index 6391a462..19e596f7 100644 --- a/chrome/test/chromedriver/js/get_element_center_location.js +++ b/chrome/test/chromedriver/js/get_element_location.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -function getInViewCenterPoint(rect) { +function getInViewPoint(rect) { var left = Math.max(0, rect.left); var right = Math.min(window.innerWidth, rect.right); var top = Math.max(0, rect.top); @@ -11,7 +11,7 @@ var x = 0.5 * (left + right); var y = 0.5 * (top + bottom); - return [x, y]; + return [x, y, rect.left, rect.top]; } function inView(element) { @@ -24,17 +24,17 @@ return false; } - var centerPoint = getInViewCenterPoint(rectangles[0]); - if (centerPoint[0] <= 0 || centerPoint[1] <= 0 || - centerPoint[0] >= window.innerWidth || - centerPoint[1] >= window.innerHeight) { + var elementPoint = getInViewPoint(rectangles[0]); + if (elementPoint[0] <= 0 || elementPoint[1] <= 0 || + elementPoint[0] >= window.innerWidth || + elementPoint[1] >= window.innerHeight) { return false; } return true; } -function getElementCenterLocation(element) { +function getElementLocation(element, center) { // Check that node type is element. if (element.nodeType != 1) throw new Error(element + ' is not an element'); @@ -50,9 +50,16 @@ } var rect = element.getClientRects()[0]; - var centerPoint = getInViewCenterPoint(rect); - return { - 'x': centerPoint[0], - 'y': centerPoint[1] - }; + var elementPoint = getInViewPoint(rect); + if (center) { + return { + 'x': elementPoint[0], + 'y': elementPoint[1] + }; + } else { + return { + 'x': elementPoint[2], + 'y': elementPoint[3] + }; + } } \ No newline at end of file
diff --git a/chrome/test/chromedriver/js/get_element_location_test.html b/chrome/test/chromedriver/js/get_element_location_test.html new file mode 100644 index 0000000..c2cfc0a --- /dev/null +++ b/chrome/test/chromedriver/js/get_element_location_test.html
@@ -0,0 +1,73 @@ +<!DOCTYPE HTML> +<html> +<head> +<style> +#parent { + position: absolute; + background: blue; + width: 300px; + height: 300px; + top: 300px; + left: 100px; +} + +#child { + position: absolute; + background: red; + top: 60px; + left: 50px; + width: 200px; + height: 100px; +} + +</style> +</head> +<script src='test.js'></script> +<script src='get_element_location.js'></script> +<script> + +function testElementParentCenterLocation() { + var parent = document.getElementById('parent'); + var location = getElementLocation(parent, true); + var x = 100 + 0.5 * 300; + var y = 300 + 0.5 * 300; + assertEquals(Math.floor(x), Math.floor(location.x)); + assertEquals(Math.floor(y), Math.floor(location.y)); +} + +function testElementChildCenterLocation() { + var child = document.getElementById('child'); + var location = getElementLocation(child, true); + var x = 150 + 0.5 * 200; + var y = 360 + 0.5 * 100; + assertEquals(Math.floor(x), Math.floor(location.x)); + assertEquals(Math.floor(y), Math.floor(location.y)); +} + +function testElementParentTopLeftLocation() { + var parent = document.getElementById('parent'); + var location = getElementLocation(parent, false); + var x = 100; + var y = 300; + assertEquals(Math.floor(x), Math.floor(location.x)); + assertEquals(Math.floor(y), Math.floor(location.y)); +} + +function testElementChildCenterTopLeftLocation() { + var child = document.getElementById('child'); + var location = getElementLocation(child, false); + var x = 150; + var y = 360; + assertEquals(Math.floor(x), Math.floor(location.x)); + assertEquals(Math.floor(y), Math.floor(location.y)); +} + +</script> +<body> +<h2>position: absolute;</h2> +<p>The Parent element has position: absolute.</p> +<div id="parent">Parent: position: absolute, top: 300px, left: 100px. + <div id="child">Child: position: absolute, top: 60px, left: 50px.</div> +</div> +</body> +</html>
diff --git a/chrome/test/data/android/portals/basic-content.html b/chrome/test/data/android/portals/basic-content.html new file mode 100644 index 0000000..084478e2 --- /dev/null +++ b/chrome/test/data/android/portals/basic-content.html
@@ -0,0 +1,10 @@ +<!doctype html> +<html> + <head> + <title>Test Portal Content</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + </head> + <body> + <h1>Test Portal Content</h1> + </body> +</html>
diff --git a/chrome/test/data/android/portals/portal-to-basic-content.html b/chrome/test/data/android/portals/portal-to-basic-content.html new file mode 100644 index 0000000..aa17e7a --- /dev/null +++ b/chrome/test/data/android/portals/portal-to-basic-content.html
@@ -0,0 +1,21 @@ +<!doctype html> +<html> + <head> + <title>Test Portal</title> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <style type="text/css"> + portal { + border: solid; + } + </style> + </head> + <body> + <h1>Test Portal</h1> + <portal id="myPortal" src="basic-content.html"></portal> + <script> + function activatePortal() { + document.getElementById('myPortal').activate(); + } + </script> + </body> +</html>
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_websocket_clean_close.html b/chrome/test/data/extensions/api_test/webrequest/test_websocket_clean_close.html new file mode 100644 index 0000000..124cfd75 --- /dev/null +++ b/chrome/test/data/extensions/api_test/webrequest/test_websocket_clean_close.html
@@ -0,0 +1,9 @@ +<!-- + * 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. +--> +<body> +<script src="framework.js"></script> +<script src="test_websocket_clean_close.js"></script> +</body>
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_websocket_clean_close.js b/chrome/test/data/extensions/api_test/webrequest/test_websocket_clean_close.js new file mode 100644 index 0000000..a7648cf --- /dev/null +++ b/chrome/test/data/extensions/api_test/webrequest/test_websocket_clean_close.js
@@ -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. + +// Opens a WebSocket, busy waits for 100ms, sends a message. Verifies that the +// close was clean. If it fails, it will fail flakily, so repeat it 10 times to +// get a deterministic answer. +function sendDoesntError(iteration = 0, done = undefined) { + let ws = new WebSocket('ws://localhost:' + testWebSocketPort + + '/close-immediately'); + + if (!done) + done = chrome.test.callbackAdded(); + + ws.onclose = event => { + chrome.test.log('WebSocket ' + iteration + ' closed ' + + (event.wasClean ? 'cleanly.' : 'uncleanly.')); + chrome.test.assertTrue(event.wasClean); + if (iteration < 10) { + ++iteration; + sendDoesntError(iteration, done); + } else { + done(); + } + } + + ws.onopen = () => { + chrome.test.log('WebSocket ' + iteration + ' opened.'); + const start = performance.now(); + while (performance.now() - start < 100) {} + ws.send('message'); + }; +} + +chrome.tabs.getCurrent(tab => runTestsForTab([sendDoesntError], tab));
diff --git a/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js b/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js index ab723c0..8329647a 100644 --- a/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js +++ b/chrome/test/data/webui/bookmarks/bookmarks_focus_test.js
@@ -29,13 +29,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('BookmarksFocusTest', 'MAYBE_All', function() { +TEST_F('BookmarksFocusTest', 'All', function() { suite('<bookmarks-folder-node>', function() { let rootNode; let store;
diff --git a/chrome/test/data/webui/cr_elements/cr_elements_focus_test.js b/chrome/test/data/webui/cr_elements/cr_elements_focus_test.js index 7945b083..4e523cc 100644 --- a/chrome/test/data/webui/cr_elements/cr_elements_focus_test.js +++ b/chrome/test/data/webui/cr_elements/cr_elements_focus_test.js
@@ -34,13 +34,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrElementsActionMenuTest', 'MAYBE_All', function() { +TEST_F('CrElementsActionMenuTest', 'All', function() { mocha.run(); }); @@ -58,13 +52,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrElementsProfileAvatarSelectorFocusTest', 'MAYBE_All', function() { +TEST_F('CrElementsProfileAvatarSelectorFocusTest', 'All', function() { cr_profile_avatar_selector.registerTests(); mocha.grep(cr_profile_avatar_selector.TestNames.Focus).run(); }); @@ -88,13 +76,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrElementsToggleTest', 'MAYBE_All', function() { +TEST_F('CrElementsToggleTest', 'All', function() { mocha.run(); }); @@ -118,13 +100,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrElementsCheckboxTest', 'MAYBE_All', function() { +TEST_F('CrElementsCheckboxTest', 'All', function() { mocha.run(); }); @@ -147,13 +123,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrElementsInputTest', 'MAYBE_All', function() { +TEST_F('CrElementsInputTest', 'All', function() { mocha.run(); }); @@ -176,13 +146,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrElementsIconButtonFocusTest', 'MAYBE_All', function() { +TEST_F('CrElementsIconButtonFocusTest', 'All', function() { mocha.run(); }); @@ -208,12 +172,6 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrElementsExpandButtonTest', 'MAYBE_All', function() { +TEST_F('CrElementsExpandButtonTest', 'All', function() { mocha.run(); });
diff --git a/chrome/test/data/webui/cr_focus_row_behavior_interactive_test.js b/chrome/test/data/webui/cr_focus_row_behavior_interactive_test.js index 3e76d98e..517401ed 100644 --- a/chrome/test/data/webui/cr_focus_row_behavior_interactive_test.js +++ b/chrome/test/data/webui/cr_focus_row_behavior_interactive_test.js
@@ -37,12 +37,6 @@ }, }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_FocusTest DISABLED_FocusTest'); -GEN('#else'); -GEN('#define MAYBE_FocusTest FocusTest'); -GEN('#endif'); -TEST_F('CrFocusRowBehaviorTest', 'MAYBE_FocusTest', function() { +TEST_F('CrFocusRowBehaviorTest', 'FocusTest', function() { mocha.run(); });
diff --git a/chrome/test/data/webui/extensions/activity_log_history_test.js b/chrome/test/data/webui/extensions/activity_log_history_test.js index 1b92922..51746a38 100644 --- a/chrome/test/data/webui/extensions/activity_log_history_test.js +++ b/chrome/test/data/webui/extensions/activity_log_history_test.js
@@ -152,10 +152,11 @@ 'activity-log-history-item'); } - // We know an item is expanded if its iron-collapse is opened. + // We know an item is expanded if its page-url-list is not hidden. function getExpandedItems() { - return Array.from(getHistoryItems()) - .filter(item => item.$$('iron-collapse').opened); + return Array.from(getHistoryItems()).filter(item => { + return item.$$('#page-url-list:not([hidden])'); + }); } test('activities are present for extension', function() {
diff --git a/chrome/test/data/webui/extensions/cr_extensions_interactive_ui_tests.js b/chrome/test/data/webui/extensions/cr_extensions_interactive_ui_tests.js index 891ae9b..44bdd300 100644 --- a/chrome/test/data/webui/extensions/cr_extensions_interactive_ui_tests.js +++ b/chrome/test/data/webui/extensions/cr_extensions_interactive_ui_tests.js
@@ -58,12 +58,6 @@ } }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrExtensionsOptionsPageTest', 'MAYBE_All', function() { +TEST_F('CrExtensionsOptionsPageTest', 'DISABLED_All', function() { mocha.run(); });
diff --git a/chrome/test/data/webui/history/history_focus_test.js b/chrome/test/data/webui/history/history_focus_test.js index 4056617c..a2ea91ed 100644 --- a/chrome/test/data/webui/history/history_focus_test.js +++ b/chrome/test/data/webui/history/history_focus_test.js
@@ -37,13 +37,7 @@ }, }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('HistoryFocusTest', 'MAYBE_All', function() { +TEST_F('HistoryFocusTest', 'All', function() { suite('<history-toolbar>', function() { let app; let toolbar;
diff --git a/chrome/test/data/webui/print_preview/print_preview_interactive_ui_tests.js b/chrome/test/data/webui/print_preview/print_preview_interactive_ui_tests.js index 01bf101..dfb3def3 100644 --- a/chrome/test/data/webui/print_preview/print_preview_interactive_ui_tests.js +++ b/chrome/test/data/webui/print_preview/print_preview_interactive_ui_tests.js
@@ -56,14 +56,9 @@ } }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_FocusPrintOnReady DISABLED_FocusPrintOnReady'); -GEN('#else'); -GEN('#define MAYBE_FocusPrintOnReady FocusPrintOnReady'); -GEN('#endif'); +// Disabled due to flakiness crbug.com/945630 TEST_F( - 'PrintPreviewPrintHeaderInteractiveTest', 'MAYBE_FocusPrintOnReady', + 'PrintPreviewPrintHeaderInteractiveTest', 'DISABLED_FocusPrintOnReady', function() { this.runMochaTest( print_header_interactive_test.TestNames.FocusPrintOnReady); @@ -94,27 +89,17 @@ } }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_FocusSearchBox DISABLED_FocusSearchBox'); -GEN('#else'); -GEN('#define MAYBE_FocusSearchBox FocusSearchBox'); -GEN('#endif'); +// Disabled due to flakiness crbug.com/945630 TEST_F( - 'PrintPreviewDestinationDialogInteractiveTest', 'MAYBE_FocusSearchBox', + 'PrintPreviewDestinationDialogInteractiveTest', 'DISABLED_FocusSearchBox', function() { this.runMochaTest( destination_dialog_interactive_test.TestNames.FocusSearchBox); }); -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_EscapeSearchBox DISABLED_EscapeSearchBox'); -GEN('#else'); -GEN('#define MAYBE_EscapeSearchBox EscapeSearchBox'); -GEN('#endif'); +// Disabled due to flakiness crbug.com/945630 TEST_F( - 'PrintPreviewDestinationDialogInteractiveTest', 'MAYBE_EscapeSearchBox', + 'PrintPreviewDestinationDialogInteractiveTest', 'DISABLED_EscapeSearchBox', function() { this.runMochaTest( destination_dialog_interactive_test.TestNames.EscapeSearchBox); @@ -141,37 +126,22 @@ } }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_ClearInput DISABLED_ClearInput'); -GEN('#else'); -GEN('#define MAYBE_ClearInput ClearInput'); -GEN('#endif'); -TEST_F('PrintPreviewPagesSettingsTest', 'MAYBE_ClearInput', function() { +// Disabled due to flakiness crbug.com/945630 +TEST_F('PrintPreviewPagesSettingsTest', 'DISABLED_ClearInput', function() { this.runMochaTest(pages_settings_test.TestNames.ClearInput); }); -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_InputNotDisabledOnValidityChange DISABLED_InputNotDisabledOnValidityChange'); -GEN('#else'); -GEN('#define MAYBE_InputNotDisabledOnValidityChange InputNotDisabledOnValidityChange'); -GEN('#endif'); +// Disabled due to flakiness crbug.com/945630 TEST_F( - 'PrintPreviewPagesSettingsTest', 'MAYBE_InputNotDisabledOnValidityChange', - function() { + 'PrintPreviewPagesSettingsTest', + 'DISABLED_InputNotDisabledOnValidityChange', function() { this.runMochaTest( pages_settings_test.TestNames.InputNotDisabledOnValidityChange); }); -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_EnterOnInputTriggersPrint DISABLED_EnterOnInputTriggersPrint'); -GEN('#else'); -GEN('#define MAYBE_EnterOnInputTriggersPrint EnterOnInputTriggersPrint'); -GEN('#endif'); +// Disabled due to flakiness crbug.com/945630 TEST_F( - 'PrintPreviewPagesSettingsTest', 'MAYBE_EnterOnInputTriggersPrint', + 'PrintPreviewPagesSettingsTest', 'DISABLED_EnterOnInputTriggersPrint', function() { this.runMochaTest( pages_settings_test.TestNames.EnterOnInputTriggersPrint); @@ -199,15 +169,10 @@ } }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_BlurResetsEmptyInput DISABLED_BlurResetsEmptyInput'); -GEN('#else'); -GEN('#define MAYBE_BlurResetsEmptyInput BlurResetsEmptyInput'); -GEN('#endif'); +// Disabled due to flakiness crbug.com/945630 TEST_F( 'PrintPreviewNumberSettingsSectionInteractiveTest', - 'MAYBE_BlurResetsEmptyInput', function() { + 'DISABLED_BlurResetsEmptyInput', function() { this.runMochaTest(number_settings_section_interactive_test.TestNames .BlurResetsEmptyInput); });
diff --git a/chrome/test/data/webui/settings/cr_settings_interactive_ui_tests.js b/chrome/test/data/webui/settings/cr_settings_interactive_ui_tests.js index a297ff7b..9b588d1 100644 --- a/chrome/test/data/webui/settings/cr_settings_interactive_ui_tests.js +++ b/chrome/test/data/webui/settings/cr_settings_interactive_ui_tests.js
@@ -57,13 +57,7 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrSettingsSyncPageTest', 'MAYBE_All', function() { +TEST_F('CrSettingsSyncPageTest', 'All', function() { mocha.run(); }); @@ -85,12 +79,6 @@ ]), }; -// Web UI interactive tests are flaky on Win10, see https://crbug.com/711256 -GEN('#if defined(OS_WIN)'); -GEN('#define MAYBE_All DISABLED_All'); -GEN('#else'); -GEN('#define MAYBE_All All'); -GEN('#endif'); -TEST_F('CrSettingsAnimatedPagesTest', 'MAYBE_All', function() { +TEST_F('CrSettingsAnimatedPagesTest', 'All', function() { mocha.run(); });
diff --git a/chrome/test/data/webui/settings/security_keys_subpage_test.js b/chrome/test/data/webui/settings/security_keys_subpage_test.js index fc2a392..9c2ba307 100644 --- a/chrome/test/data/webui/settings/security_keys_subpage_test.js +++ b/chrome/test/data/webui/settings/security_keys_subpage_test.js
@@ -277,25 +277,25 @@ assertShown('locked'); }); - function setNewPINEntries(pinValue, confirmPINValue) { - const newPIN = dialog.$.newPIN; - const confirmPIN = dialog.$.confirmPIN; - newPIN.value = pinValue; + function setPINEntry(inputElement, pinValue) { + inputElement.value = pinValue; // Dispatch input events to trigger validation and UI updates. - newPIN.dispatchEvent( + inputElement.dispatchEvent( new CustomEvent('input', {bubbles: true, cancelable: true})); - confirmPIN.value = confirmPINValue; - confirmPIN.dispatchEvent( - new CustomEvent('input', {bubbles: true, cancelable: true})); + } + + function setNewPINEntry(pinValue) { + setPINEntry(dialog.$.newPIN, pinValue); + } + + function setNewPINEntries(pinValue, confirmPINValue) { + setPINEntry(dialog.$.newPIN, pinValue); + setPINEntry(dialog.$.confirmPIN, confirmPINValue); } function setChangePINEntries(currentPINValue, pinValue, confirmPINValue) { setNewPINEntries(pinValue, confirmPINValue); - const currentPIN = dialog.$.currentPIN; - currentPIN.value = currentPINValue; - // Dispatch input events to trigger validation and UI updates. - currentPIN.dispatchEvent( - new CustomEvent('input', {bubbles: true, cancelable: true})); + setPINEntry(dialog.$.currentPIN, currentPINValue); } test('SetPIN', async function() { @@ -398,6 +398,15 @@ setChangePINEntries('4321', '1234', '1234'); assertFalse(dialog.$.pinSubmit.disabled); // Note True -> False + // Changing the new PIN so that it no longer matches the confirm PIN should + // prevent submitting the dialog. + setNewPINEntry('12345'); + assertTrue(dialog.$.pinSubmit.disabled); + + // Fixing the new PIN should be sufficient to address that. + setNewPINEntry('1234'); + assertFalse(dialog.$.pinSubmit.disabled); + let setPINResolver = new PromiseResolver(); browserProxy.setResponseFor('setPIN', setPINResolver.promise); dialog.$.pinSubmit.click();
diff --git a/chromecast/media/base/slew_volume_unittests.cc b/chromecast/media/base/slew_volume_unittests.cc index 30d450b..26244e46 100644 --- a/chromecast/media/base/slew_volume_unittests.cc +++ b/chromecast/media/base/slew_volume_unittests.cc
@@ -36,7 +36,8 @@ sine[i * 2 + 1] = cos(static_cast<float>(i + 1) * frequency * 2 * M_PI) * std::numeric_limits<int32_t>::max(); } - data->FromInterleaved(sine.data(), frames, kBytesPerSample); + data->FromInterleaved<::media::SignedInt32SampleTypeTraits>(sine.data(), + frames); return data; }
diff --git a/chromecast/media/cma/backend/filter_group_unittest.cc b/chromecast/media/cma/backend/filter_group_unittest.cc index 9b74560..01d84af 100644 --- a/chromecast/media/cma/backend/filter_group_unittest.cc +++ b/chromecast/media/cma/backend/filter_group_unittest.cc
@@ -26,7 +26,6 @@ // Total of Test samples including left and right channels. #define NUM_SAMPLES 64 -constexpr size_t kBytesPerSample = sizeof(int32_t); constexpr int kNumInputChannels = 2; constexpr int kInputSampleRate = 48000; constexpr int kInputFrames = NUM_SAMPLES / 2; @@ -163,7 +162,8 @@ std::unique_ptr<::media::AudioBus> GetTestData() { int samples = NUM_SAMPLES / kNumInputChannels; auto data = ::media::AudioBus::Create(kNumInputChannels, samples); - data->FromInterleaved(kTestData, samples, kBytesPerSample); + data->FromInterleaved<::media::SignedInt32SampleTypeTraits>(kTestData, + samples); return data; }
diff --git a/chromecast/media/cma/backend/stream_mixer_external_audio_pipeline_unittest.cc b/chromecast/media/cma/backend/stream_mixer_external_audio_pipeline_unittest.cc index 105ff7e..9051e74 100644 --- a/chromecast/media/cma/backend/stream_mixer_external_audio_pipeline_unittest.cc +++ b/chromecast/media/cma/backend/stream_mixer_external_audio_pipeline_unittest.cc
@@ -184,15 +184,15 @@ // Prepare data for test. const size_t kSampleSize = 64; - char test_data[kSampleSize]; + uint8_t test_data[kSampleSize]; for (size_t i = 0; i < kSampleSize; ++i) test_data[i] = i; // Set test data in AudioBus. const auto kNumFrames = kSampleSize / kNumChannels; auto data = ::media::AudioBus::Create(kNumChannels, kNumFrames); - const size_t kBytesPerSample = sizeof(test_data[0]); - data->FromInterleaved(&test_data, kNumFrames, kBytesPerSample); + data->FromInterleaved<::media::UnsignedInt8SampleTypeTraits>(test_data, + kNumFrames); // Prepare data for compare. auto expected = ::media::AudioBus::Create(kNumChannels, kNumFrames); data->CopyTo(expected.get());
diff --git a/chromecast/media/cma/backend/stream_mixer_unittest.cc b/chromecast/media/cma/backend/stream_mixer_unittest.cc index a703af6..167fb36 100644 --- a/chromecast/media/cma/backend/stream_mixer_unittest.cc +++ b/chromecast/media/cma/backend/stream_mixer_unittest.cc
@@ -142,7 +142,8 @@ CHECK_LT(index, NUM_DATA_SETS); int frames = NUM_SAMPLES / kNumChannels; auto data = ::media::AudioBus::Create(kNumChannels, frames); - data->FromInterleaved(kTestData[index], frames, kBytesPerSample); + data->FromInterleaved<::media::SignedInt32SampleTypeTraits>(kTestData[index], + frames); return data; } @@ -709,7 +710,8 @@ // Populate the streams with data. for (size_t i = 0; i < inputs.size(); ++i) { auto test_data = ::media::AudioBus::Create(kNumChannels, kNumFrames); - test_data->FromInterleaved(kEdgeData[i], kNumFrames, kBytesPerSample); + test_data->FromInterleaved<::media::SignedInt32SampleTypeTraits>( + kEdgeData[i], kNumFrames); inputs[i]->SetData(std::move(test_data)); EXPECT_CALL(*inputs[i], FillAudioPlaybackFrames(_, _, _)).Times(1); } @@ -724,7 +726,8 @@ // Use the hand-calculated results above. auto expected = ::media::AudioBus::Create(kNumChannels, kNumFrames); - expected->FromInterleaved(kResult, kNumFrames, kBytesPerSample); + expected->FromInterleaved<::media::SignedInt32SampleTypeTraits>(kResult, + kNumFrames); CompareAudioData(*expected, *actual);
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc index 4480e11..a1dc6cc 100644 --- a/chromeos/constants/chromeos_features.cc +++ b/chromeos/constants/chromeos_features.cc
@@ -43,6 +43,10 @@ // If enabled, DriveFS will be used for Drive sync. const base::Feature kDriveFs{"DriveFS", base::FEATURE_ENABLED_BY_DEFAULT}; +// If enabled shows the new visual signals feedback panel. +const base::Feature kEnableFileManagerFeedbackPanel{ + "EnableFeedbackPanel", base::FEATURE_DISABLED_BY_DEFAULT}; + // Enables or disables web push for background notifications in // Android Messages Integration on Chrome OS. const base::Feature kEnableMessagesWebPush{"EnableMessagesWebPush",
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h index 4cf0d5c..fc36915a 100644 --- a/chromeos/constants/chromeos_features.h +++ b/chromeos/constants/chromeos_features.h
@@ -31,6 +31,8 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kDiscoverApp; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kDriveFs; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) +extern const base::Feature kEnableFileManagerFeedbackPanel; +COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kEnableMessagesWebPush; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kMyFilesVolume; COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
diff --git a/chromeos/constants/chromeos_switches.cc b/chromeos/constants/chromeos_switches.cc index d0b14970..217a333 100644 --- a/chromeos/constants/chromeos_switches.cc +++ b/chromeos/constants/chromeos_switches.cc
@@ -143,9 +143,6 @@ const char kArcTransitionMigrationRequired[] = "arc-transition-migration-required"; -// Screenshot testing: specifies the directoru where artifacts will be stored. -const char kArtifactsDir[] = "artifacts-dir"; - // If this flag is set, it indicates that this device is a "Cellular First" // device. Cellular First devices use cellular telephone data networks as // their primary means of connecting to the internet. @@ -325,10 +322,6 @@ // Enables request of tablet site (via user agent override). const char kEnableRequestTabletSite[] = "enable-request-tablet-site"; -// Enables using screenshots in tests and seets mode. -const char kEnableScreenshotTestingWithMode[] = - "enable-screenshot-testing-with-mode"; - // Enables the touch calibration option in MD settings UI for valid touch // displays. const char kEnableTouchCalibrationSetting[] = @@ -410,10 +403,6 @@ // Force system compositor mode when set. const char kForceSystemCompositorMode[] = "force-system-compositor-mode"; -// Screenshot testing: specifies the directory where the golden screenshots are -// stored. -const char kGoldenScreenshotsDir[] = "golden-screenshots-dir"; - // Indicates that the browser is in "browse without sign-in" (Guest session) // mode. Should completely disable extensions, sync and bookmarks. const char kGuestSession[] = "bwsi";
diff --git a/chromeos/constants/chromeos_switches.h b/chromeos/constants/chromeos_switches.h index 934a0a79..365970c2 100644 --- a/chromeos/constants/chromeos_switches.h +++ b/chromeos/constants/chromeos_switches.h
@@ -48,7 +48,6 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kArcStartMode[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kArcTransitionMigrationRequired[]; -COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kArtifactsDir[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kCellularFirst[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kChildWallpaperLarge[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kChildWallpaperSmall[]; @@ -129,8 +128,6 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kEnableRequestTabletSite[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) -extern const char kEnableScreenshotTestingWithMode[]; -COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kEnableTouchCalibrationSetting[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kEnableTouchpadThreeFingerClick[]; @@ -165,7 +162,6 @@ extern const char kForceLoginManagerInTests[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kForceSystemCompositorMode[]; -COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGoldenScreenshotsDir[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestSession[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestWallpaperLarge[]; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const char kGuestWallpaperSmall[];
diff --git a/chromeos/dbus/BUILD.gn b/chromeos/dbus/BUILD.gn index 37a3f14f..91842e1 100644 --- a/chromeos/dbus/BUILD.gn +++ b/chromeos/dbus/BUILD.gn
@@ -20,7 +20,6 @@ ":cicerone_proto", ":concierge_proto", ":login_manager_proto", - ":media_perception_proto", ":metrics_event_proto", ":oobe_config_proto", ":plugin_vm_service_proto", @@ -36,9 +35,11 @@ "//chromeos/dbus/cryptohome", "//chromeos/dbus/cryptohome:cryptohome_proto", - # TODO(stevenjb): Remove once upstart gets its own BUILD.gn file. + # TODO(stevenjb): Remove these once upstart gets its own BUILD.gn file. # https://crbug.com/647367. "//chromeos/dbus/kerberos", + "//chromeos/dbus/media_analytics", + "//chromeos/dbus/media_analytics:media_perception_proto", "//components/account_id", "//components/device_event_log", "//components/policy:cloud_policy_proto_generated_compile", @@ -117,8 +118,6 @@ "fake_image_loader_client.h", "fake_lorgnette_manager_client.cc", "fake_lorgnette_manager_client.h", - "fake_media_analytics_client.cc", - "fake_media_analytics_client.h", "fake_modem_messaging_client.cc", "fake_modem_messaging_client.h", "fake_oobe_configuration_client.cc", @@ -159,8 +158,6 @@ "image_loader_client.h", "lorgnette_manager_client.cc", "lorgnette_manager_client.h", - "media_analytics_client.cc", - "media_analytics_client.h", "modem_messaging_client.cc", "modem_messaging_client.h", "oobe_configuration_client.cc", @@ -343,14 +340,6 @@ proto_out_dir = "chromeos/dbus/login_manager" } -proto_library("media_perception_proto") { - sources = [ - "proto/media_perception.proto", - ] - - proto_out_dir = "chromeos/dbus/media_perception" -} - proto_library("metrics_event_proto") { sources = [ "//third_party/cros_system_api/dbus/metrics_event/metrics_event.proto",
diff --git a/chromeos/dbus/dbus_clients_browser.cc b/chromeos/dbus/dbus_clients_browser.cc index 3b5c4a0..77610d4a 100644 --- a/chromeos/dbus/dbus_clients_browser.cc +++ b/chromeos/dbus/dbus_clients_browser.cc
@@ -30,7 +30,6 @@ #include "chromeos/dbus/fake_image_burner_client.h" #include "chromeos/dbus/fake_image_loader_client.h" #include "chromeos/dbus/fake_lorgnette_manager_client.h" -#include "chromeos/dbus/fake_media_analytics_client.h" #include "chromeos/dbus/fake_oobe_configuration_client.h" #include "chromeos/dbus/fake_runtime_probe_client.h" #include "chromeos/dbus/fake_seneschal_client.h" @@ -39,7 +38,6 @@ #include "chromeos/dbus/image_burner_client.h" #include "chromeos/dbus/image_loader_client.h" #include "chromeos/dbus/lorgnette_manager_client.h" -#include "chromeos/dbus/media_analytics_client.h" #include "chromeos/dbus/oobe_configuration_client.h" #include "chromeos/dbus/runtime_probe_client.h" #include "chromeos/dbus/seneschal_client.h" @@ -121,11 +119,6 @@ lorgnette_manager_client_.reset(new FakeLorgnetteManagerClient); if (use_real_clients) - media_analytics_client_.reset(MediaAnalyticsClient::Create()); - else - media_analytics_client_.reset(new FakeMediaAnalyticsClient); - - if (use_real_clients) oobe_configuration_client_ = OobeConfigurationClient::Create(); else oobe_configuration_client_.reset(new FakeOobeConfigurationClient); @@ -172,7 +165,6 @@ image_burner_client_->Init(system_bus); image_loader_client_->Init(system_bus); lorgnette_manager_client_->Init(system_bus); - media_analytics_client_->Init(system_bus); oobe_configuration_client_->Init(system_bus); runtime_probe_client_->Init(system_bus); seneschal_client_->Init(system_bus);
diff --git a/chromeos/dbus/dbus_clients_browser.h b/chromeos/dbus/dbus_clients_browser.h index 24c86b6..501ccb8 100644 --- a/chromeos/dbus/dbus_clients_browser.h +++ b/chromeos/dbus/dbus_clients_browser.h
@@ -30,7 +30,6 @@ class ImageBurnerClient; class ImageLoaderClient; class LorgnetteManagerClient; -class MediaAnalyticsClient; class OobeConfigurationClient; class RuntimeProbeClient; class SeneschalClient; @@ -67,7 +66,6 @@ std::unique_ptr<ImageBurnerClient> image_burner_client_; std::unique_ptr<ImageLoaderClient> image_loader_client_; std::unique_ptr<LorgnetteManagerClient> lorgnette_manager_client_; - std::unique_ptr<MediaAnalyticsClient> media_analytics_client_; std::unique_ptr<OobeConfigurationClient> oobe_configuration_client_; std::unique_ptr<RuntimeProbeClient> runtime_probe_client_; std::unique_ptr<SeneschalClient> seneschal_client_;
diff --git a/chromeos/dbus/dbus_thread_manager.cc b/chromeos/dbus/dbus_thread_manager.cc index dff47b6..31102b3 100644 --- a/chromeos/dbus/dbus_thread_manager.cc +++ b/chromeos/dbus/dbus_thread_manager.cc
@@ -29,7 +29,6 @@ #include "chromeos/dbus/image_burner_client.h" #include "chromeos/dbus/image_loader_client.h" #include "chromeos/dbus/lorgnette_manager_client.h" -#include "chromeos/dbus/media_analytics_client.h" #include "chromeos/dbus/modem_messaging_client.h" #include "chromeos/dbus/runtime_probe_client.h" #include "chromeos/dbus/seneschal_client.h" @@ -211,11 +210,6 @@ : nullptr; } -MediaAnalyticsClient* DBusThreadManager::GetMediaAnalyticsClient() { - return clients_browser_ ? clients_browser_->media_analytics_client_.get() - : nullptr; -} - ModemMessagingClient* DBusThreadManager::GetModemMessagingClient() { return clients_common_->modem_messaging_client_.get(); } @@ -429,12 +423,6 @@ std::move(client); } -void DBusThreadManagerSetter::SetMediaAnalyticsClient( - std::unique_ptr<MediaAnalyticsClient> client) { - DBusThreadManager::Get()->clients_browser_->media_analytics_client_ = - std::move(client); -} - void DBusThreadManagerSetter::SetSessionManagerClient( std::unique_ptr<SessionManagerClient> client) { DBusThreadManager::Get()->clients_common_->session_manager_client_ =
diff --git a/chromeos/dbus/dbus_thread_manager.h b/chromeos/dbus/dbus_thread_manager.h index a9cd8b2..288a8d0 100644 --- a/chromeos/dbus/dbus_thread_manager.h +++ b/chromeos/dbus/dbus_thread_manager.h
@@ -43,7 +43,6 @@ class ImageBurnerClient; class ImageLoaderClient; class LorgnetteManagerClient; -class MediaAnalyticsClient; class ModemMessagingClient; class OobeConfigurationClient; class RuntimeProbeClient; @@ -134,7 +133,6 @@ ImageBurnerClient* GetImageBurnerClient(); ImageLoaderClient* GetImageLoaderClient(); LorgnetteManagerClient* GetLorgnetteManagerClient(); - MediaAnalyticsClient* GetMediaAnalyticsClient(); ModemMessagingClient* GetModemMessagingClient(); OobeConfigurationClient* GetOobeConfigurationClient(); RuntimeProbeClient* GetRuntimeProbeClient(); @@ -190,7 +188,6 @@ void SetDebugDaemonClient(std::unique_ptr<DebugDaemonClient> client); void SetImageBurnerClient(std::unique_ptr<ImageBurnerClient> client); void SetImageLoaderClient(std::unique_ptr<ImageLoaderClient> client); - void SetMediaAnalyticsClient(std::unique_ptr<MediaAnalyticsClient> client); void SetSeneschalClient(std::unique_ptr<SeneschalClient> client); void SetRuntimeProbeClient(std::unique_ptr<RuntimeProbeClient> client); void SetSessionManagerClient(std::unique_ptr<SessionManagerClient> client);
diff --git a/chromeos/dbus/media_analytics/BUILD.gn b/chromeos/dbus/media_analytics/BUILD.gn new file mode 100644 index 0000000..fe98046 --- /dev/null +++ b/chromeos/dbus/media_analytics/BUILD.gn
@@ -0,0 +1,33 @@ +# Copyright 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//third_party/protobuf/proto_library.gni") + +assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") + +component("media_analytics") { + defines = [ "IS_MEDIA_ANALYTICS_CLIENT_IMPL" ] + + deps = [ + ":media_perception_proto", + "//base", + "//chromeos/dbus:common", + "//dbus", + ] + + sources = [ + "fake_media_analytics_client.cc", + "fake_media_analytics_client.h", + "media_analytics_client.cc", + "media_analytics_client.h", + ] +} + +proto_library("media_perception_proto") { + sources = [ + "media_perception.proto", + ] + + proto_out_dir = "chromeos/dbus/media_perception" +}
diff --git a/chromeos/dbus/fake_media_analytics_client.cc b/chromeos/dbus/media_analytics/fake_media_analytics_client.cc similarity index 89% rename from chromeos/dbus/fake_media_analytics_client.cc rename to chromeos/dbus/media_analytics/fake_media_analytics_client.cc index c4484d39..830096f 100644 --- a/chromeos/dbus/fake_media_analytics_client.cc +++ b/chromeos/dbus/media_analytics/fake_media_analytics_client.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/dbus/fake_media_analytics_client.h" +#include "chromeos/dbus/media_analytics/fake_media_analytics_client.h" #include <utility> @@ -12,12 +12,29 @@ namespace chromeos { +namespace { + +FakeMediaAnalyticsClient* g_instance = nullptr; + +} // namespace + FakeMediaAnalyticsClient::FakeMediaAnalyticsClient() : process_running_(false), weak_ptr_factory_(this) { current_state_.set_status(mri::State::UNINITIALIZED); + DCHECK(!g_instance); + g_instance = this; } -FakeMediaAnalyticsClient::~FakeMediaAnalyticsClient() = default; +FakeMediaAnalyticsClient::~FakeMediaAnalyticsClient() { + DCHECK_EQ(this, g_instance); + g_instance = nullptr; +} + +// static +FakeMediaAnalyticsClient* FakeMediaAnalyticsClient::Get() { + DCHECK(g_instance); + return g_instance; +} bool FakeMediaAnalyticsClient::FireMediaPerceptionEvent( const mri::MediaPerception& media_perception) { @@ -35,8 +52,6 @@ diagnostics_ = diagnostics; } -void FakeMediaAnalyticsClient::Init(dbus::Bus* bus) {} - void FakeMediaAnalyticsClient::AddObserver(Observer* observer) { observer_list_.AddObserver(observer); }
diff --git a/chromeos/dbus/fake_media_analytics_client.h b/chromeos/dbus/media_analytics/fake_media_analytics_client.h similarity index 84% rename from chromeos/dbus/fake_media_analytics_client.h rename to chromeos/dbus/media_analytics/fake_media_analytics_client.h index 61b52dc1..d81f7f43 100644 --- a/chromeos/dbus/fake_media_analytics_client.h +++ b/chromeos/dbus/media_analytics/fake_media_analytics_client.h
@@ -2,27 +2,31 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ -#define CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ +#ifndef CHROMEOS_DBUS_MEDIA_ANALYTICS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ +#define CHROMEOS_DBUS_MEDIA_ANALYTICS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ #include "base/callback.h" #include "base/component_export.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include "chromeos/dbus/media_perception/media_perception.pb.h" namespace chromeos { // MediaAnalyticsClient is used to communicate with a media analytics process // running outside of Chrome. -class COMPONENT_EXPORT(CHROMEOS_DBUS) FakeMediaAnalyticsClient +class COMPONENT_EXPORT(MEDIA_ANALYTICS_CLIENT) FakeMediaAnalyticsClient : public MediaAnalyticsClient { public: FakeMediaAnalyticsClient(); ~FakeMediaAnalyticsClient() override; + // Checks that a FakeMediaAnalyticsClient instance was initialized and returns + // it. + static FakeMediaAnalyticsClient* Get(); + // Inherited from MediaAnalyticsClient. void AddObserver(Observer* observer) override; void RemoveObserver(Observer* observer) override; @@ -33,9 +37,6 @@ void BootstrapMojoConnection(base::ScopedFD file_descriptor, VoidDBusMethodCallback callback) override; - // Inherited from DBusClient. - void Init(dbus::Bus* bus) override; - // Fires a fake media perception event. bool FireMediaPerceptionEvent(const mri::MediaPerception& media_perception); @@ -80,4 +81,4 @@ } // namespace chromeos -#endif // CHROMEOS_DBUS_FAKE_MEDIA_ANALYTICS_CLIENT_H_ +#endif // CHROMEOS_DBUS_MEDIA_ANALYTICS_FAKE_MEDIA_ANALYTICS_CLIENT_H_
diff --git a/chromeos/dbus/media_analytics_client.cc b/chromeos/dbus/media_analytics/media_analytics_client.cc similarity index 87% rename from chromeos/dbus/media_analytics_client.cc rename to chromeos/dbus/media_analytics/media_analytics_client.cc index 33b650d..3898507 100644 --- a/chromeos/dbus/media_analytics_client.cc +++ b/chromeos/dbus/media_analytics/media_analytics_client.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include <cstdint> #include <string> @@ -12,6 +12,7 @@ #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "chromeos/dbus/media_analytics/fake_media_analytics_client.h" #include "dbus/bus.h" #include "dbus/message.h" #include "dbus/object_path.h" @@ -20,6 +21,12 @@ namespace chromeos { +namespace { + +MediaAnalyticsClient* g_instance = nullptr; + +} // namespace + // The MediaAnalyticsClient implementation used in production. class MediaAnalyticsClientImpl : public MediaAnalyticsClient { public: @@ -84,8 +91,7 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } - protected: - void Init(dbus::Bus* bus) override { + void Init(dbus::Bus* bus) { dbus_proxy_ = bus->GetObjectProxy( media_perception::kMediaPerceptionServiceName, dbus::ObjectPath(media_perception::kMediaPerceptionServicePath)); @@ -171,12 +177,36 @@ DISALLOW_COPY_AND_ASSIGN(MediaAnalyticsClientImpl); }; -MediaAnalyticsClient::~MediaAnalyticsClient() = default; - -MediaAnalyticsClient* MediaAnalyticsClient::Create() { - return new MediaAnalyticsClientImpl; +MediaAnalyticsClient::MediaAnalyticsClient() { + DCHECK(!g_instance); + g_instance = this; } -MediaAnalyticsClient::MediaAnalyticsClient() = default; +MediaAnalyticsClient::~MediaAnalyticsClient() { + DCHECK_EQ(this, g_instance); + g_instance = nullptr; +} + +// static +void MediaAnalyticsClient::Initialize(dbus::Bus* bus) { + DCHECK(bus); + (new MediaAnalyticsClientImpl())->Init(bus); +} + +// static +void MediaAnalyticsClient::InitializeFake() { + new FakeMediaAnalyticsClient(); +} + +// static +void MediaAnalyticsClient::Shutdown() { + DCHECK(g_instance); + delete g_instance; +} + +// static +MediaAnalyticsClient* MediaAnalyticsClient::Get() { + return g_instance; +} } // namespace chromeos
diff --git a/chromeos/dbus/media_analytics_client.h b/chromeos/dbus/media_analytics/media_analytics_client.h similarity index 72% rename from chromeos/dbus/media_analytics_client.h rename to chromeos/dbus/media_analytics/media_analytics_client.h index f7209dc..8aa9b29 100644 --- a/chromeos/dbus/media_analytics_client.h +++ b/chromeos/dbus/media_analytics/media_analytics_client.h
@@ -2,22 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_ -#define CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_ +#ifndef CHROMEOS_DBUS_MEDIA_ANALYTICS_MEDIA_ANALYTICS_CLIENT_H_ +#define CHROMEOS_DBUS_MEDIA_ANALYTICS_MEDIA_ANALYTICS_CLIENT_H_ #include "base/callback.h" #include "base/component_export.h" #include "base/files/scoped_file.h" #include "base/macros.h" -#include "chromeos/dbus/dbus_client.h" #include "chromeos/dbus/dbus_method_call_status.h" #include "chromeos/dbus/media_perception/media_perception.pb.h" +namespace dbus { +class Bus; +} + namespace chromeos { // MediaAnalyticsClient is used to communicate with a media analytics process // running outside of Chrome. -class COMPONENT_EXPORT(CHROMEOS_DBUS) MediaAnalyticsClient : public DBusClient { +class COMPONENT_EXPORT(MEDIA_ANALYTICS_CLIENT) MediaAnalyticsClient { public: class Observer { public: @@ -29,7 +32,17 @@ virtual ~Observer() = default; }; - ~MediaAnalyticsClient() override; + // Creates and initializes the global instance. |bus| must not be null. + static void Initialize(dbus::Bus* bus); + + // Creates and initializes a fake global instance if not already created. + static void InitializeFake(); + + // Destroys the global instance which must have been initialized. + static void Shutdown(); + + // Returns the global instance if initialized. May return null. + static MediaAnalyticsClient* Get(); // Adds or removes an observer. virtual void AddObserver(Observer* observer) = 0; @@ -59,7 +72,9 @@ static MediaAnalyticsClient* Create(); protected: + // Initialize/Shutdown should be used instead. MediaAnalyticsClient(); + virtual ~MediaAnalyticsClient(); private: DISALLOW_COPY_AND_ASSIGN(MediaAnalyticsClient); @@ -67,4 +82,4 @@ } // namespace chromeos -#endif // CHROMEOS_DBUS_MEDIA_ANALYTICS_CLIENT_H_ +#endif // CHROMEOS_DBUS_MEDIA_ANALYTICS_MEDIA_ANALYTICS_CLIENT_H_
diff --git a/chromeos/dbus/proto/media_perception.proto b/chromeos/dbus/media_analytics/media_perception.proto similarity index 100% rename from chromeos/dbus/proto/media_perception.proto rename to chromeos/dbus/media_analytics/media_perception.proto
diff --git a/chromeos/dbus/session_manager/fake_session_manager_client.cc b/chromeos/dbus/session_manager/fake_session_manager_client.cc index 55772ab..4189778 100644 --- a/chromeos/dbus/session_manager/fake_session_manager_client.cc +++ b/chromeos/dbus/session_manager/fake_session_manager_client.cc
@@ -380,6 +380,16 @@ void FakeSessionManagerClient::RetrievePolicy( const login_manager::PolicyDescriptor& descriptor, RetrievePolicyCallback callback) { + // Simulate load error. + if (force_retrieve_policy_load_error_) { + enterprise_management::PolicyFetchResponse empty; + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), RetrievePolicyResponseType::SUCCESS, + empty.SerializeAsString())); + return; + } + if (policy_storage_ == PolicyStorageType::kOnDisk) { base::FilePath policy_path = GetStubPolicyFilePath(descriptor, nullptr /* key_path */); @@ -451,7 +461,7 @@ } // Simulate failure. - if (!store_policy_success_) { + if (force_store_policy_failure_) { PostReply(FROM_HERE, std::move(callback), false /* success */); return; }
diff --git a/chromeos/dbus/session_manager/fake_session_manager_client.h b/chromeos/dbus/session_manager/fake_session_manager_client.h index 6d707dc..8c45ad7 100644 --- a/chromeos/dbus/session_manager/fake_session_manager_client.h +++ b/chromeos/dbus/session_manager/fake_session_manager_client.h
@@ -133,9 +133,17 @@ supports_restart_to_apply_user_flags; } - void set_store_policy_success(bool success) { - store_policy_success_ = success; + // If |force_failure| is true, forces StorePolicy() to fail. + void ForceStorePolicyFailure(bool force_failure) { + force_store_policy_failure_ = force_failure; } + + // If |force_load_error| is true, forces RetrievePolicy() to succeed with an + // empty policy blob. This simulates a policy load error in session manager. + void ForceRetrievePolicyLoadError(bool force_load_error) { + force_retrieve_policy_load_error_ = force_load_error; + } + // Accessors for device policy. Only available for // PolicyStorageType::kInMemory. const std::string& device_policy() const; @@ -226,8 +234,12 @@ const PolicyStorageType policy_storage_; std::map<std::string, std::string> policy_; - // If set to false, StorePolicy() always fails. - bool store_policy_success_ = true; + // If set to true, StorePolicy() always fails. + bool force_store_policy_failure_ = false; + + // It set to true, RetrievePolicy() always succeeds with an empty policy blob. + // This simulates a policy load error in session manager. + bool force_retrieve_policy_load_error_ = false; int clear_forced_re_enrollment_vpd_call_count_; int start_device_wipe_call_count_;
diff --git a/chromeos/dbus/upstart/fake_upstart_client.cc b/chromeos/dbus/upstart/fake_upstart_client.cc index 432e5718..53c98683 100644 --- a/chromeos/dbus/upstart/fake_upstart_client.cc +++ b/chromeos/dbus/upstart/fake_upstart_client.cc
@@ -7,10 +7,9 @@ #include "base/bind.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/dbus/auth_policy/fake_auth_policy_client.h" -#include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/fake_media_analytics_client.h" #include "chromeos/dbus/kerberos/fake_kerberos_client.h" #include "chromeos/dbus/kerberos/kerberos_client.h" +#include "chromeos/dbus/media_analytics/fake_media_analytics_client.h" namespace chromeos { @@ -66,41 +65,29 @@ void FakeUpstartClient::StartMediaAnalytics( const std::vector<std::string>& /* upstart_env */, VoidDBusMethodCallback callback) { - FakeMediaAnalyticsClient* media_analytics_client = - static_cast<FakeMediaAnalyticsClient*>( - DBusThreadManager::Get()->GetMediaAnalyticsClient()); - DLOG_IF(WARNING, media_analytics_client->process_running()) + DLOG_IF(WARNING, FakeMediaAnalyticsClient::Get()->process_running()) << "Trying to start media analytics which is already started."; - media_analytics_client->set_process_running(true); + FakeMediaAnalyticsClient::Get()->set_process_running(true); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), true)); } void FakeUpstartClient::RestartMediaAnalytics(VoidDBusMethodCallback callback) { - FakeMediaAnalyticsClient* media_analytics_client = - static_cast<FakeMediaAnalyticsClient*>( - DBusThreadManager::Get()->GetMediaAnalyticsClient()); - media_analytics_client->set_process_running(false); - media_analytics_client->set_process_running(true); - media_analytics_client->SetStateSuspended(); + FakeMediaAnalyticsClient::Get()->set_process_running(false); + FakeMediaAnalyticsClient::Get()->set_process_running(true); + FakeMediaAnalyticsClient::Get()->SetStateSuspended(); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), true)); } void FakeUpstartClient::StopMediaAnalytics() { - FakeMediaAnalyticsClient* media_analytics_client = - static_cast<FakeMediaAnalyticsClient*>( - DBusThreadManager::Get()->GetMediaAnalyticsClient()); - DLOG_IF(WARNING, !media_analytics_client->process_running()) + DLOG_IF(WARNING, !FakeMediaAnalyticsClient::Get()->process_running()) << "Trying to stop media analytics which is not started."; - media_analytics_client->set_process_running(false); + FakeMediaAnalyticsClient::Get()->set_process_running(false); } void FakeUpstartClient::StopMediaAnalytics(VoidDBusMethodCallback callback) { - FakeMediaAnalyticsClient* media_analytics_client = - static_cast<FakeMediaAnalyticsClient*>( - DBusThreadManager::Get()->GetMediaAnalyticsClient()); - media_analytics_client->set_process_running(false); + FakeMediaAnalyticsClient::Get()->set_process_running(false); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), true)); }
diff --git a/chromeos/services/assistant/PRESUBMIT.py b/chromeos/services/assistant/PRESUBMIT.py new file mode 100644 index 0000000..427d98bd --- /dev/null +++ b/chromeos/services/assistant/PRESUBMIT.py
@@ -0,0 +1,27 @@ +# 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. + +"""Presubmit script for Assistant. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details about the presubmit API built into depot_tools. +""" + + +def PostUploadHook(cl, change, output_api): + """git cl upload will call this hook after the issue is created/modified. + """ + + results = [] + issue = cl.issue + if issue: + description_lines, footers = cl.GetDescriptionFooters() + trybot_tag = 'CQ_INCLUDE_TRYBOTS=luci.chrome.try:linux-chromeos-chrome' + if trybot_tag not in description_lines: + description_lines.append('') + description_lines.append(trybot_tag) + cl.UpdateDescriptionFooters(description_lines, footers) + + return results +
diff --git a/chromeos/services/assistant/audio_decoder/assistant_audio_decoder.cc b/chromeos/services/assistant/audio_decoder/assistant_audio_decoder.cc index 9a68d8c0..8fc9bce 100644 --- a/chromeos/services/assistant/audio_decoder/assistant_audio_decoder.cc +++ b/chromeos/services/assistant/audio_decoder/assistant_audio_decoder.cc
@@ -136,8 +136,8 @@ const int bytes_to_alloc = audio_bus->frames() * kBytesPerSample * audio_bus->channels(); std::vector<uint8_t> buffer(bytes_to_alloc); - audio_bus->ToInterleaved(audio_bus->frames(), kBytesPerSample, - buffer.data()); + audio_bus->ToInterleaved<media::SignedInt16SampleTypeTraits>( + audio_bus->frames(), buffer.data()); buffers.emplace_back(buffer); } client_->OnNewBuffers(buffers);
diff --git a/components/BUILD.gn b/components/BUILD.gn index 4b65b89a..b06476f 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn
@@ -56,8 +56,6 @@ } if (is_android) { - enable_multidex = true - # The tracing unittests require this for testing unwinding. See # stack_unwinder_android_unittest.cc. if (can_unwind_with_cfi_table && is_official_build) { @@ -540,7 +538,6 @@ } if (is_android) { - enable_multidex = true sources += [ "autofill_assistant/browser/web_controller_browsertest.cc", "test/android/browsertests_apk/components_browser_tests_jni_onload.cc", @@ -624,7 +621,6 @@ ] if (is_android) { - enable_multidex = true deps += [ "//ui/android:ui_java" ] if (use_v8_context_snapshot) { deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_assets" ]
diff --git a/components/autofill/core/browser/autofill_profile_unittest.cc b/components/autofill/core/browser/autofill_profile_unittest.cc index 49ba721..ac047589 100644 --- a/components/autofill/core/browser/autofill_profile_unittest.cc +++ b/components/autofill/core/browser/autofill_profile_unittest.cc
@@ -306,25 +306,21 @@ "antoine@exemple.com", "Exemple Inc", "8 Rue de Londres", "", "Paris", "", "75009", "FR", "+33 (0) 1 42 68 53 00"); profiles.back()->set_language_code("fr_FR"); - profiles.back()->SetInfo( - AutofillType(ADDRESS_HOME_SORTING_CODE), UTF8ToUTF16("CEDEX"), "en-US"); static const char* kExpectedLabels[] = { "", "Antoine de Saint-Exupéry", "Antoine de Saint-Exupéry, 8 Rue de Londres", "Antoine de Saint-Exupéry, 8 Rue de Londres, Paris", "Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris", - "Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris CEDEX", - "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris " - "CEDEX", - "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris " - "CEDEX, France", - "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris " - "CEDEX, France, antoine@exemple.com", - "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris " - "CEDEX, France, antoine@exemple.com, +33 (0) 1 42 68 53 00", - "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris " - "CEDEX, France, antoine@exemple.com, +33 (0) 1 42 68 53 00", + "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris", + "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris, " + "France", + "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris, " + "France, antoine@exemple.com", + "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris, " + "France, antoine@exemple.com, +33 (0) 1 42 68 53 00", + "Exemple Inc, Antoine de Saint-Exupéry, 8 Rue de Londres, 75009 Paris, " + "France, antoine@exemple.com, +33 (0) 1 42 68 53 00", }; std::vector<base::string16> labels;
diff --git a/components/autofill_assistant/browser/BUILD.gn b/components/autofill_assistant/browser/BUILD.gn index dd88e9f..432dff1 100644 --- a/components/autofill_assistant/browser/BUILD.gn +++ b/components/autofill_assistant/browser/BUILD.gn
@@ -117,6 +117,8 @@ "service.cc", "service.h", "state.h", + "string_conversions_util.cc", + "string_conversions_util.h", "ui_controller.cc", "ui_controller.h", "ui_delegate.h", @@ -165,6 +167,7 @@ "script_executor_unittest.cc", "script_precondition_unittest.cc", "script_tracker_unittest.cc", + "string_conversions_util_unittest.cc", ] deps = [
diff --git a/components/autofill_assistant/browser/DEPS b/components/autofill_assistant/browser/DEPS index b6e26e3..ab280e4 100644 --- a/components/autofill_assistant/browser/DEPS +++ b/components/autofill_assistant/browser/DEPS
@@ -10,6 +10,8 @@ "+services/network/public/cpp", "+services/identity/public/cpp", "+third_party/blink/public/mojom/payments/payment_request.mojom.h", + "+third_party/icu/source/common/unicode", "+third_party/re2", "+ui/base/l10n/l10n_util.h", + "+ui/events/keycodes/dom", ]
diff --git a/components/autofill_assistant/browser/actions/action_delegate.h b/components/autofill_assistant/browser/actions/action_delegate.h index 2270859..b6bde7b8 100644 --- a/components/autofill_assistant/browser/actions/action_delegate.h +++ b/components/autofill_assistant/browser/actions/action_delegate.h
@@ -16,6 +16,7 @@ #include "components/autofill_assistant/browser/selector.h" #include "components/autofill_assistant/browser/ui_controller.h" #include "third_party/blink/public/mojom/payments/payment_request.mojom.h" +#include "third_party/icu/source/common/unicode/umachine.h" class GURL; @@ -164,11 +165,11 @@ const std::string& value, base::OnceCallback<void(const ClientStatus&)> callback) = 0; - // Sets the keyboard focus to |selector| and inputs the specified text parts. + // Sets the keyboard focus to |selector| and inputs the specified codepoints. // Returns the result through |callback|. virtual void SendKeyboardInput( const Selector& selector, - const std::vector<std::string>& text_parts, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback) = 0; // Return the outerHTML of an element given by |selector|.
diff --git a/components/autofill_assistant/browser/actions/mock_action_delegate.h b/components/autofill_assistant/browser/actions/mock_action_delegate.h index 39122d6e..2567aaf4 100644 --- a/components/autofill_assistant/browser/actions/mock_action_delegate.h +++ b/components/autofill_assistant/browser/actions/mock_action_delegate.h
@@ -124,7 +124,7 @@ MOCK_METHOD3(SendKeyboardInput, void(const Selector& selector, - const std::vector<std::string>& text_parts, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback)); MOCK_METHOD2(GetOuterHtml, void(const Selector& selector,
diff --git a/components/autofill_assistant/browser/actions/set_form_field_value_action.cc b/components/autofill_assistant/browser/actions/set_form_field_value_action.cc index 427ae88f..bd080cc8 100644 --- a/components/autofill_assistant/browser/actions/set_form_field_value_action.cc +++ b/components/autofill_assistant/browser/actions/set_form_field_value_action.cc
@@ -9,6 +9,7 @@ #include "base/bind.h" #include "base/callback.h" #include "components/autofill_assistant/browser/actions/action_delegate.h" +#include "components/autofill_assistant/browser/string_conversions_util.h" namespace autofill_assistant { @@ -76,7 +77,7 @@ // You should use the `keyboard_input' field instead. if (key_field.keycode() < 128) { // US-ASCII delegate->SendKeyboardInput( - selector, {std::string(1, char(key_field.keycode()))}, + selector, {key_field.keycode()}, base::BindOnce(&SetFormFieldValueAction::OnSetFieldValue, weak_ptr_factory_.GetWeakPtr(), delegate, std::move(callback), @@ -85,14 +86,14 @@ DVLOG(3) << "SetFormFieldValueProto_KeyPress: field `keycode' is deprecated " << "and only supports US-ASCII values (encountered " - << key_field.keycode() << "). Use field `key' instead."; + << key_field.keycode() << "). Use field `keyboard_input' instead."; OnSetFieldValue(delegate, std::move(callback), next, ClientStatus(INVALID_ACTION)); } break; case SetFormFieldValueProto_KeyPress::kKeyboardInput: delegate->SendKeyboardInput( - selector, {key_field.keyboard_input()}, + selector, UTF8ToUnicode(key_field.keyboard_input()), base::BindOnce(&SetFormFieldValueAction::OnSetFieldValue, weak_ptr_factory_.GetWeakPtr(), delegate, std::move(callback),
diff --git a/components/autofill_assistant/browser/script_executor.cc b/components/autofill_assistant/browser/script_executor.cc index 291045ef..84fa223 100644 --- a/components/autofill_assistant/browser/script_executor.cc +++ b/components/autofill_assistant/browser/script_executor.cc
@@ -321,9 +321,9 @@ void ScriptExecutor::SendKeyboardInput( const Selector& selector, - const std::vector<std::string>& text_parts, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback) { - delegate_->GetWebController()->SendKeyboardInput(selector, text_parts, + delegate_->GetWebController()->SendKeyboardInput(selector, codepoints, std::move(callback)); }
diff --git a/components/autofill_assistant/browser/script_executor.h b/components/autofill_assistant/browser/script_executor.h index 8db1df1f..1726b350 100644 --- a/components/autofill_assistant/browser/script_executor.h +++ b/components/autofill_assistant/browser/script_executor.h
@@ -154,7 +154,7 @@ base::OnceCallback<void(const ClientStatus&)> callback) override; void SendKeyboardInput( const Selector& selector, - const std::vector<std::string>& text_parts, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback) override; void GetOuterHtml( const Selector& selector,
diff --git a/components/autofill_assistant/browser/string_conversions_util.cc b/components/autofill_assistant/browser/string_conversions_util.cc new file mode 100644 index 0000000..212bafa --- /dev/null +++ b/components/autofill_assistant/browser/string_conversions_util.cc
@@ -0,0 +1,51 @@ +// 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 "components/autofill_assistant/browser/string_conversions_util.h" + +#include "base/i18n/char_iterator.h" +#include "base/logging.h" +#include "base/stl_util.h" +#include "base/strings/utf_string_conversions.h" +#include "third_party/icu/source/common/unicode/utf8.h" + +namespace autofill_assistant { + +std::vector<UChar32> UTF8ToUnicode(const std::string& text) { + std::vector<UChar32> codepoints; + codepoints.reserve(text.length()); // upper bound + base::i18n::UTF8CharIterator iter(&text); + while (!iter.end()) { + codepoints.emplace_back(iter.get()); + iter.Advance(); + } + return codepoints; +} + +bool UnicodeToUTF8(const std::vector<UChar32>& source, std::string* target) { + target->reserve(target->size() + source.size() * 4); + for (auto codepoint : source) { + if (!AppendUnicodeToUTF8(codepoint, target)) { + DVLOG(1) << __func__ << ": Failed to convert codepoint " << codepoint + << " to UTF-8"; + return false; + } + } + return true; +} + +// Converts a single unicode codepoint to UTF-8 and appends the result to +// |target|. +bool AppendUnicodeToUTF8(const UChar32 source, std::string* target) { + char bytes[4]; + UBool error = FALSE; + size_t offset = 0; + U8_APPEND(bytes, offset, base::size(bytes), source, error); + if (error == FALSE) { + target->append(bytes, offset); + } + return error == FALSE; +} + +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/string_conversions_util.h b/components/autofill_assistant/browser/string_conversions_util.h new file mode 100644 index 0000000..86f3b79 --- /dev/null +++ b/components/autofill_assistant/browser/string_conversions_util.h
@@ -0,0 +1,28 @@ +// 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_AUTOFILL_ASSISTANT_BROWSER_STRING_CONVERSIONS_UTIL_H_ +#define COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_STRING_CONVERSIONS_UTIL_H_ + +#include <string> +#include <vector> + +#include "third_party/icu/source/common/unicode/umachine.h" + +namespace autofill_assistant { + +// Converts a UTF-8 encoded string to a vector of unicode codepoints. +std::vector<UChar32> UTF8ToUnicode(const std::string& text); + +// Converts a series of unicode codepoints to an UTF-8 encoded string and +// assigns the result to |target|. +bool UnicodeToUTF8(const std::vector<UChar32>& source, std::string* target); + +// Converts a single unicode codepoint to UTF-8 and appends the result to +// |target|. +bool AppendUnicodeToUTF8(const UChar32 source, std::string* target); + +} // namespace autofill_assistant + +#endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_STRING_CONVERSIONS_UTIL_H_
diff --git a/components/autofill_assistant/browser/string_conversions_util_unittest.cc b/components/autofill_assistant/browser/string_conversions_util_unittest.cc new file mode 100644 index 0000000..f4ff11d --- /dev/null +++ b/components/autofill_assistant/browser/string_conversions_util_unittest.cc
@@ -0,0 +1,26 @@ +// 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 "components/autofill_assistant/browser/string_conversions_util.h" + +#include "testing/gmock/include/gmock/gmock.h" + +namespace autofill_assistant { +namespace { + +using ::testing::_; +using ::testing::Eq; + +TEST(StringConversionsTest, ConversionIsSymmetrical) { + // String containing 1-byte, 2-byte, 3-byte and 4-byte UTF-8 characters. + std::string input = "Aü万𠜎"; + + auto codepoints = UTF8ToUnicode(input); + std::string output; + EXPECT_TRUE(UnicodeToUTF8(codepoints, &output)); + EXPECT_EQ(input, output); +} + +} // namespace +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/web_controller.cc b/components/autofill_assistant/browser/web_controller.cc index 90dd094..3ecb899 100644 --- a/components/autofill_assistant/browser/web_controller.cc +++ b/components/autofill_assistant/browser/web_controller.cc
@@ -12,11 +12,9 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/callback.h" -#include "base/i18n/char_iterator.h" #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" #include "base/task/post_task.h" #include "build/build_config.h" #include "components/autofill/content/browser/content_autofill_driver.h" @@ -25,10 +23,13 @@ #include "components/autofill/core/common/autofill_constants.h" #include "components/autofill/core/common/form_data.h" #include "components/autofill_assistant/browser/rectf.h" +#include "components/autofill_assistant/browser/string_conversions_util.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" +#include "ui/events/keycodes/dom/dom_key.h" +#include "ui/events/keycodes/dom/keycode_converter.h" namespace autofill_assistant { using autofill::ContentAutofillDriver; @@ -1312,30 +1313,14 @@ DVLOG(3) << __func__ << " " << selector << ", value=" << value << ", simulate_key_presses=" << simulate_key_presses; if (simulate_key_presses) { - std::vector<std::string> utf8_chars; - base::i18n::UTF8CharIterator iter(&value); - while (!iter.end()) { - wchar_t wide_char = iter.get(); - std::string utf8_char; - if (!base::WideToUTF8(&wide_char, 1, &utf8_char)) { - DVLOG(1) << __func__ - << " Failed to convert character to UTF-8: " << wide_char; - std::move(callback).Run(ClientStatus(INVALID_ACTION)); - return; - } - - utf8_chars.push_back(utf8_char); - iter.Advance(); - } - // We first clear the field value, and then simulate the key presses. // TODO(crbug.com/806868): Disable keyboard during this action and then // reset to previous state. InternalSetFieldValue( selector, "", base::BindOnce(&WebController::OnClearFieldForSendKeyboardInput, - weak_ptr_factory_.GetWeakPtr(), selector, utf8_chars, - std::move(callback))); + weak_ptr_factory_.GetWeakPtr(), selector, + UTF8ToUnicode(value), std::move(callback))); return; } InternalSetFieldValue(selector, value, std::move(callback)); @@ -1354,72 +1339,81 @@ void WebController::OnClearFieldForSendKeyboardInput( const Selector& selector, - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback, const ClientStatus& clear_status) { if (!clear_status.ok()) { std::move(callback).Run(clear_status); return; } - SendKeyboardInput(selector, utf8_chars, std::move(callback)); + SendKeyboardInput(selector, codepoints, std::move(callback)); } void WebController::OnClickElementForSendKeyboardInput( - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback, const ClientStatus& click_status) { if (!click_status.ok()) { std::move(callback).Run(click_status); return; } - DispatchKeyboardTextDownEvent(utf8_chars, 0, std::move(callback)); + DispatchKeyboardTextDownEvent(codepoints, 0, std::move(callback)); } void WebController::DispatchKeyboardTextDownEvent( - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, size_t index, base::OnceCallback<void(const ClientStatus&)> callback) { - if (index >= utf8_chars.size()) { + if (index >= codepoints.size()) { std::move(callback).Run(OkClientStatus()); return; } devtools_client_->GetInput()->DispatchKeyEvent( - CreateKeyEventParamsFromText( + CreateKeyEventParamsForCharacter( autofill_assistant::input::DispatchKeyEventType::KEY_DOWN, - utf8_chars[index]), + codepoints[index]), base::BindOnce(&WebController::DispatchKeyboardTextUpEvent, - weak_ptr_factory_.GetWeakPtr(), utf8_chars, index, + weak_ptr_factory_.GetWeakPtr(), codepoints, index, std::move(callback))); } void WebController::DispatchKeyboardTextUpEvent( - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, size_t index, base::OnceCallback<void(const ClientStatus&)> callback) { - DCHECK_LT(index, utf8_chars.size()); + DCHECK_LT(index, codepoints.size()); devtools_client_->GetInput()->DispatchKeyEvent( - CreateKeyEventParamsFromText( + CreateKeyEventParamsForCharacter( autofill_assistant::input::DispatchKeyEventType::KEY_UP, - utf8_chars[index]), + codepoints[index]), base::BindOnce(&WebController::DispatchKeyboardTextDownEvent, - weak_ptr_factory_.GetWeakPtr(), utf8_chars, index + 1, + weak_ptr_factory_.GetWeakPtr(), codepoints, index + 1, std::move(callback))); } -auto WebController::CreateKeyEventParamsFromText( +auto WebController::CreateKeyEventParamsForCharacter( autofill_assistant::input::DispatchKeyEventType type, - const std::string& text) -> DispatchKeyEventParamsPtr { + UChar32 codepoint) -> DispatchKeyEventParamsPtr { auto params = input::DispatchKeyEventParams::Builder().SetType(type).Build(); - params->SetText(text); - return params; -} -void WebController::OnPressKeyboard( - int key_code, - base::OnceCallback<void(bool)> callback, - std::unique_ptr<runtime::CallFunctionOnResult> result) { - std::move(callback).Run(result && !result->HasExceptionDetails()); + std::string text; + if (AppendUnicodeToUTF8(codepoint, &text)) { + params->SetText(text); + } else { + DVLOG(1) << __func__ + << ": Failed to convert codepoint to UTF-8: " << codepoint; + } + + auto dom_key = ui::DomKey::FromCharacter(codepoint); + if (dom_key.IsValid()) { + params->SetKey(ui::KeycodeConverter::DomKeyToKeyString(dom_key)); + } else { + DVLOG(1) << __func__ + << ": Failed to set DomKey for codepoint: " << codepoint; + } + + return params; } void WebController::OnFindElementForSetFieldValue( @@ -1517,21 +1511,27 @@ void WebController::SendKeyboardInput( const Selector& selector, - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback) { - DVLOG(3) << __func__ << " " << selector - << ", input=" << base::JoinString(utf8_chars, ""); + if (VLOG_IS_ON(3)) { + std::string input_str; + if (!UnicodeToUTF8(codepoints, &input_str)) { + input_str.assign("<invalid input>"); + } + DVLOG(3) << __func__ << " " << selector << ", input=" << input_str; + } + DCHECK(!selector.empty()); FindElement(selector, kVisibilityCheck, /* strict_mode= */ true, base::BindOnce(&WebController::OnFindElementForSendKeyboardInput, weak_ptr_factory_.GetWeakPtr(), selector, - utf8_chars, std::move(callback))); + codepoints, std::move(callback))); } void WebController::OnFindElementForSendKeyboardInput( const Selector& selector, - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback, const ClientStatus& status, std::unique_ptr<FindElementResult> element_result) { @@ -1541,7 +1541,7 @@ } ClickElement(selector, base::BindOnce( &WebController::OnClickElementForSendKeyboardInput, - weak_ptr_factory_.GetWeakPtr(), utf8_chars, + weak_ptr_factory_.GetWeakPtr(), codepoints, std::move(callback))); }
diff --git a/components/autofill_assistant/browser/web_controller.h b/components/autofill_assistant/browser/web_controller.h index ef52d75..a6cae588 100644 --- a/components/autofill_assistant/browser/web_controller.h +++ b/components/autofill_assistant/browser/web_controller.h
@@ -22,6 +22,7 @@ #include "components/autofill_assistant/browser/devtools/devtools_client.h" #include "components/autofill_assistant/browser/rectf.h" #include "components/autofill_assistant/browser/selector.h" +#include "third_party/icu/source/common/unicode/umachine.h" #include "url/gurl.h" namespace autofill { @@ -120,12 +121,12 @@ const std::string& value, base::OnceCallback<void(const ClientStatus&)> callback); - // Sets the keyboard focus to |selector| and inputs the specified UTF-8 - // characters in the specified order. + // Sets the keyboard focus to |selector| and inputs |codepoints|, one + // character at a time. // Returns the result through |callback|. virtual void SendKeyboardInput( const Selector& selector, - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback); // Return the outerHTML of |selector|. @@ -356,19 +357,19 @@ base::OnceCallback<void(const ClientStatus&)> callback); void OnClearFieldForSendKeyboardInput( const Selector& selector, - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback, const ClientStatus& status); void OnClickElementForSendKeyboardInput( - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback, const ClientStatus& click_status); void DispatchKeyboardTextDownEvent( - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, size_t index, base::OnceCallback<void(const ClientStatus&)> callback); void DispatchKeyboardTextUpEvent( - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, size_t index, base::OnceCallback<void(const ClientStatus&)> callback); void OnFindElementForSetAttribute( @@ -381,13 +382,10 @@ std::unique_ptr<runtime::CallFunctionOnResult> result); void OnFindElementForSendKeyboardInput( const Selector& selector, - const std::vector<std::string>& utf8_chars, + const std::vector<UChar32>& codepoints, base::OnceCallback<void(const ClientStatus&)> callback, const ClientStatus& status, std::unique_ptr<FindElementResult> element_result); - void OnPressKeyboard(int key_code, - base::OnceCallback<void(bool)> callback, - std::unique_ptr<runtime::CallFunctionOnResult> result); void OnFindElementForSetFieldValue( const std::string& value, base::OnceCallback<void(const ClientStatus&)> callback, @@ -413,12 +411,12 @@ std::unique_ptr<runtime::CallFunctionOnResult> result); // Creates a new instance of DispatchKeyEventParams for the specified type and - // text. + // unicode codepoint. using DispatchKeyEventParamsPtr = std::unique_ptr<autofill_assistant::input::DispatchKeyEventParams>; - static DispatchKeyEventParamsPtr CreateKeyEventParamsFromText( + static DispatchKeyEventParamsPtr CreateKeyEventParamsForCharacter( autofill_assistant::input::DispatchKeyEventType type, - const std::string& text); + const UChar32 codepoint); void OnSetCookie(base::OnceCallback<void(bool)> callback, std::unique_ptr<network::SetCookieResult> result);
diff --git a/components/autofill_assistant/browser/web_controller_browsertest.cc b/components/autofill_assistant/browser/web_controller_browsertest.cc index b447f275..4fe3ff8 100644 --- a/components/autofill_assistant/browser/web_controller_browsertest.cc +++ b/components/autofill_assistant/browser/web_controller_browsertest.cc
@@ -5,6 +5,7 @@ #include "base/bind.h" #include "base/memory/ref_counted.h" #include "components/autofill_assistant/browser/service.pb.h" +#include "components/autofill_assistant/browser/string_conversions_util.h" #include "components/autofill_assistant/browser/web_controller.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test_utils.h" @@ -365,11 +366,11 @@ } ClientStatus SendKeyboardInput(const Selector& selector, - const std::vector<std::string>& text_parts) { + const std::vector<UChar32>& codepoints) { base::RunLoop run_loop; ClientStatus result; web_controller_->SendKeyboardInput( - selector, text_parts, + selector, codepoints, base::BindOnce(&WebControllerBrowserTest::OnSendKeyboardInput, base::Unretained(this), run_loop.QuitClosure(), &result)); @@ -821,17 +822,30 @@ } IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, SendKeyboardInput) { - std::vector<std::string> text_parts = { - "Z", /* ü */ "\xc3\xbc", "r", "i", "c", "h", "\r"}; - std::vector<std::string> expected_values = {"Z\xc3\xbcrich"}; + auto input = UTF8ToUnicode("Zürich"); + std::string expected_output = "Zürich"; std::vector<Selector> selectors; Selector a_selector; a_selector.selectors.emplace_back("#input6"); selectors.emplace_back(a_selector); EXPECT_EQ(ACTION_APPLIED, - SendKeyboardInput(a_selector, text_parts).proto_status()); - GetFieldsValue(selectors, expected_values); + SendKeyboardInput(a_selector, input).proto_status()); + GetFieldsValue(selectors, {expected_output}); +} + +IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, + SendKeyboardInputSetsKeyProperty) { + auto input = UTF8ToUnicode("Zürich\r"); + std::string expected_output = "ZürichEnter"; + + std::vector<Selector> selectors; + Selector a_selector; + a_selector.selectors.emplace_back("#input_js_event_listener"); + selectors.emplace_back(a_selector); + EXPECT_EQ(ACTION_APPLIED, + SendKeyboardInput(a_selector, input).proto_status()); + GetFieldsValue(selectors, {expected_output}); } IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, SetAttribute) {
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUma.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUma.java index abc46e6c..ddc9160c 100644 --- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUma.java +++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUma.java
@@ -38,8 +38,9 @@ static final int BACKGROUND_TASK_DOWNLOAD_AUTO_RESUMPTION = 18; static final int BACKGROUND_TASK_ONE_SHOT_SYNC_WAKE_UP = 19; static final int BACKGROUND_TASK_NOTIFICATION_SCHEDULER = 20; + static final int BACKGROUND_TASK_NOTIFICATION_TRIGGER = 21; // Keep this one at the end and increment appropriately when adding new tasks. - static final int BACKGROUND_TASK_COUNT = 21; + static final int BACKGROUND_TASK_COUNT = 22; static final String KEY_CACHED_UMA = "bts_cached_uma"; @@ -285,6 +286,8 @@ return BACKGROUND_TASK_ONE_SHOT_SYNC_WAKE_UP; case TaskIds.NOTIFICATION_SCHEDULER_JOB_ID: return BACKGROUND_TASK_NOTIFICATION_SCHEDULER; + case TaskIds.NOTIFICATION_TRIGGER_JOB_ID: + return BACKGROUND_TASK_NOTIFICATION_TRIGGER; default: assert false; }
diff --git a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskIds.java b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskIds.java index 9e6f4b4..fa0b485 100644 --- a/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskIds.java +++ b/components/background_task_scheduler/android/java/src/org/chromium/components/background_task_scheduler/TaskIds.java
@@ -33,6 +33,7 @@ public static final int EXPLORE_SITES_REFRESH_JOB_ID = 101; public static final int BACKGROUND_SYNC_ONE_SHOT_JOB_ID = 102; public static final int NOTIFICATION_SCHEDULER_JOB_ID = 103; + public static final int NOTIFICATION_TRIGGER_JOB_ID = 104; private TaskIds() {} }
diff --git a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUmaTest.java b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUmaTest.java index 1023e938..e22aba4 100644 --- a/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUmaTest.java +++ b/components/background_task_scheduler/android/junit/src/org/chromium/components/background_task_scheduler/BackgroundTaskSchedulerUmaTest.java
@@ -102,7 +102,10 @@ assertEquals(BackgroundTaskSchedulerUma.BACKGROUND_TASK_NOTIFICATION_SCHEDULER, BackgroundTaskSchedulerUma.toUmaEnumValueFromTaskId( TaskIds.NOTIFICATION_SCHEDULER_JOB_ID)); - assertEquals(BackgroundTaskSchedulerUma.BACKGROUND_TASK_COUNT, 21); + assertEquals(BackgroundTaskSchedulerUma.BACKGROUND_TASK_NOTIFICATION_TRIGGER, + BackgroundTaskSchedulerUma.toUmaEnumValueFromTaskId( + TaskIds.NOTIFICATION_TRIGGER_JOB_ID)); + assertEquals(BackgroundTaskSchedulerUma.BACKGROUND_TASK_COUNT, 22); } @Test
diff --git a/components/browser_sync/BUILD.gn b/components/browser_sync/BUILD.gn index 69e3f455..afeab29 100644 --- a/components/browser_sync/BUILD.gn +++ b/components/browser_sync/BUILD.gn
@@ -102,8 +102,6 @@ "profile_sync_test_util.h", "test_http_bridge_factory.cc", "test_http_bridge_factory.h", - "test_profile_sync_service.cc", - "test_profile_sync_service.h", ] deps = [
diff --git a/components/browser_sync/abstract_profile_sync_service_test.cc b/components/browser_sync/abstract_profile_sync_service_test.cc index 2b67e98..b63af75 100644 --- a/components/browser_sync/abstract_profile_sync_service_test.cc +++ b/components/browser_sync/abstract_profile_sync_service_test.cc
@@ -13,9 +13,9 @@ #include "base/run_loop.h" #include "base/threading/sequenced_task_runner_handle.h" #include "components/browser_sync/test_http_bridge_factory.h" -#include "components/browser_sync/test_profile_sync_service.h" #include "components/sync/driver/glue/sync_backend_host_core.h" #include "components/sync/driver/sync_api_component_factory_mock.h" +#include "components/sync/driver/test_profile_sync_service.h" #include "components/sync/engine/sync_manager_factory_for_profile_sync_test.h" #include "components/sync/engine/test_engine_components_factory.h" #include "components/sync/protocol/sync.pb.h" @@ -134,7 +134,7 @@ profile_sync_service_bundle_.CreateBasicInitParams( ProfileSyncService::AUTO_START, std::move(sync_client)); sync_service_ = - std::make_unique<TestProfileSyncService>(std::move(init_params)); + std::make_unique<syncer::TestProfileSyncService>(std::move(init_params)); syncer::SyncApiComponentFactoryMock* components = profile_sync_service_bundle_.component_factory();
diff --git a/components/browser_sync/abstract_profile_sync_service_test.h b/components/browser_sync/abstract_profile_sync_service_test.h index 1f2f33d2..95d9d84 100644 --- a/components/browser_sync/abstract_profile_sync_service_test.h +++ b/components/browser_sync/abstract_profile_sync_service_test.h
@@ -16,9 +16,11 @@ #include "components/sync/syncable/change_record.h" #include "testing/gtest/include/gtest/gtest.h" -namespace browser_sync { - +namespace syncer { class TestProfileSyncService; +} // namespace syncer + +namespace browser_sync { class AbstractProfileSyncServiceTest : public testing::Test { public: @@ -38,7 +40,7 @@ base::Thread* data_type_thread() { return &data_type_thread_; } - TestProfileSyncService* sync_service() { return sync_service_.get(); } + syncer::TestProfileSyncService* sync_service() { return sync_service_.get(); } ProfileSyncServiceBundle* profile_sync_service_bundle() { return &profile_sync_service_bundle_; @@ -50,7 +52,7 @@ base::test::ScopedTaskEnvironment scoped_task_environment_; ProfileSyncServiceBundle profile_sync_service_bundle_; - std::unique_ptr<TestProfileSyncService> sync_service_; + std::unique_ptr<syncer::TestProfileSyncService> sync_service_; base::ScopedTempDir temp_dir_; // To pass to the backend host.
diff --git a/components/browser_sync/browser_sync_switches.h b/components/browser_sync/browser_sync_switches.h index 5395fce..1163cb7d 100644 --- a/components/browser_sync/browser_sync_switches.h +++ b/components/browser_sync/browser_sync_switches.h
@@ -5,10 +5,6 @@ #ifndef COMPONENTS_BROWSER_SYNC_BROWSER_SYNC_SWITCHES_H_ #define COMPONENTS_BROWSER_SYNC_BROWSER_SYNC_SWITCHES_H_ -// TODO(crbug.com/896303): Have clients that need it include this directly, and -// get rid of this temporary redirect. -#include "components/sync/driver/sync_driver_switches.h" - namespace switches { extern const char kDisableSyncTypes[];
diff --git a/components/browser_sync/profile_sync_components_factory_impl.cc b/components/browser_sync/profile_sync_components_factory_impl.cc index 22dd94b..53961dc 100644 --- a/components/browser_sync/profile_sync_components_factory_impl.cc +++ b/components/browser_sync/profile_sync_components_factory_impl.cc
@@ -9,7 +9,6 @@ #include "base/bind.h" #include "base/feature_list.h" #include "base/memory/ref_counted.h" -#include "base/single_thread_task_runner.h" #include "build/build_config.h" #include "components/autofill/core/browser/payments/autofill_wallet_data_type_controller.h" #include "components/autofill/core/browser/payments/autofill_wallet_model_type_controller.h" @@ -21,8 +20,6 @@ #include "components/autofill/core/browser/webdata/autofill_wallet_sync_bridge.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/browser_sync/browser_sync_client.h" -#include "components/browser_sync/browser_sync_switches.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/history/core/browser/sync/history_delete_directives_data_type_controller.h" #include "components/history/core/browser/sync/history_delete_directives_model_type_controller.h" #include "components/history/core/browser/sync/typed_url_model_type_controller.h"
diff --git a/components/browser_sync/profile_sync_service.h b/components/browser_sync/profile_sync_service.h index aeb5ff3..9a85435 100644 --- a/components/browser_sync/profile_sync_service.h +++ b/components/browser_sync/profile_sync_service.h
@@ -5,8 +5,14 @@ #ifndef COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ #define COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ -// TODO(crbug.com/896303): Have clients use the sync/driver version directly and -// then get rid of this header. #include "components/sync/driver/profile_sync_service.h" +namespace browser_sync { + +// TODO(crbug.com/896303): Have clients use syncer::ProfileSyncService directly +// and then get rid of this header. +using ProfileSyncService = syncer::ProfileSyncService; + +} // namespace browser_sync + #endif // COMPONENTS_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_
diff --git a/components/browser_sync/profile_sync_service_autofill_unittest.cc b/components/browser_sync/profile_sync_service_autofill_unittest.cc index 1656330b..6be702f 100644 --- a/components/browser_sync/profile_sync_service_autofill_unittest.cc +++ b/components/browser_sync/profile_sync_service_autofill_unittest.cc
@@ -38,12 +38,12 @@ #include "components/autofill/core/common/autofill_prefs.h" #include "components/browser_sync/abstract_profile_sync_service_test.h" #include "components/browser_sync/profile_sync_service.h" -#include "components/browser_sync/test_profile_sync_service.h" #include "components/sync/base/model_type.h" #include "components/sync/driver/data_type_controller.h" #include "components/sync/driver/data_type_manager_impl.h" #include "components/sync/driver/sync_api_component_factory_mock.h" #include "components/sync/driver/sync_client_mock.h" +#include "components/sync/driver/test_profile_sync_service.h" #include "components/sync/engine/data_type_debug_info_listener.h" #include "components/sync/engine/sequenced_model_worker.h" #include "components/sync/protocol/autofill_specifics.pb.h"
diff --git a/components/browser_sync/profile_sync_service_unittest.cc b/components/browser_sync/profile_sync_service_unittest.cc index 15d069df..8557938 100644 --- a/components/browser_sync/profile_sync_service_unittest.cc +++ b/components/browser_sync/profile_sync_service_unittest.cc
@@ -4,6 +4,8 @@ #include "components/browser_sync/profile_sync_service.h" +#include <memory> +#include <string> #include <utility> #include "base/bind.h" @@ -14,7 +16,6 @@ #include "base/test/scoped_feature_list.h" #include "base/test/scoped_task_environment.h" #include "base/values.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/browser_sync/profile_sync_test_util.h" #include "components/signin/core/browser/account_info.h" #include "components/sync/base/pref_names.h"
diff --git a/components/bubble/bubble_manager.cc b/components/bubble/bubble_manager.cc index e00a01b1..1baa0a1 100644 --- a/components/bubble/bubble_manager.cc +++ b/components/bubble/bubble_manager.cc
@@ -31,6 +31,8 @@ case SHOW_BUBBLES: controller->Show(); controllers_.push_back(std::move(controller)); + for (auto& observer : observers_) + observer.OnBubbleShown(bubble_ref); break; case NO_MORE_BUBBLES: for (auto& observer : observers_)
diff --git a/components/bubble/bubble_manager.h b/components/bubble/bubble_manager.h index d306507..d2cda88 100644 --- a/components/bubble/bubble_manager.h +++ b/components/bubble/bubble_manager.h
@@ -42,6 +42,9 @@ virtual void OnBubbleClosed(BubbleReference bubble, BubbleCloseReason reason) = 0; + // Called when a bubble is shown. + virtual void OnBubbleShown(BubbleReference bubble) = 0; + private: DISALLOW_COPY_AND_ASSIGN(BubbleManagerObserver); };
diff --git a/components/bubble/bubble_manager_unittest.cc b/components/bubble/bubble_manager_unittest.cc index 0edc678..a6682434b 100644 --- a/components/bubble/bubble_manager_unittest.cc +++ b/components/bubble/bubble_manager_unittest.cc
@@ -79,6 +79,7 @@ MOCK_METHOD1(OnBubbleNeverShown, void(BubbleReference)); MOCK_METHOD2(OnBubbleClosed, void(BubbleReference, BubbleCloseReason)); + MOCK_METHOD1(OnBubbleShown, void(BubbleReference)); private: DISALLOW_COPY_AND_ASSIGN(MockBubbleManagerObserver); @@ -375,6 +376,19 @@ manager_.reset(); } +TEST_F(BubbleManagerTest, OnBubbleShownIsCalled) { + MockBubbleManagerObserver metrics; + EXPECT_CALL(metrics, OnBubbleNeverShown(testing::_)).Times(0); + EXPECT_CALL(metrics, OnBubbleShown(testing::_)); + manager_->AddBubbleManagerObserver(&metrics); + + BubbleReference ref = manager_->ShowBubble(MockBubbleDelegate::Default()); + ref->CloseBubble(BUBBLE_CLOSE_ACCEPTED); + + // Destroy to verify no events are sent to |metrics| in destructor. + manager_.reset(); +} + // In a close chain, it should be possible for the bubble in the second close // event to close. TEST_F(BubbleManagerTest, BubbleCloseChainCloseClose) {
diff --git a/components/content_settings/core/browser/BUILD.gn b/components/content_settings/core/browser/BUILD.gn index 1edbe265..bfabd79 100644 --- a/components/content_settings/core/browser/BUILD.gn +++ b/components/content_settings/core/browser/BUILD.gn
@@ -99,6 +99,7 @@ "//components/prefs:test_support", "//components/sync_preferences:test_support", "//extensions/buildflags", + "//ppapi/buildflags:buildflags", "//testing/gmock", "//testing/gtest", "//url",
diff --git a/components/content_settings/core/browser/DEPS b/components/content_settings/core/browser/DEPS index 747e920..952dd9c 100644 --- a/components/content_settings/core/browser/DEPS +++ b/components/content_settings/core/browser/DEPS
@@ -9,5 +9,6 @@ "+media/base/android", "+net/base", "+net/cookies", + "+ppapi/buildflags", "+services/preferences/public", ]
diff --git a/components/content_settings/core/browser/content_settings_pref.cc b/components/content_settings/core/browser/content_settings_pref.cc index 4e8ef3a..4f46fab 100644 --- a/components/content_settings/core/browser/content_settings_pref.cc +++ b/components/content_settings/core/browser/content_settings_pref.cc
@@ -86,7 +86,8 @@ pref_name_(pref_name), is_incognito_(incognito), updating_preferences_(false), - notify_callback_(notify_callback) { + notify_callback_(notify_callback), + allow_resource_identifiers_(false) { DCHECK(prefs_); ReadContentSettingsFromPref(); @@ -102,6 +103,11 @@ std::unique_ptr<RuleIterator> ContentSettingsPref::GetRuleIterator( const ResourceIdentifier& resource_identifier, bool incognito) const { + // Resource Identifiers have been supported by the API but never used by any + // users of the API. + // TODO(crbug.com/754178): remove |resource_identifier| from the API. + DCHECK(resource_identifier.empty() || allow_resource_identifiers_); + if (incognito) return incognito_value_map_.GetRuleIterator(content_type_, resource_identifier, @@ -120,7 +126,12 @@ DCHECK(prefs_); DCHECK(primary_pattern != ContentSettingsPattern::Wildcard() || secondary_pattern != ContentSettingsPattern::Wildcard() || - !resource_identifier.empty()); + (!resource_identifier.empty() && allow_resource_identifiers_)); + + // Resource Identifiers have been supported by the API but never used by any + // users of the API. + // TODO(crbug.com/754178): remove |resource_identifier| from the API. + DCHECK(resource_identifier.empty() || allow_resource_identifiers_); // At this point take the ownership of the |in_value|. std::unique_ptr<base::Value> value(in_value); @@ -277,8 +288,8 @@ if (SupportsResourceIdentifiers(content_type_)) { const base::DictionaryValue* resource_dictionary = nullptr; - if (settings_dictionary->GetDictionary( - kPerResourceIdentifierPrefName, &resource_dictionary)) { + if (settings_dictionary->GetDictionary(kPerResourceIdentifierPrefName, + &resource_dictionary)) { base::Time last_modified = GetTimeStamp(settings_dictionary); for (base::DictionaryValue::Iterator j(*resource_dictionary); !j.IsAtEnd();
diff --git a/components/content_settings/core/browser/content_settings_pref.h b/components/content_settings/core/browser/content_settings_pref.h index 080ecc13..c38ea45 100644 --- a/components/content_settings/core/browser/content_settings_pref.h +++ b/components/content_settings/core/browser/content_settings_pref.h
@@ -68,6 +68,12 @@ // Tries to lock |lock_|. If successful, returns true and releases the lock. bool TryLockForTesting() const; + void set_allow_resource_identifiers_for_testing() { + allow_resource_identifiers_ = true; + } + void reset_allow_resource_identifiers_for_testing() { + allow_resource_identifiers_ = false; + } private: // Reads all content settings exceptions from the preference and loads them @@ -121,6 +127,10 @@ base::ThreadChecker thread_checker_; + // Used for setting preferences with resource identifiers to simmulate legacy + // prefs that did have resource identifiers set. + bool allow_resource_identifiers_; + DISALLOW_COPY_AND_ASSIGN(ContentSettingsPref); };
diff --git a/components/content_settings/core/browser/content_settings_pref_unittest.cc b/components/content_settings/core/browser/content_settings_pref_unittest.cc index 652a041e..488403c 100644 --- a/components/content_settings/core/browser/content_settings_pref_unittest.cc +++ b/components/content_settings/core/browser/content_settings_pref_unittest.cc
@@ -3,18 +3,26 @@ // found in the LICENSE file. #include "components/content_settings/core/browser/content_settings_pref.h" -#include "components/content_settings/core/common/content_settings_pattern.h" + +#include <memory> +#include <utility> #include "base/bind_helpers.h" #include "base/stl_util.h" +#include "base/test/gtest_util.h" #include "base/values.h" #include "components/content_settings/core/browser/content_settings_utils.h" +#include "components/content_settings/core/common/content_settings_pattern.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "components/content_settings/core/common/content_settings_utils.h" +#include "components/content_settings/core/test/content_settings_test_utils.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/testing_pref_service.h" +#include "ppapi/buildflags/buildflags.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" namespace content_settings { namespace { @@ -33,6 +41,49 @@ constexpr char kSettingKey[] = "setting"; constexpr char kTagKey[] = "tag"; +#if BUILDFLAG(ENABLE_PLUGINS) +constexpr char kPluginsContentSettingPrefName[] = "content_settings.plugins"; +constexpr char kPerResourceTag[] = "per_resource"; + +// Tests that a particular pref has the expected values with and without a +// resource id +void LegacyPersistedPluginTests( + ContentSettingsPref* content_settings_pref, + const std::string& pattern, + const GURL& host, + const std::string& resource, + ContentSetting no_resource_id_perf_expected_value, + ContentSetting with_resource_id_perf_expected_value) { + auto pattern_pair = ParsePatternString(pattern); + // Retrieving the pref without a resource id for pattern works and + // its value is the expected one. + EXPECT_EQ(no_resource_id_perf_expected_value, + content_settings::ValueToContentSetting( + content_settings::TestUtils::GetContentSettingValueAndPatterns( + content_settings_pref->GetRuleIterator("", false).get(), + host, GURL(), &(pattern_pair.first), &(pattern_pair.second)) + .get())); + + // Retrieving the pref with a resource id will throw. + EXPECT_DCHECK_DEATH( + content_settings_pref->GetRuleIterator(resource, false)->HasNext()); + + // Allow resource ids for testing in order to test that the perf was correctly + // loaded from the json. This basically verifies that we did build a correct + // json and it was parsed and loaded without any issues. + content_settings_pref->set_allow_resource_identifiers_for_testing(); + EXPECT_EQ( + with_resource_id_perf_expected_value, + content_settings::ValueToContentSetting( + content_settings::TestUtils::GetContentSettingValueAndPatterns( + content_settings_pref->GetRuleIterator(resource, false).get(), + host, GURL(), &(pattern_pair.first), &(pattern_pair.second)) + .get())); + content_settings_pref->reset_allow_resource_identifiers_for_testing(); +} + +#endif // BUILDFLAG(ENABLE_PLUGINS) + // Creates a JSON dictionary representing a dummy content setting exception // value in preferences. The setting will be marked with the |tag| like so: // @@ -150,4 +201,80 @@ testing::UnorderedElementsAreArray(kExpectedPatternsToTags)); } +#if BUILDFLAG(ENABLE_PLUGINS) +// Test that a legagcy persisted plugin setting does not cause errors and has +// a sane behaviour. +TEST(ContentSettingsPref, LegacyPersistedPluginSetting) { + const GURL kHost1("http://example.com/"); + const GURL kHost2("http://other-example.com/"); + constexpr char kPattern1[] = "http://example.com,*"; + constexpr char kPattern2[] = "http://other-example.com,*"; + constexpr char kResource[] = "someplugin"; + + TestingPrefServiceSimple prefs; + prefs.registry()->RegisterDictionaryPref(kPluginsContentSettingPrefName); + + // Build a json simulating some pre-existing plugin settings situation where + // a mix of per_resource and regular settings are present: + // "content_settings.plugins": { + // kPattern1: { + // "setting": 1, <-- CONTENT_SETTING_ALLOW + // "per_resource": { + // "someplugin": 2 <-- CONTENT_SETTING_BLOCK + // } + // } + // kPattern2: { + // "per_resource": { + // "someplugin": 1 <-- CONTENT_SETTING_ALLOW + // } + // } + // } + + auto original_pref_value = std::make_unique<base::DictionaryValue>(); + + base::Value per_resource_value1(base::Value::Type::DICTIONARY); + per_resource_value1.SetKey(kResource, base::Value(CONTENT_SETTING_BLOCK)); + + base::Value pref_value1(base::Value::Type::DICTIONARY); + pref_value1.SetKey(kLastModifiedKey, base::Value("13189876543210000")); + pref_value1.SetKey(kSettingKey, base::Value(CONTENT_SETTING_ALLOW)); + pref_value1.SetKey(kPerResourceTag, std::move(per_resource_value1)); + + original_pref_value->SetKey(kPattern1, std::move(pref_value1)); + + base::Value per_resource_value2(base::Value::Type::DICTIONARY); + per_resource_value2.SetKey(kResource, base::Value(CONTENT_SETTING_ALLOW)); + + base::Value pref_value2(base::Value::Type::DICTIONARY); + pref_value2.SetKey(kLastModifiedKey, base::Value("13189876543210000")); + pref_value2.SetKey(kPerResourceTag, std::move(per_resource_value2)); + + original_pref_value->SetKey(kPattern2, std::move(pref_value2)); + + prefs.SetUserPref(kPluginsContentSettingPrefName, + std::move(original_pref_value)); + + PrefChangeRegistrar registrar; + registrar.Init(&prefs); + ContentSettingsPref content_settings_pref( + CONTENT_SETTINGS_TYPE_PLUGINS, &prefs, ®istrar, + kPluginsContentSettingPrefName, false, base::DoNothing()); + + // For kPattern1 retrieving the setting without a resource id returns the + // CONTENT_SETTING_ALLOW value and retrieving it with the resource id (after + // allowing resource ids for testing) returns CONTENT_SETTING_BLOCK. + LegacyPersistedPluginTests(&content_settings_pref, kPattern1, kHost1, + kResource, CONTENT_SETTING_ALLOW, + CONTENT_SETTING_BLOCK); + + // For kPattern2 retrieving the setting without a resource id returns the + // CONTENT_SETTING_DEFAULT value since it was not set in the first place and + // retrieving it with the resource id (after allowing resource ids for + // testing) returns CONTENT_SETTING_ALLOW. + LegacyPersistedPluginTests(&content_settings_pref, kPattern2, kHost2, + kResource, CONTENT_SETTING_DEFAULT, + CONTENT_SETTING_ALLOW); +} +#endif // BUILDFLAG(ENABLE_PLUGINS) + } // namespace content_settings
diff --git a/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMMessage.java b/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMMessage.java index 0284205..80fc264c 100644 --- a/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMMessage.java +++ b/components/gcm_driver/android/java/src/org/chromium/components/gcm_driver/GCMMessage.java
@@ -200,6 +200,10 @@ } public @Priority int getOriginalPriority() { + if (mOriginalPriority == null) { + return Priority.NONE; + } + switch (mOriginalPriority) { case "normal": return Priority.NORMAL;
diff --git a/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java b/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java index e582983..806b25f 100644 --- a/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java +++ b/components/gcm_driver/android/junit/src/org/chromium/components/gcm_driver/GCMMessageTest.java
@@ -254,4 +254,18 @@ assertArrayEquals(rawData, copiedMessage.getRawData()); } } + + /** + * Tests that getOriginalPriority returns Priority.NONE if it was not set in the bundle. + */ + @Test + public void testNullOriginalPriority() throws JSONException { + Bundle extras = new Bundle(); + + // Compose a simple message that lacks all optional fields. + extras.putString("subtype", "MyAppId"); + GCMMessage message = new GCMMessage("MySenderId", extras); + + assertEquals(GCMMessage.Priority.NONE, message.getOriginalPriority()); + } }
diff --git a/components/history/core/browser/history_service.cc b/components/history/core/browser/history_service.cc index b057bbd..9bcaa45 100644 --- a/components/history/core/browser/history_service.cc +++ b/components/history/core/browser/history_service.cc
@@ -1173,6 +1173,7 @@ void HistoryService::OnDBLoaded() { DCHECK(thread_checker_.CalledOnValidThread()); backend_loaded_ = true; + delete_directive_handler_->OnBackendLoaded(); NotifyHistoryServiceLoaded(); }
diff --git a/components/history/core/browser/sync/delete_directive_handler.cc b/components/history/core/browser/sync/delete_directive_handler.cc index c3032bf4..bf5efcbf 100644 --- a/components/history/core/browser/sync/delete_directive_handler.cc +++ b/components/history/core/browser/sync/delete_directive_handler.cc
@@ -342,6 +342,12 @@ DeleteDirectiveHandler::~DeleteDirectiveHandler() {} +void DeleteDirectiveHandler::OnBackendLoaded() { + backend_loaded_ = true; + if (wait_until_ready_to_sync_cb_) + std::move(wait_until_ready_to_sync_cb_).Run(); +} + bool DeleteDirectiveHandler::CreateDeleteDirectives( const std::set<int64_t>& global_ids, base::Time begin_time, @@ -416,6 +422,16 @@ return sync_processor_->ProcessSyncChanges(FROM_HERE, changes); } +void DeleteDirectiveHandler::WaitUntilReadyToSync(base::OnceClosure done) { + DCHECK(!wait_until_ready_to_sync_cb_); + if (backend_loaded_) { + std::move(done).Run(); + } else { + // Wait until OnBackendLoaded() gets called. + wait_until_ready_to_sync_cb_ = std::move(done); + } +} + syncer::SyncMergeResult DeleteDirectiveHandler::MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data,
diff --git a/components/history/core/browser/sync/delete_directive_handler.h b/components/history/core/browser/sync/delete_directive_handler.h index e48a91a..5749d57 100644 --- a/components/history/core/browser/sync/delete_directive_handler.h +++ b/components/history/core/browser/sync/delete_directive_handler.h
@@ -43,6 +43,10 @@ explicit DeleteDirectiveHandler(BackendTaskScheduler backend_task_scheduler); ~DeleteDirectiveHandler() override; + // Notifies that HistoryBackend has been fully loaded and hence is ready to + // handle sync events. + void OnBackendLoaded(); + // Create delete directives for the deletion of visits identified by // |global_ids| (which may be empty), in the time range specified by // |begin_time| and |end_time|. @@ -62,6 +66,7 @@ const sync_pb::HistoryDeleteDirectiveSpecifics& delete_directive); // syncer::SyncableService implementation. + void WaitUntilReadyToSync(base::OnceClosure done) override; syncer::SyncMergeResult MergeDataAndStartSyncing( syncer::ModelType type, const syncer::SyncDataList& initial_sync_data, @@ -86,6 +91,8 @@ const syncer::SyncDataList& delete_directives); const BackendTaskScheduler backend_task_scheduler_; + bool backend_loaded_ = false; + base::OnceClosure wait_until_ready_to_sync_cb_; base::CancelableTaskTracker internal_tracker_; std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; base::ThreadChecker thread_checker_;
diff --git a/components/history/core/browser/sync/delete_directive_handler_unittest.cc b/components/history/core/browser/sync/delete_directive_handler_unittest.cc index 8748efd..53fe8d79 100644 --- a/components/history/core/browser/sync/delete_directive_handler_unittest.cc +++ b/components/history/core/browser/sync/delete_directive_handler_unittest.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/files/scoped_temp_dir.h" +#include "base/test/mock_callback.h" #include "base/test/scoped_task_environment.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" @@ -21,6 +22,7 @@ #include "components/sync/model/fake_sync_change_processor.h" #include "components/sync/model/sync_change_processor_wrapper_for_test.h" #include "components/sync/model/sync_error_factory.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace history { @@ -130,6 +132,25 @@ DISALLOW_COPY_AND_ASSIGN(HistoryDeleteDirectiveHandlerTest); }; +// Tests calling WaitUntilReadyToSync() after the backend has already been +// loaded, which should report completion immediately. +TEST_F(HistoryDeleteDirectiveHandlerTest, SyncAlreadyReadyToSync) { + base::MockCallback<base::OnceClosure> ready_cb; + handler()->OnBackendLoaded(); + EXPECT_CALL(ready_cb, Run()); + handler()->WaitUntilReadyToSync(ready_cb.Get()); +} + +// Tests calling WaitUntilReadyToSync() befire the backend has been loaded, +// which should only report completion after the backend loading is completed. +TEST_F(HistoryDeleteDirectiveHandlerTest, WaitUntilReadyToSync) { + base::MockCallback<base::OnceClosure> ready_cb; + EXPECT_CALL(ready_cb, Run()).Times(0); + handler()->WaitUntilReadyToSync(ready_cb.Get()); + EXPECT_CALL(ready_cb, Run()); + handler()->OnBackendLoaded(); +} + // Create a local delete directive and process it while sync is // online, and then when offline. The delete directive should be sent to sync, // no error should be returned for the first time, and an error should be
diff --git a/components/nacl/browser/nacl_browser.cc b/components/nacl/browser/nacl_browser.cc index de06e59..90f348a 100644 --- a/components/nacl/browser/nacl_browser.cc +++ b/components/nacl/browser/nacl_browser.cc
@@ -5,6 +5,7 @@ #include "components/nacl/browser/nacl_browser.h" #include <stddef.h> +#include <utility> #include "base/command_line.h" #include "base/files/file_proxy.h" @@ -98,10 +99,10 @@ pickle->size()); } -void RemoveCache(const base::FilePath& filename, - const base::Closure& callback) { +void RemoveCache(const base::FilePath& filename, base::OnceClosure callback) { base::DeleteFile(filename, false); - base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, callback); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + std::move(callback)); } void LogCacheQuery(nacl::NaClBrowser::ValidationCacheStatus status) { @@ -419,7 +420,8 @@ // directly. For example, this could result in use-after-free of the // process host. for (auto iter = waiting_.begin(); iter != waiting_.end(); ++iter) { - base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, *iter); + base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, + std::move(*iter)); } waiting_.clear(); } @@ -431,9 +433,9 @@ CheckWaiting(); } -void NaClBrowser::WaitForResources(const base::Closure& reply) { +void NaClBrowser::WaitForResources(base::OnceClosure reply) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - waiting_.push_back(reply); + waiting_.push_back(std::move(reply)); EnsureAllResourcesAvailable(); CheckWaiting(); } @@ -512,7 +514,7 @@ } } -void NaClBrowser::ClearValidationCache(const base::Closure& callback) { +void NaClBrowser::ClearValidationCache(base::OnceClosure callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); // Note: this method may be called before EnsureValidationCacheAvailable has // been invoked. In other words, this method may be called before any NaCl @@ -524,7 +526,8 @@ if (validation_cache_file_path_.empty()) { // Can't figure out what file to remove, but don't drop the callback. - base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, callback); + base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, + std::move(callback)); } else { // Delegate the removal of the cache from the filesystem to another thread // to avoid blocking the IO thread. @@ -533,8 +536,8 @@ // In addition, we need to make sure the cache is actually cleared before // invoking the callback to meet the implicit guarantees of the UI. file_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(RemoveCache, validation_cache_file_path_, callback)); + FROM_HERE, base::BindOnce(RemoveCache, validation_cache_file_path_, + std::move(callback))); } // Make sure any delayed tasks to persist the cache to the filesystem are
diff --git a/components/nacl/browser/nacl_browser.h b/components/nacl/browser/nacl_browser.h index 4ff6156..85500b0 100644 --- a/components/nacl/browser/nacl_browser.h +++ b/components/nacl/browser/nacl_browser.h
@@ -51,7 +51,7 @@ // Enqueues reply() in the message loop when all the resources needed to start // a process have been acquired. - void WaitForResources(const base::Closure& reply); + void WaitForResources(base::OnceClosure reply); // Asynchronously attempt to get the IRT open. // This is entailed by EnsureInitialized. This method is exposed as part of @@ -121,7 +121,7 @@ bool QueryKnownToValidate(const std::string& signature, bool off_the_record); void SetKnownToValidate(const std::string& signature, bool off_the_record); - void ClearValidationCache(const base::Closure& callback); + void ClearValidationCache(base::OnceClosure callback); #if defined(OS_WIN) // Get path to NaCl loader on the filesystem if possible. // |exe_path| does not change if the method fails. @@ -201,7 +201,7 @@ bool has_failed_; // A list of pending tasks to start NaCl processes. - std::vector<base::Closure> waiting_; + std::vector<base::OnceClosure> waiting_; base::circular_deque<base::Time> crash_times_;
diff --git a/components/nacl/browser/pnacl_host.cc b/components/nacl/browser/pnacl_host.cc index 51e3f22..2b48a1e 100644 --- a/components/nacl/browser/pnacl_host.cc +++ b/components/nacl/browser/pnacl_host.cc
@@ -8,6 +8,7 @@ #include "base/bind.h" #include "base/bind_helpers.h" +#include "base/callback_helpers.h" #include "base/debug/leak_annotations.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -583,7 +584,7 @@ void PnaclHost::ClearTranslationCacheEntriesBetween( base::Time initial_time, base::Time end_time, - const base::Closure& callback) { + base::OnceClosure callback) { DCHECK(thread_checker_.CalledOnValidThread()); if (cache_state_ == CacheUninitialized) { Init(); @@ -594,22 +595,26 @@ FROM_HERE, {BrowserThread::IO}, base::BindOnce(&PnaclHost::ClearTranslationCacheEntriesBetween, base::Unretained(this), initial_time, end_time, - callback), + std::move(callback)), base::TimeDelta::FromMilliseconds( kTranslationCacheInitializationDelayMs)); return; } pending_backend_operations_++; + + base::RepeatingClosure copyable_callback = + base::AdaptCallbackForRepeating(std::move(callback)); int rv = disk_cache_->DoomEntriesBetween( - initial_time, end_time, base::Bind(&PnaclHost::OnEntriesDoomed, - base::Unretained(this), callback)); + initial_time, end_time, + base::BindOnce(&PnaclHost::OnEntriesDoomed, base::Unretained(this), + copyable_callback)); if (rv != net::ERR_IO_PENDING) - OnEntriesDoomed(callback, rv); + OnEntriesDoomed(copyable_callback, rv); } -void PnaclHost::OnEntriesDoomed(const base::Closure& callback, int net_error) { +void PnaclHost::OnEntriesDoomed(base::OnceClosure callback, int net_error) { DCHECK(thread_checker_.CalledOnValidThread()); - base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO}, callback); + base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO}, std::move(callback)); pending_backend_operations_--; // When clearing the cache, the UI is blocked on all the cache-clearing // operations, and freeing the backend actually blocks the IO thread. So
diff --git a/components/nacl/browser/pnacl_host.h b/components/nacl/browser/pnacl_host.h index 405ac80..c64cdf5b 100644 --- a/components/nacl/browser/pnacl_host.h +++ b/components/nacl/browser/pnacl_host.h
@@ -103,7 +103,7 @@ // thread when finished. void ClearTranslationCacheEntriesBetween(base::Time initial_time, base::Time end_time, - const base::Closure& callback); + base::OnceClosure callback); // Return the number of tracked translations or FD requests currently pending. size_t pending_translations() { @@ -175,7 +175,7 @@ std::unique_ptr<base::File> file, int file_error); - void OnEntriesDoomed(const base::Closure& callback, int net_error); + void OnEntriesDoomed(base::OnceClosure callback, int net_error); void DeInitIfSafe();
diff --git a/components/nacl/browser/pnacl_host_unittest.cc b/components/nacl/browser/pnacl_host_unittest.cc index 16d0231..deda082 100644 --- a/components/nacl/browser/pnacl_host_unittest.cc +++ b/components/nacl/browser/pnacl_host_unittest.cc
@@ -427,8 +427,8 @@ EXPECT_EQ(2, GetCacheSize()); net::TestCompletionCallback cb; // Since we are using a memory backend, the clear should happen immediately. - host_->ClearTranslationCacheEntriesBetween( - base::Time(), base::Time(), base::Bind(cb.callback(), 0)); + host_->ClearTranslationCacheEntriesBetween(base::Time(), base::Time(), + base::BindOnce(cb.callback(), 0)); // Check that the translation cache has been cleared before flushing the // queues, because the backend will be freed once it is. EXPECT_EQ(0, GetCacheSize());
diff --git a/components/nacl/browser/pnacl_translation_cache.cc b/components/nacl/browser/pnacl_translation_cache.cc index 017040f..6bb26fb2 100644 --- a/components/nacl/browser/pnacl_translation_cache.cc +++ b/components/nacl/browser/pnacl_translation_cache.cc
@@ -7,6 +7,7 @@ #include <string.h> #include <string> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -55,7 +56,7 @@ base::WeakPtr<PnaclTranslationCache> cache, const std::string& key, net::DrainableIOBuffer* write_nexe, - const CompletionCallback& callback); + CompletionOnceCallback callback); void Start(); @@ -108,7 +109,7 @@ CacheStep step_; bool is_read_; GetNexeCallback read_callback_; - CompletionCallback write_callback_; + CompletionOnceCallback write_callback_; scoped_refptr<net::DrainableIOBuffer> io_buf_; base::ThreadChecker thread_checker_; DISALLOW_COPY_AND_ASSIGN(PnaclTranslationCacheEntry); @@ -130,11 +131,11 @@ base::WeakPtr<PnaclTranslationCache> cache, const std::string& key, net::DrainableIOBuffer* write_nexe, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { PnaclTranslationCacheEntry* entry( new PnaclTranslationCacheEntry(cache, key, false)); entry->io_buf_ = write_nexe; - entry->write_callback_ = callback; + entry->write_callback_ = std::move(callback); return entry; } @@ -160,7 +161,7 @@ if (!write_callback_.is_null()) { base::PostTaskWithTraits( FROM_HERE, {BrowserThread::IO}, - base::BindOnce(write_callback_, net::ERR_ABORTED)); + base::BindOnce(std::move(write_callback_), net::ERR_ABORTED)); } } } @@ -227,7 +228,7 @@ } else { if (!write_callback_.is_null()) { base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO}, - base::BindOnce(write_callback_, rv)); + base::BindOnce(std::move(write_callback_), rv)); } } cache_->OpComplete(this); @@ -328,7 +329,7 @@ int PnaclTranslationCache::Init(net::CacheType cache_type, const base::FilePath& cache_dir, int cache_size, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { int rv = disk_cache::CreateCacheBackend( cache_type, net::CACHE_BACKEND_DEFAULT, cache_dir, cache_size, true /* force_initialize */, NULL, /* dummy net log */ @@ -336,7 +337,7 @@ base::BindOnce(&PnaclTranslationCache::OnCreateBackendComplete, AsWeakPtr())); if (rv == net::ERR_IO_PENDING) { - init_callback_ = callback; + init_callback_ = std::move(callback); } return rv; } @@ -348,7 +349,7 @@ // Invoke our client's callback function. if (!init_callback_.is_null()) { base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO}, - base::BindOnce(init_callback_, rv)); + base::BindOnce(std::move(init_callback_), rv)); } } @@ -357,9 +358,9 @@ void PnaclTranslationCache::StoreNexe(const std::string& key, net::DrainableIOBuffer* nexe_data, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { PnaclTranslationCacheEntry* entry = PnaclTranslationCacheEntry::GetWriteEntry( - AsWeakPtr(), key, nexe_data, callback); + AsWeakPtr(), key, nexe_data, std::move(callback)); open_entries_[entry] = entry; entry->Start(); } @@ -373,14 +374,16 @@ } int PnaclTranslationCache::InitOnDisk(const base::FilePath& cache_directory, - const CompletionCallback& callback) { + CompletionOnceCallback callback) { in_memory_ = false; - return Init(net::PNACL_CACHE, cache_directory, 0 /* auto size */, callback); + return Init(net::PNACL_CACHE, cache_directory, 0 /* auto size */, + std::move(callback)); } -int PnaclTranslationCache::InitInMemory(const CompletionCallback& callback) { +int PnaclTranslationCache::InitInMemory(CompletionOnceCallback callback) { in_memory_ = true; - return Init(net::MEMORY_CACHE, base::FilePath(), kMaxMemCacheSize, callback); + return Init(net::MEMORY_CACHE, base::FilePath(), kMaxMemCacheSize, + std::move(callback)); } int PnaclTranslationCache::Size() { @@ -429,11 +432,10 @@ return retval; } -int PnaclTranslationCache::DoomEntriesBetween( - base::Time initial, - base::Time end, - const CompletionCallback& callback) { - return disk_cache_->DoomEntriesBetween(initial, end, callback); +int PnaclTranslationCache::DoomEntriesBetween(base::Time initial, + base::Time end, + CompletionOnceCallback callback) { + return disk_cache_->DoomEntriesBetween(initial, end, std::move(callback)); } } // namespace pnacl
diff --git a/components/nacl/browser/pnacl_translation_cache.h b/components/nacl/browser/pnacl_translation_cache.h index 13f3f8b..28974e5 100644 --- a/components/nacl/browser/pnacl_translation_cache.h +++ b/components/nacl/browser/pnacl_translation_cache.h
@@ -28,7 +28,7 @@ } namespace pnacl { -typedef base::Callback<void(int)> CompletionCallback; +typedef base::OnceCallback<void(int)> CompletionOnceCallback; typedef base::Callback<void(int, scoped_refptr<net::DrainableIOBuffer>)> GetNexeCallback; class PnaclTranslationCacheEntry; @@ -44,12 +44,12 @@ // net::ERR_IO_PENDING, |callback| will be called with a 0 argument on success // and <0 otherwise. int InitOnDisk(const base::FilePath& cache_dir, - const CompletionCallback& callback); + CompletionOnceCallback callback); // Initialize the translation cache in memory. If the return value is // net::ERR_IO_PENDING, |callback| will be called with a 0 argument on success // and <0 otherwise. - int InitInMemory(const CompletionCallback& callback); + int InitInMemory(CompletionOnceCallback callback); // Store the nexe in the translation cache, and call |callback| with // the result. The result passed to the callback is 0 on success and @@ -57,7 +57,7 @@ // or cancellation. void StoreNexe(const std::string& key, net::DrainableIOBuffer* nexe_data, - const CompletionCallback& callback); + CompletionOnceCallback callback); // Retrieve the nexe from the translation cache. Write the data into |nexe| // and call |callback|, passing a result code (0 on success and <0 otherwise), @@ -73,8 +73,9 @@ // Doom all entries between |initial| and |end|. If the return value is // net::ERR_IO_PENDING, |callback| will be invoked when the operation // completes. - int DoomEntriesBetween(base::Time initial, base::Time end, - const CompletionCallback& callback); + int DoomEntriesBetween(base::Time initial, + base::Time end, + CompletionOnceCallback callback); private: friend class PnaclTranslationCacheEntry; @@ -87,12 +88,12 @@ int Init(net::CacheType, const base::FilePath& directory, int cache_size, - const CompletionCallback& callback); + CompletionOnceCallback callback); void OnCreateBackendComplete(int rv); std::unique_ptr<disk_cache::Backend> disk_cache_; - CompletionCallback init_callback_; + CompletionOnceCallback init_callback_; bool in_memory_; std::map<void*, scoped_refptr<PnaclTranslationCacheEntry> > open_entries_;
diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc index ec510fd..9b69361 100644 --- a/components/omnibox/browser/autocomplete_input.cc +++ b/components/omnibox/browser/autocomplete_input.cc
@@ -207,8 +207,8 @@ // Treat javascript: scheme queries followed by things that are unlikely to // be code as QUERY, rather than script to execute (URL). - if (RE2::FullMatch(base::UTF16ToUTF8(text), "(?i)javascript:([^;=().]*)")) { - return metrics::OmniboxInputType::QUERY; + if (RE2::FullMatch(base::UTF16ToUTF8(text), "(?i)javascript:([^;=().\"]*)")) { + return metrics::OmniboxInputType::UNKNOWN; } // If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it
diff --git a/components/omnibox/browser/autocomplete_input_unittest.cc b/components/omnibox/browser/autocomplete_input_unittest.cc index 5315f56..8bd5b492 100644 --- a/components/omnibox/browser/autocomplete_input_unittest.cc +++ b/components/omnibox/browser/autocomplete_input_unittest.cc
@@ -114,12 +114,14 @@ metrics::OmniboxInputType::URL}, {ASCIIToUTF16("javascript:alert%28\"Hi there\"%29;"), metrics::OmniboxInputType::URL}, + {ASCIIToUTF16("javascript:foo"), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16("javascript:foo;"), metrics::OmniboxInputType::URL}, - {ASCIIToUTF16("javascript:"), metrics::OmniboxInputType::QUERY}, + {ASCIIToUTF16("javascript:\"foo\""), metrics::OmniboxInputType::URL}, + {ASCIIToUTF16("javascript:"), metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16("javascript:the cromulent parts"), - metrics::OmniboxInputType::QUERY}, + metrics::OmniboxInputType::UNKNOWN}, {ASCIIToUTF16("javascript:foo.getter"), metrics::OmniboxInputType::URL}, - {ASCIIToUTF16("JavaScript:Tutorials"), metrics::OmniboxInputType::QUERY}, + {ASCIIToUTF16("JavaScript:Tutorials"), metrics::OmniboxInputType::UNKNOWN}, #if defined(OS_WIN) {ASCIIToUTF16("C:\\Program Files"), metrics::OmniboxInputType::URL}, {ASCIIToUTF16("\\\\Server\\Folder\\File"), metrics::OmniboxInputType::URL},
diff --git a/components/password_manager/core/browser/BUILD.gn b/components/password_manager/core/browser/BUILD.gn index c8e6692..66729db 100644 --- a/components/password_manager/core/browser/BUILD.gn +++ b/components/password_manager/core/browser/BUILD.gn
@@ -165,8 +165,6 @@ "statistics_table.h", "store_metrics_reporter.cc", "store_metrics_reporter.h", - "suppressed_form_fetcher.cc", - "suppressed_form_fetcher.h", "sync/password_data_type_controller.cc", "sync/password_data_type_controller.h", "sync/password_model_type_controller.cc", @@ -467,7 +465,6 @@ "sql_table_builder_unittest.cc", "statistics_table_unittest.cc", "store_metrics_reporter_unittest.cc", - "suppressed_form_fetcher_unittest.cc", "sync/password_sync_bridge_unittest.cc", "sync/password_syncable_service_unittest.cc", "sync_credentials_filter_unittest.cc",
diff --git a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc index fbef010d..8f3e67e 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc
@@ -59,63 +59,66 @@ void AffiliatedMatchHelper::GetAffiliatedAndroidRealms( const PasswordStore::FormDigest& observed_form, - const AffiliatedRealmsCallback& result_callback) { + AffiliatedRealmsCallback result_callback) { if (IsValidWebCredential(observed_form)) { FacetURI facet_uri( FacetURI::FromPotentiallyInvalidSpec(observed_form.signon_realm)); affiliation_service_->GetAffiliationsAndBranding( facet_uri, AffiliationService::StrategyOnCacheMiss::FAIL, - base::Bind(&AffiliatedMatchHelper::CompleteGetAffiliatedAndroidRealms, - weak_ptr_factory_.GetWeakPtr(), facet_uri, result_callback)); + base::BindOnce( + &AffiliatedMatchHelper::CompleteGetAffiliatedAndroidRealms, + weak_ptr_factory_.GetWeakPtr(), facet_uri, + std::move(result_callback))); } else { - result_callback.Run(std::vector<std::string>()); + std::move(result_callback).Run(std::vector<std::string>()); } } void AffiliatedMatchHelper::GetAffiliatedWebRealms( const PasswordStore::FormDigest& android_form, - const AffiliatedRealmsCallback& result_callback) { + AffiliatedRealmsCallback result_callback) { if (IsValidAndroidCredential(android_form)) { affiliation_service_->GetAffiliationsAndBranding( FacetURI::FromPotentiallyInvalidSpec(android_form.signon_realm), AffiliationService::StrategyOnCacheMiss::FETCH_OVER_NETWORK, - base::Bind(&AffiliatedMatchHelper::CompleteGetAffiliatedWebRealms, - weak_ptr_factory_.GetWeakPtr(), result_callback)); + base::BindOnce(&AffiliatedMatchHelper::CompleteGetAffiliatedWebRealms, + weak_ptr_factory_.GetWeakPtr(), + std::move(result_callback))); } else { - result_callback.Run(std::vector<std::string>()); + std::move(result_callback).Run(std::vector<std::string>()); } } void AffiliatedMatchHelper::InjectAffiliationAndBrandingInformation( std::vector<std::unique_ptr<autofill::PasswordForm>> forms, - const PasswordFormsCallback& result_callback) { + PasswordFormsCallback result_callback) { std::vector<autofill::PasswordForm*> android_credentials; for (const auto& form : forms) { if (IsValidAndroidCredential(PasswordStore::FormDigest(*form))) android_credentials.push_back(form.get()); } base::OnceClosure on_get_all_realms( - base::BindOnce(result_callback, std::move(forms))); + base::BindOnce(std::move(result_callback), std::move(forms))); base::RepeatingClosure barrier_closure = base::BarrierClosure( android_credentials.size(), std::move(on_get_all_realms)); for (auto* form : android_credentials) { affiliation_service_->GetAffiliationsAndBranding( FacetURI::FromPotentiallyInvalidSpec(form->signon_realm), AffiliationService::StrategyOnCacheMiss::FAIL, - base::Bind(&AffiliatedMatchHelper:: - CompleteInjectAffiliationAndBrandingInformation, - weak_ptr_factory_.GetWeakPtr(), base::Unretained(form), - barrier_closure)); + base::BindOnce(&AffiliatedMatchHelper:: + CompleteInjectAffiliationAndBrandingInformation, + weak_ptr_factory_.GetWeakPtr(), base::Unretained(form), + barrier_closure)); } } void AffiliatedMatchHelper::CompleteInjectAffiliationAndBrandingInformation( autofill::PasswordForm* form, - base::Closure barrier_closure, + base::OnceClosure barrier_closure, const AffiliatedFacets& results, bool success) { if (!success) { - barrier_closure.Run(); + std::move(barrier_closure).Run(); return; } @@ -143,7 +146,7 @@ if (affiliated_facet != results.end()) form->affiliated_web_realm = affiliated_facet->uri.canonical_spec() + "/"; - barrier_closure.Run(); + std::move(barrier_closure).Run(); } // static @@ -165,13 +168,12 @@ // Must start observing for changes at the same time as when the snapshot is // taken to avoid inconsistencies due to any changes taking place in-between. password_store_->AddObserver(this); - password_store_->GetAutofillableLogins(this); - password_store_->GetBlacklistLogins(this); + password_store_->GetAllLogins(this); } void AffiliatedMatchHelper::CompleteGetAffiliatedAndroidRealms( const FacetURI& original_facet_uri, - const AffiliatedRealmsCallback& result_callback, + AffiliatedRealmsCallback result_callback, const AffiliatedFacets& results, bool success) { std::vector<std::string> affiliated_realms; @@ -184,11 +186,11 @@ "/"); } } - result_callback.Run(affiliated_realms); + std::move(result_callback).Run(affiliated_realms); } void AffiliatedMatchHelper::CompleteGetAffiliatedWebRealms( - const AffiliatedRealmsCallback& result_callback, + AffiliatedRealmsCallback result_callback, const AffiliatedFacets& results, bool success) { std::vector<std::string> affiliated_realms; @@ -200,7 +202,7 @@ "/"); } } - result_callback.Run(affiliated_realms); + std::move(result_callback).Run(affiliated_realms); } void AffiliatedMatchHelper::OnLoginsChanged(
diff --git a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.h b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.h index 7de6380..bc2a940 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.h +++ b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.h
@@ -45,12 +45,11 @@ public: // Callback to returns the list of affiliated signon_realms (as per defined in // autofill::PasswordForm) to the caller. - typedef base::Callback<void(const std::vector<std::string>&)> - AffiliatedRealmsCallback; + using AffiliatedRealmsCallback = + base::OnceCallback<void(const std::vector<std::string>&)>; - typedef base::Callback<void( - std::vector<std::unique_ptr<autofill::PasswordForm>>)> - PasswordFormsCallback; + using PasswordFormsCallback = base::OnceCallback<void( + std::vector<std::unique_ptr<autofill::PasswordForm>>)>; // The |password_store| must outlive |this|. Both arguments must be non-NULL, // except in tests which do not Initialize() the object. @@ -67,7 +66,7 @@ // |result_callback| will be invoked in both cases, on the same thread. virtual void GetAffiliatedAndroidRealms( const PasswordStore::FormDigest& observed_form, - const AffiliatedRealmsCallback& result_callback); + AffiliatedRealmsCallback result_callback); // Retrieves realms of web sites affiliated with the Android application that // |android_form| belongs to and invokes |result_callback| on the same thread; @@ -78,7 +77,7 @@ // happen as affiliation information for those applications are prefetched. virtual void GetAffiliatedWebRealms( const PasswordStore::FormDigest& android_form, - const AffiliatedRealmsCallback& result_callback); + AffiliatedRealmsCallback result_callback); // Retrieves affiliation and branding information about the Android // credentials in |forms|, sets |affiliated_web_realm|, |app_display_name| and @@ -88,7 +87,7 @@ // corresponding form. virtual void InjectAffiliationAndBrandingInformation( std::vector<std::unique_ptr<autofill::PasswordForm>> forms, - const PasswordFormsCallback& result_callback); + PasswordFormsCallback result_callback); // Returns whether or not |form| represents an Android credential. static bool IsValidAndroidCredential(const PasswordStore::FormDigest& form); @@ -115,17 +114,16 @@ // be completed. void CompleteGetAffiliatedAndroidRealms( const FacetURI& original_facet_uri, - const AffiliatedRealmsCallback& result_callback, + AffiliatedRealmsCallback result_callback, const AffiliatedFacets& results, bool success); // Called back by AffiliationService to supply the list of facets affiliated // with the Android application that GetAffiliatedWebRealms() was called with, // so that the call can be completed. - void CompleteGetAffiliatedWebRealms( - const AffiliatedRealmsCallback& result_callback, - const AffiliatedFacets& results, - bool success); + void CompleteGetAffiliatedWebRealms(AffiliatedRealmsCallback result_callback, + const AffiliatedFacets& results, + bool success); // Called back by AffiliationService to supply the list of facets affiliated // with the Android credential in |form|. Injects affiliation and branding @@ -134,7 +132,7 @@ // Invokes |barrier_closure|. void CompleteInjectAffiliationAndBrandingInformation( autofill::PasswordForm* form, - base::Closure barrier_closure, + base::OnceClosure barrier_closure, const AffiliatedFacets& results, bool success);
diff --git a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc index b23f1cd..e873d72 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc
@@ -42,13 +42,12 @@ MOCK_METHOD2(CancelPrefetch, void(const FacetURI&, const base::Time&)); MOCK_METHOD1(TrimCacheForFacetURI, void(const FacetURI&)); - void GetAffiliationsAndBranding( - const FacetURI& facet_uri, - StrategyOnCacheMiss cache_miss_strategy, - const ResultCallback& result_callback) override { + void GetAffiliationsAndBranding(const FacetURI& facet_uri, + StrategyOnCacheMiss cache_miss_strategy, + ResultCallback result_callback) override { AffiliatedFacets affiliation = OnGetAffiliationsAndBrandingCalled(facet_uri, cache_miss_strategy); - result_callback.Run(affiliation, !affiliation.empty()); + std::move(result_callback).Run(affiliation, !affiliation.empty()); } void ExpectCallToGetAffiliationsAndBrandingAndSucceedWithResult(
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc b/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc index fc5b419..97ba033 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc
@@ -66,14 +66,14 @@ void AffiliationBackend::GetAffiliationsAndBranding( const FacetURI& facet_uri, StrategyOnCacheMiss cache_miss_strategy, - const AffiliationService::ResultCallback& callback, + AffiliationService::ResultCallback callback, const scoped_refptr<base::TaskRunner>& callback_task_runner) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); FacetManager* facet_manager = GetOrCreateFacetManager(facet_uri); DCHECK(facet_manager); - facet_manager->GetAffiliationsAndBranding(cache_miss_strategy, callback, - callback_task_runner); + facet_manager->GetAffiliationsAndBranding( + cache_miss_strategy, std::move(callback), callback_task_runner); if (facet_manager->CanBeDiscarded()) facet_managers_.erase(facet_uri);
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend.h b/components/password_manager/core/browser/android_affiliation/affiliation_backend.h index 8010332..6b17152 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend.h +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend.h
@@ -80,7 +80,7 @@ void GetAffiliationsAndBranding( const FacetURI& facet_uri, StrategyOnCacheMiss cache_miss_strategy, - const AffiliationService::ResultCallback& callback, + AffiliationService::ResultCallback callback, const scoped_refptr<base::TaskRunner>& callback_task_runner); void Prefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until); void CancelPrefetch(const FacetURI& facet_uri,
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_service.cc b/components/password_manager/core/browser/android_affiliation/affiliation_service.cc index 7ced815..8c08059 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_service.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_service.cc
@@ -53,14 +53,14 @@ void AffiliationService::GetAffiliationsAndBranding( const FacetURI& facet_uri, StrategyOnCacheMiss cache_miss_strategy, - const ResultCallback& result_callback) { + ResultCallback result_callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(backend_); backend_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&AffiliationBackend::GetAffiliationsAndBranding, - base::Unretained(backend_), facet_uri, cache_miss_strategy, - result_callback, base::SequencedTaskRunnerHandle::Get())); + FROM_HERE, base::BindOnce(&AffiliationBackend::GetAffiliationsAndBranding, + base::Unretained(backend_), facet_uri, + cache_miss_strategy, std::move(result_callback), + base::SequencedTaskRunnerHandle::Get())); } void AffiliationService::Prefetch(const FacetURI& facet_uri,
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_service.h b/components/password_manager/core/browser/android_affiliation/affiliation_service.h index 51592c8..0048850 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_service.h +++ b/components/password_manager/core/browser/android_affiliation/affiliation_service.h
@@ -92,8 +92,9 @@ // }; class AffiliationService : public KeyedService { public: - typedef base::Callback<void(const AffiliatedFacets& /* results */, - bool /* success */)> ResultCallback; + using ResultCallback = + base::OnceCallback<void(const AffiliatedFacets& /* results */, + bool /* success */)>; // Controls whether to send a network request or fail on a cache miss. enum class StrategyOnCacheMiss { FETCH_OVER_NETWORK, FAIL }; @@ -123,7 +124,7 @@ virtual void GetAffiliationsAndBranding( const FacetURI& facet_uri, StrategyOnCacheMiss cache_miss_strategy, - const ResultCallback& result_callback); + ResultCallback result_callback); // Prefetches affiliation information for the facet identified by |facet_uri|, // and keeps the information fresh by periodic re-fetches (as needed) until
diff --git a/components/password_manager/core/browser/android_affiliation/facet_manager.cc b/components/password_manager/core/browser/android_affiliation/facet_manager.cc index 6a76789..a96c029d 100644 --- a/components/password_manager/core/browser/android_affiliation/facet_manager.cc +++ b/components/password_manager/core/browser/android_affiliation/facet_manager.cc
@@ -106,31 +106,31 @@ FacetManager::~FacetManager() { // The manager will be destroyed while there are pending requests only if the // entire backend is going away. Fail pending requests in this case. - for (const auto& request_info : pending_requests_) - ServeRequestWithFailure(request_info); + for (auto& request_info : pending_requests_) + ServeRequestWithFailure(std::move(request_info)); } void FacetManager::GetAffiliationsAndBranding( StrategyOnCacheMiss cache_miss_strategy, - const AffiliationService::ResultCallback& callback, + AffiliationService::ResultCallback callback, const scoped_refptr<base::TaskRunner>& callback_task_runner) { RequestInfo request_info; - request_info.callback = callback; + request_info.callback = std::move(callback); request_info.callback_task_runner = callback_task_runner; if (IsCachedDataFresh()) { AffiliatedFacetsWithUpdateTime affiliation; if (!backend_->ReadAffiliationsAndBrandingFromDatabase(facet_uri_, &affiliation)) { - ServeRequestWithFailure(request_info); + ServeRequestWithFailure(std::move(request_info)); return; } DCHECK_EQ(affiliation.last_update_time, last_update_time_) << facet_uri_; - ServeRequestWithSuccess(request_info, affiliation.facets); + ServeRequestWithSuccess(std::move(request_info), affiliation.facets); } else if (cache_miss_strategy == StrategyOnCacheMiss::FETCH_OVER_NETWORK) { - pending_requests_.push_back(request_info); + pending_requests_.push_back(std::move(request_info)); backend_->SignalNeedNetworkRequest(); } else { - ServeRequestWithFailure(request_info); + ServeRequestWithFailure(std::move(request_info)); } } @@ -162,8 +162,8 @@ const AffiliatedFacetsWithUpdateTime& affiliation) { last_update_time_ = affiliation.last_update_time; DCHECK(IsCachedDataFresh()) << facet_uri_; - for (const auto& request_info : pending_requests_) - ServeRequestWithSuccess(request_info, affiliation.facets); + for (auto& request_info : pending_requests_) + ServeRequestWithSuccess(std::move(request_info), affiliation.facets); pending_requests_.clear(); base::Time next_required_fetch(GetNextRequiredFetchTimeDueToPrefetch()); @@ -236,17 +236,18 @@ // static void FacetManager::ServeRequestWithSuccess( - const RequestInfo& request_info, + RequestInfo request_info, const AffiliatedFacets& affiliation) { request_info.callback_task_runner->PostTask( - FROM_HERE, base::BindOnce(request_info.callback, affiliation, true)); + FROM_HERE, + base::BindOnce(std::move(request_info.callback), affiliation, true)); } // static -void FacetManager::ServeRequestWithFailure(const RequestInfo& request_info) { +void FacetManager::ServeRequestWithFailure(RequestInfo request_info) { request_info.callback_task_runner->PostTask( - FROM_HERE, - base::BindOnce(request_info.callback, AffiliatedFacets(), false)); + FROM_HERE, base::BindOnce(std::move(request_info.callback), + AffiliatedFacets(), false)); } } // namespace password_manager
diff --git a/components/password_manager/core/browser/android_affiliation/facet_manager.h b/components/password_manager/core/browser/android_affiliation/facet_manager.h index ef26ec94..b353e15 100644 --- a/components/password_manager/core/browser/android_affiliation/facet_manager.h +++ b/components/password_manager/core/browser/android_affiliation/facet_manager.h
@@ -41,7 +41,7 @@ // same name. See documentation in affiliation_service.h for details: void GetAffiliationsAndBranding( StrategyOnCacheMiss cache_miss_strategy, - const AffiliationService::ResultCallback& callback, + AffiliationService::ResultCallback callback, const scoped_refptr<base::TaskRunner>& callback_task_runner); void Prefetch(const base::Time& keep_fresh_until); void CancelPrefetch(const base::Time& keep_fresh_until); @@ -100,11 +100,11 @@ base::Time GetNextRequiredFetchTimeDueToPrefetch() const; // Posts the callback of the request described by |request_info| with success. - static void ServeRequestWithSuccess(const RequestInfo& request_info, + static void ServeRequestWithSuccess(RequestInfo request_info, const AffiliatedFacets& affiliation); // Posts the callback of the request described by |request_info| with failure. - static void ServeRequestWithFailure(const RequestInfo& request_info); + static void ServeRequestWithFailure(RequestInfo request_info); FacetURI facet_uri_; FacetManagerHost* backend_;
diff --git a/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.cc b/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.cc index 27da459..d0691be 100644 --- a/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.cc +++ b/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.cc
@@ -42,23 +42,23 @@ void MockAffiliatedMatchHelper::GetAffiliatedAndroidRealms( const PasswordStore::FormDigest& observed_form, - const AffiliatedRealmsCallback& result_callback) { + AffiliatedRealmsCallback result_callback) { std::vector<std::string> affiliated_android_realms = OnGetAffiliatedAndroidRealmsCalled(observed_form); - result_callback.Run(affiliated_android_realms); + std::move(result_callback).Run(affiliated_android_realms); } void MockAffiliatedMatchHelper::GetAffiliatedWebRealms( const PasswordStore::FormDigest& android_form, - const AffiliatedRealmsCallback& result_callback) { + AffiliatedRealmsCallback result_callback) { std::vector<std::string> affiliated_web_realms = OnGetAffiliatedWebRealmsCalled(android_form); - result_callback.Run(affiliated_web_realms); + std::move(result_callback).Run(affiliated_web_realms); } void MockAffiliatedMatchHelper::InjectAffiliationAndBrandingInformation( std::vector<std::unique_ptr<autofill::PasswordForm>> forms, - const PasswordFormsCallback& result_callback) { + PasswordFormsCallback result_callback) { const std::vector<AffiliationAndBrandingInformation>& information = OnInjectAffiliationAndBrandingInformationCalled(); ASSERT_EQ(information.size(), forms.size()); @@ -67,7 +67,7 @@ forms[i]->app_display_name = information[i].app_display_name; forms[i]->app_icon_url = information[i].app_icon_url; } - result_callback.Run(std::move(forms)); + std::move(result_callback).Run(std::move(forms)); } } // namespace password_manager
diff --git a/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.h b/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.h index 05095f3..6d089a6 100644 --- a/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.h +++ b/components/password_manager/core/browser/android_affiliation/mock_affiliated_match_helper.h
@@ -61,14 +61,14 @@ void GetAffiliatedAndroidRealms( const PasswordStore::FormDigest& observed_form, - const AffiliatedRealmsCallback& result_callback) override; + AffiliatedRealmsCallback result_callback) override; void GetAffiliatedWebRealms( const PasswordStore::FormDigest& android_form, - const AffiliatedRealmsCallback& result_callback) override; + AffiliatedRealmsCallback result_callback) override; void InjectAffiliationAndBrandingInformation( std::vector<std::unique_ptr<autofill::PasswordForm>> forms, - const PasswordFormsCallback& result_callback) override; + PasswordFormsCallback result_callback) override; DISALLOW_COPY_AND_ASSIGN(MockAffiliatedMatchHelper); };
diff --git a/components/password_manager/core/browser/credential_manager_impl.cc b/components/password_manager/core/browser/credential_manager_impl.cc index 363f5fc..ab96f76 100644 --- a/components/password_manager/core/browser/credential_manager_impl.cc +++ b/components/password_manager/core/browser/credential_manager_impl.cc
@@ -62,7 +62,7 @@ // without fetching of suppressed HTTPS credentials on HTTP origins as the API // is only available on HTTPS origins. auto form_fetcher = std::make_unique<FormFetcherImpl>( - PasswordStore::FormDigest(*observed_form), client_, false, false); + PasswordStore::FormDigest(*observed_form), client_, false); form_manager_ = std::make_unique<CredentialManagerPasswordFormManager>( client_, *observed_form, std::move(form), this, nullptr, std::move(form_fetcher));
diff --git a/components/password_manager/core/browser/fake_form_fetcher.cc b/components/password_manager/core/browser/fake_form_fetcher.cc index f7507c2..a6421ad3 100644 --- a/components/password_manager/core/browser/fake_form_fetcher.cc +++ b/components/password_manager/core/browser/fake_form_fetcher.cc
@@ -49,25 +49,6 @@ return blacklisted_; } -const std::vector<const PasswordForm*>& -FakeFormFetcher::GetSuppressedHTTPSForms() const { - return suppressed_https_forms_; -} - -const std::vector<const autofill::PasswordForm*>& -FakeFormFetcher::GetSuppressedPSLMatchingForms() const { - return suppressed_psl_matching_forms_; -} - -const std::vector<const autofill::PasswordForm*>& -FakeFormFetcher::GetSuppressedSameOrganizationNameForms() const { - return suppressed_same_organization_name_forms_; -} - -bool FakeFormFetcher::DidCompleteQueryingSuppressedForms() const { - return did_complete_querying_suppressed_forms_; -} - void FakeFormFetcher::SetNonFederated( const std::vector<const autofill::PasswordForm*>& non_federated) { non_federated_ = non_federated;
diff --git a/components/password_manager/core/browser/fake_form_fetcher.h b/components/password_manager/core/browser/fake_form_fetcher.h index 4367187..4a36222 100644 --- a/components/password_manager/core/browser/fake_form_fetcher.h +++ b/components/password_manager/core/browser/fake_form_fetcher.h
@@ -63,39 +63,6 @@ federated_ = federated; } - const std::vector<const autofill::PasswordForm*>& GetSuppressedHTTPSForms() - const override; - - // The pointees in |suppressed_forms| must outlive the fetcher. - void set_suppressed_https_forms( - const std::vector<const autofill::PasswordForm*>& suppressed_forms) { - suppressed_https_forms_ = suppressed_forms; - } - - const std::vector<const autofill::PasswordForm*>& - GetSuppressedPSLMatchingForms() const override; - - // The pointees in |suppressed_forms| must outlive the fetcher. - void set_suppressed_psl_matching_forms( - const std::vector<const autofill::PasswordForm*>& suppressed_forms) { - suppressed_psl_matching_forms_ = suppressed_forms; - } - - const std::vector<const autofill::PasswordForm*>& - GetSuppressedSameOrganizationNameForms() const override; - - // The pointees in |suppressed_forms| must outlive the fetcher. - void set_suppressed_same_organization_name_forms( - const std::vector<const autofill::PasswordForm*>& suppressed_forms) { - suppressed_same_organization_name_forms_ = suppressed_forms; - } - - bool DidCompleteQueryingSuppressedForms() const override; - - void set_did_complete_querying_suppressed_forms(bool value) { - did_complete_querying_suppressed_forms_ = value; - } - void SetNonFederated( const std::vector<const autofill::PasswordForm*>& non_federated); @@ -117,11 +84,6 @@ std::vector<const autofill::PasswordForm*> non_federated_; std::vector<const autofill::PasswordForm*> federated_; std::vector<const autofill::PasswordForm*> blacklisted_; - std::vector<const autofill::PasswordForm*> suppressed_https_forms_; - std::vector<const autofill::PasswordForm*> suppressed_psl_matching_forms_; - std::vector<const autofill::PasswordForm*> - suppressed_same_organization_name_forms_; - bool did_complete_querying_suppressed_forms_ = false; DISALLOW_COPY_AND_ASSIGN(FakeFormFetcher); };
diff --git a/components/password_manager/core/browser/form_fetcher.h b/components/password_manager/core/browser/form_fetcher.h index 25a0ad1..32d43984 100644 --- a/components/password_manager/core/browser/form_fetcher.h +++ b/components/password_manager/core/browser/form_fetcher.h
@@ -76,42 +76,6 @@ virtual const std::vector<const autofill::PasswordForm*>& GetBlacklistedMatches() const = 0; - // The following accessors return various kinds of `suppressed` credentials. - // These are stored credentials that are not (auto-)filled, because they are - // for an origin that is similar to, but not exactly matching the origin that - // this FormFetcher was created for. They are used for recording metrics on - // how often such -- potentially, but not necessarily related -- credentials - // are not offered to the user, unduly increasing log-in friction. - // - // There are currently three kinds of suppressed credentials: - // 1.) HTTPS credentials not filled on the HTTP version of the origin. - // 2.) PSL-matches that are not auto-filled (but filled on account select). - // 3.) Same-organization name credentials, not filled. - // - // Results below are queried on a best-effort basis, might be somewhat stale, - // and are available shortly after the Consumer::OnFetchCompleted callback. - - // When this instance fetches forms for an HTTP origin: Returns saved - // credentials, if any, found for the HTTPS version of that origin. Empty - // otherwise. - virtual const std::vector<const autofill::PasswordForm*>& - GetSuppressedHTTPSForms() const = 0; - - // Returns saved credentials, if any, for PSL-matching origins. Autofilling - // these is suppressed, however, they *can be* filled on account select. - virtual const std::vector<const autofill::PasswordForm*>& - GetSuppressedPSLMatchingForms() const = 0; - - // Returns saved credentials, if any, found for HTTP/HTTPS origins with the - // same organization name as the origin this FormFetcher was created for. - virtual const std::vector<const autofill::PasswordForm*>& - GetSuppressedSameOrganizationNameForms() const = 0; - - // Whether querying suppressed forms (of all flavors) was attempted and did - // complete at least once during the lifetime of this instance, regardless of - // whether there have been any results. - virtual bool DidCompleteQueryingSuppressedForms() const = 0; - // Fetches stored matching logins. In addition the statistics is fetched on // platforms with the password bubble. This is called automatically during // construction and can be called manually later as well to cause an update
diff --git a/components/password_manager/core/browser/form_fetcher_impl.cc b/components/password_manager/core/browser/form_fetcher_impl.cc index 83f810e5..964028b 100644 --- a/components/password_manager/core/browser/form_fetcher_impl.cc +++ b/components/password_manager/core/browser/form_fetcher_impl.cc
@@ -62,43 +62,6 @@ return matches; } -void SplitSuppressedFormsAndAssignTo( - const PasswordStore::FormDigest& observed_form_digest, - std::vector<std::unique_ptr<PasswordForm>> suppressed_forms, - std::vector<std::unique_ptr<PasswordForm>>* same_origin_https_forms, - std::vector<std::unique_ptr<PasswordForm>>* psl_matching_forms, - std::vector<std::unique_ptr<PasswordForm>>* same_organization_name_forms) { - DCHECK(same_origin_https_forms); - DCHECK(psl_matching_forms); - DCHECK(same_organization_name_forms); - same_origin_https_forms->clear(); - psl_matching_forms->clear(); - same_organization_name_forms->clear(); - for (auto& form : suppressed_forms) { - switch (GetMatchResult(*form, observed_form_digest)) { - case MatchResult::PSL_MATCH: - psl_matching_forms->push_back(std::move(form)); - break; - case MatchResult::NO_MATCH: - if (form->origin.host() != observed_form_digest.origin.host()) { - same_organization_name_forms->push_back(std::move(form)); - } else if (form->origin.SchemeIs(url::kHttpsScheme) && - observed_form_digest.origin.SchemeIs(url::kHttpScheme)) { - same_origin_https_forms->push_back(std::move(form)); - } else { - // HTTP form suppressed on HTTPS observed page: The HTTP->HTTPS - // migration can leave tons of such HTTP forms behind, ignore these. - } - break; - case MatchResult::EXACT_MATCH: - case MatchResult::FEDERATED_MATCH: - case MatchResult::FEDERATED_PSL_MATCH: - NOTREACHED() << "Suppressed match cannot be exact or federated."; - break; - } - } -} - // Create a vector of const PasswordForm from a vector of // unique_ptr<PasswordForm> by applying get() item-wise. std::vector<const PasswordForm*> MakeWeakCopies( @@ -126,12 +89,10 @@ FormFetcherImpl::FormFetcherImpl(PasswordStore::FormDigest form_digest, const PasswordManagerClient* client, - bool should_migrate_http_passwords, - bool should_query_suppressed_forms) + bool should_migrate_http_passwords) : form_digest_(std::move(form_digest)), client_(client), - should_migrate_http_passwords_(should_migrate_http_passwords), - should_query_suppressed_forms_(should_query_suppressed_forms) {} + should_migrate_http_passwords_(should_migrate_http_passwords) {} FormFetcherImpl::~FormFetcherImpl() = default; @@ -171,25 +132,6 @@ return weak_blacklisted_; } -const std::vector<const PasswordForm*>& -FormFetcherImpl::GetSuppressedHTTPSForms() const { - return weak_suppressed_same_origin_https_forms_; -} - -const std::vector<const PasswordForm*>& -FormFetcherImpl::GetSuppressedPSLMatchingForms() const { - return weak_suppressed_psl_matching_forms_; -} - -const std::vector<const PasswordForm*>& -FormFetcherImpl::GetSuppressedSameOrganizationNameForms() const { - return weak_suppressed_same_organization_name_forms_; -} - -bool FormFetcherImpl::DidCompleteQueryingSuppressedForms() const { - return did_complete_querying_suppressed_forms_; -} - void FormFetcherImpl::OnGetPasswordStoreResults( std::vector<std::unique_ptr<PasswordForm>> results) { DCHECK_EQ(State::WAITING, state_); @@ -210,17 +152,6 @@ logger->LogNumber(Logger::STRING_NUMBER_RESULTS, results.size()); } - // Kick off the discovery of suppressed credentials, regardless of whether - // there are some precisely matching |results|. These results are used only - // for recording metrics at PasswordFormManager desctruction time, this is why - // they are requested this late. - if (should_query_suppressed_forms_ && - form_digest_.scheme == PasswordForm::SCHEME_HTML && - GURL(form_digest_.signon_realm).SchemeIsHTTPOrHTTPS()) { - suppressed_form_fetcher_ = std::make_unique<SuppressedFormFetcher>( - form_digest_.signon_realm, client_, this); - } - if (should_migrate_http_passwords_ && results.empty() && form_digest_.origin.SchemeIs(url::kHttpsScheme)) { http_migrator_ = std::make_unique<HttpPasswordStoreMigrator>( @@ -243,21 +174,6 @@ ProcessPasswordStoreResults(std::move(forms)); } -void FormFetcherImpl::ProcessSuppressedForms( - std::vector<std::unique_ptr<autofill::PasswordForm>> forms) { - did_complete_querying_suppressed_forms_ = true; - SplitSuppressedFormsAndAssignTo(form_digest_, std::move(forms), - &suppressed_same_origin_https_forms_, - &suppressed_psl_matching_forms_, - &suppressed_same_organization_name_forms_); - weak_suppressed_same_origin_https_forms_ = - MakeWeakCopies(suppressed_same_origin_https_forms_); - weak_suppressed_psl_matching_forms_ = - MakeWeakCopies(suppressed_psl_matching_forms_); - weak_suppressed_same_organization_name_forms_ = - MakeWeakCopies(suppressed_same_organization_name_forms_); -} - void FormFetcherImpl::Fetch() { std::unique_ptr<BrowserSavePasswordProgressLogger> logger; if (password_manager_util::IsLoggingActive(client_)) { @@ -296,8 +212,7 @@ std::unique_ptr<FormFetcher> FormFetcherImpl::Clone() { // Create the copy without the "HTTPS migration" activated. If it was needed, // then it was done by |this| already. - auto result = std::make_unique<FormFetcherImpl>( - form_digest_, client_, false, should_query_suppressed_forms_); + auto result = std::make_unique<FormFetcherImpl>(form_digest_, client_, false); if (state_ != State::NOT_WAITING) { // There are no store results to copy, trigger a Fetch on the clone instead. @@ -309,22 +224,10 @@ result->federated_ = MakeCopies(this->federated_); result->blacklisted_ = MakeCopies(this->blacklisted_); result->interactions_stats_ = this->interactions_stats_; - result->suppressed_same_origin_https_forms_ = - MakeCopies(this->suppressed_same_origin_https_forms_); - result->suppressed_psl_matching_forms_ = - MakeCopies(this->suppressed_psl_matching_forms_); - result->suppressed_same_organization_name_forms_ = - MakeCopies(this->suppressed_same_organization_name_forms_); result->weak_non_federated_ = MakeWeakCopies(result->non_federated_); result->weak_federated_ = MakeWeakCopies(result->federated_); result->weak_blacklisted_ = MakeWeakCopies(result->blacklisted_); - result->weak_suppressed_same_origin_https_forms_ = - MakeWeakCopies(result->suppressed_same_origin_https_forms_); - result->weak_suppressed_psl_matching_forms_ = - MakeWeakCopies(result->suppressed_psl_matching_forms_); - result->weak_suppressed_same_organization_name_forms_ = - MakeWeakCopies(result->suppressed_same_organization_name_forms_); result->state_ = this->state_; result->need_to_refetch_ = this->need_to_refetch_;
diff --git a/components/password_manager/core/browser/form_fetcher_impl.h b/components/password_manager/core/browser/form_fetcher_impl.h index b9ac4b2..c3d7d7e 100644 --- a/components/password_manager/core/browser/form_fetcher_impl.h +++ b/components/password_manager/core/browser/form_fetcher_impl.h
@@ -14,7 +14,6 @@ #include "components/password_manager/core/browser/http_password_store_migrator.h" #include "components/password_manager/core/browser/password_store.h" #include "components/password_manager/core/browser/password_store_consumer.h" -#include "components/password_manager/core/browser/suppressed_form_fetcher.h" namespace password_manager { @@ -24,15 +23,13 @@ // with a particular origin. class FormFetcherImpl : public FormFetcher, public PasswordStoreConsumer, - public HttpPasswordStoreMigrator::Consumer, - public SuppressedFormFetcher::Consumer { + public HttpPasswordStoreMigrator::Consumer { public: // |form_digest| describes what credentials need to be retrieved and // |client| serves the PasswordStore, the logging information etc. FormFetcherImpl(PasswordStore::FormDigest form_digest, const PasswordManagerClient* client, - bool should_migrate_http_passwords, - bool should_query_suppressed_forms); + bool should_migrate_http_passwords); ~FormFetcherImpl() override; @@ -47,13 +44,6 @@ const override; const std::vector<const autofill::PasswordForm*>& GetBlacklistedMatches() const override; - const std::vector<const autofill::PasswordForm*>& GetSuppressedHTTPSForms() - const override; - const std::vector<const autofill::PasswordForm*>& - GetSuppressedPSLMatchingForms() const override; - const std::vector<const autofill::PasswordForm*>& - GetSuppressedSameOrganizationNameForms() const override; - bool DidCompleteQueryingSuppressedForms() const override; void Fetch() override; std::unique_ptr<FormFetcher> Clone() override; @@ -66,10 +56,6 @@ void ProcessMigratedForms( std::vector<std::unique_ptr<autofill::PasswordForm>> forms) override; - // SuppressedFormFetcher::Consumer: - void ProcessSuppressedForms( - std::vector<std::unique_ptr<autofill::PasswordForm>> forms) override; - private: // Processes password form results and forwards them to the |consumers_|. void ProcessPasswordStoreResults( @@ -92,29 +78,11 @@ // Statistics for the current domain. std::vector<InteractionsStats> interactions_stats_; - std::vector<std::unique_ptr<autofill::PasswordForm>> - suppressed_same_origin_https_forms_; - std::vector<std::unique_ptr<autofill::PasswordForm>> - suppressed_psl_matching_forms_; - std::vector<std::unique_ptr<autofill::PasswordForm>> - suppressed_same_organization_name_forms_; - - // Whether querying |suppressed_https_forms_| was attempted and did complete - // at least once during the lifetime of this instance, regardless of whether - // there have been any results. - bool did_complete_querying_suppressed_forms_ = false; - // Non-owning copies of the vectors above. // TODO(https://crbug.com/945864): Clean this up. std::vector<const autofill::PasswordForm*> weak_non_federated_; std::vector<const autofill::PasswordForm*> weak_federated_; std::vector<const autofill::PasswordForm*> weak_blacklisted_; - std::vector<const autofill::PasswordForm*> - weak_suppressed_same_origin_https_forms_; - std::vector<const autofill::PasswordForm*> - weak_suppressed_psl_matching_forms_; - std::vector<const autofill::PasswordForm*> - weak_suppressed_same_organization_name_forms_; // Consumers of the fetcher, all are assumed to outlive |this|. std::set<FormFetcher::Consumer*> consumers_; @@ -132,18 +100,9 @@ // Indicates whether HTTP passwords should be migrated to HTTPS. const bool should_migrate_http_passwords_; - // Indicates whether to query suppressed forms. - const bool should_query_suppressed_forms_; - // Does the actual migration. std::unique_ptr<HttpPasswordStoreMigrator> http_migrator_; - // Responsible for looking up `suppressed` credentials. These are stored - // credentials that were not filled, even though they might be related to the - // origin that this instance was created for. Look-up happens asynchronously, - // without blocking Consumer::OnFetchCompleted. - std::unique_ptr<SuppressedFormFetcher> suppressed_form_fetcher_; - DISALLOW_COPY_AND_ASSIGN(FormFetcherImpl); };
diff --git a/components/password_manager/core/browser/form_fetcher_impl_unittest.cc b/components/password_manager/core/browser/form_fetcher_impl_unittest.cc index 3c22edfd..7850558 100644 --- a/components/password_manager/core/browser/form_fetcher_impl_unittest.cc +++ b/components/password_manager/core/browser/form_fetcher_impl_unittest.cc
@@ -50,12 +50,6 @@ constexpr const char kTestHttpsURL[] = "https://example.in/"; constexpr const char kTestHttpsActionURL[] = "https://login.example.org/"; -constexpr const char kTestPSLMatchingHttpURL[] = "http://psl.example.in/"; -constexpr const char kTestPSLMatchingHttpsURL[] = "https://psl.example.in/"; - -constexpr const char kTestHttpSameOrgNameURL[] = "http://sub.example.com/"; -constexpr const char kTestHttpsSameOrgNameURL[] = "https://sub.example.com/"; - constexpr const char kTestFederatedRealm[] = "federation://example.in/accounts.google.com"; constexpr const char kTestFederationURL[] = "https://accounts.google.com/"; @@ -175,15 +169,6 @@ return results; } -std::vector<PasswordForm> PointeeValues( - const std::vector<const PasswordForm*> forms) { - std::vector<PasswordForm> result; - result.reserve(forms.size()); - for (const PasswordForm* form : forms) - result.push_back(*form); - return result; -} - ACTION_P(GetAndAssignWeakPtr, ptr) { *ptr = arg0->GetWeakPtr(); } @@ -201,8 +186,7 @@ client_.set_store(mock_store_.get()); form_fetcher_ = std::make_unique<FormFetcherImpl>( - form_digest_, &client_, false /* should_migrate_http_passwords */, - false /* should_query_suppressed_https_forms */); + form_digest_, &client_, false /* should_migrate_http_passwords */); } ~FormFetcherImplTest() override { mock_store_->ShutdownOnUIThread(); } @@ -220,57 +204,6 @@ testing::Mock::VerifyAndClearExpectations(mock_store_.get()); } - void RecreateFormFetcherWithQueryingSuppressedForms() { - form_fetcher_ = std::make_unique<FormFetcherImpl>( - form_digest_, &client_, false /* should_migrate_http_passwords */, - true /* should_query_suppressed_https_forms */); - EXPECT_CALL(consumer_, OnFetchCompleted); - form_fetcher_->AddConsumer(&consumer_); - testing::Mock::VerifyAndClearExpectations(&consumer_); - } - - // Simulates a call to Fetch(), and supplies |simulated_matches| as the - // PasswordStore results. Expects that this will trigger the querying of - // suppressed forms by means of a GetLoginsForSameOrganizationName call - // being issued against the |expected_signon_realm|. - // - // Call CompleteQueryingSuppressedForms with the emitted |consumer_ptr| - // to complete the query. - void SimulateFetchAndExpectQueryingSuppressedForms( - const std::vector<PasswordForm>& simulated_get_logins_matches, - const std::string& expected_signon_realm, - base::WeakPtr<PasswordStoreConsumer>* consumer_ptr /* out */) { - ASSERT_EQ(FormFetcher::State::NOT_WAITING, form_fetcher_->GetState()); - - Fetch(); - - EXPECT_CALL(*mock_store_, - GetLoginsForSameOrganizationName(expected_signon_realm, _)) - .WillOnce(::testing::WithArg<1>(GetAndAssignWeakPtr(consumer_ptr))); - const size_t num_matches = simulated_get_logins_matches.size(); - EXPECT_CALL(consumer_, OnFetchCompleted); - - form_fetcher_->OnGetPasswordStoreResults( - MakeResults(simulated_get_logins_matches)); - EXPECT_THAT(form_fetcher_->GetNonFederatedMatches(), - ::testing::SizeIs(num_matches)); - - ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(&consumer_)); - ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(mock_store_.get())); - ASSERT_EQ(FormFetcher::State::NOT_WAITING, form_fetcher_->GetState()); - ASSERT_TRUE(*consumer_ptr); - } - - void CompleteQueryingSuppressedForms( - const std::vector<PasswordForm>& simulated_suppressed_forms, - base::WeakPtr<PasswordStoreConsumer> consumer_ptr) { - ASSERT_TRUE(consumer_ptr); - ASSERT_EQ(FormFetcher::State::NOT_WAITING, form_fetcher_->GetState()); - consumer_ptr->OnGetPasswordStoreResults( - MakeResults(simulated_suppressed_forms)); - ASSERT_EQ(FormFetcher::State::NOT_WAITING, form_fetcher_->GetState()); - } - base::test::ScopedTaskEnvironment scoped_task_environment_; PasswordStore::FormDigest form_digest_; std::unique_ptr<FormFetcherImpl> form_fetcher_; @@ -514,8 +447,7 @@ // A new form fetcher is created to be able to set the form digest and // migration flag. form_fetcher_ = std::make_unique<FormFetcherImpl>( - form_digest_, &client_, true /* should_migrate_http_passwords */, - false /* should_query_suppressed_https_forms */); + form_digest_, &client_, true /* should_migrate_http_passwords */); EXPECT_CALL(consumer_, OnFetchCompleted); form_fetcher_->AddConsumer(&consumer_); @@ -563,8 +495,7 @@ // A new form fetcher is created to be able to set the form digest and // migration flag. form_fetcher_ = std::make_unique<FormFetcherImpl>( - form_digest_, &client_, true /* should_migrate_http_passwords */, - false /* should_query_suppressed_https_forms */); + form_digest_, &client_, true /* should_migrate_http_passwords */); EXPECT_CALL(consumer_, OnFetchCompleted); form_fetcher_->AddConsumer(&consumer_); @@ -639,8 +570,7 @@ // A new form fetcher is created to be able to set the form digest and // migration flag. form_fetcher_ = std::make_unique<FormFetcherImpl>( - form_digest_, &client_, true /* should_migrate_http_passwords */, - false /* should_query_suppressed_https_forms */); + form_digest_, &client_, true /* should_migrate_http_passwords */); PasswordForm https_form = CreateNonFederated(); @@ -681,229 +611,20 @@ EXPECT_EQ(FormFetcher::State::NOT_WAITING, form_fetcher_->GetState()); } -TEST_F(FormFetcherImplTest, SuppressedForms_QueriedForHTTPAndHTTPSOrigins) { - static const PasswordStore::FormDigest kObservedHTTPSFormDigest( - PasswordForm::SCHEME_HTML, kTestHttpsURL, GURL(kTestHttpsURL)); - - static const PasswordForm kFormHttpSameHost = - CreateHTMLForm(kTestHttpURL, "user_1", "pass_1"); - static const PasswordForm kFormHttpsSameHost = - CreateHTMLForm(kTestHttpsURL, "user_2", "pass_2"); - static const PasswordForm kFormHttpPSLMatchingHost = - CreateHTMLForm(kTestPSLMatchingHttpURL, "user_3", "pass_3"); - static const PasswordForm kFormHttpsPSLMatchingHost = - CreateHTMLForm(kTestPSLMatchingHttpsURL, "user_4", "pass_4"); - static const PasswordForm kFormHttpSameOrgNameHost = - CreateHTMLForm(kTestHttpSameOrgNameURL, "user_5", "pass_5"); - static const PasswordForm kFormHttpsSameOrgNameHost = - CreateHTMLForm(kTestHttpsSameOrgNameURL, "user_6", "pass_6"); - - static const struct { - const char* observed_form_origin; - const char* observed_form_realm; - std::vector<PasswordForm> matching_forms; - std::vector<PasswordForm> all_suppressed_forms; - std::vector<PasswordForm> expected_suppressed_https_forms; - std::vector<PasswordForm> expected_suppressed_psl_forms; - std::vector<PasswordForm> expected_suppressed_same_org_name_forms; - } kTestCases[] = { - {kTestHttpURL, - kTestHttpURL, - {kFormHttpSameHost}, - {kFormHttpsSameHost, kFormHttpPSLMatchingHost, kFormHttpsPSLMatchingHost, - kFormHttpSameOrgNameHost, kFormHttpsSameOrgNameHost}, - {kFormHttpsSameHost}, - {kFormHttpPSLMatchingHost}, - {kFormHttpsPSLMatchingHost, kFormHttpSameOrgNameHost, - kFormHttpsSameOrgNameHost}}, - - {kTestHttpsURL, - kTestHttpsURL, - {kFormHttpsSameHost}, - {kFormHttpSameHost, kFormHttpPSLMatchingHost, kFormHttpsPSLMatchingHost, - kFormHttpSameOrgNameHost, kFormHttpsSameOrgNameHost}, - std::vector<PasswordForm>(), - {kFormHttpsPSLMatchingHost}, - {kFormHttpPSLMatchingHost, kFormHttpSameOrgNameHost, - kFormHttpsSameOrgNameHost}}, - }; - - for (const auto& test_case : kTestCases) { - SCOPED_TRACE(test_case.observed_form_origin); - - form_digest_ = PasswordStore::FormDigest( - PasswordForm::SCHEME_HTML, test_case.observed_form_origin, - GURL(test_case.observed_form_origin)); - RecreateFormFetcherWithQueryingSuppressedForms(); - - // The matching PasswordStore results coming in should trigger another - // GetLogins request to fetcht the suppressed forms. - base::WeakPtr<PasswordStoreConsumer> suppressed_form_fetcher_ptr = nullptr; - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - test_case.matching_forms, test_case.observed_form_realm, - &suppressed_form_fetcher_ptr)); - - EXPECT_FALSE(form_fetcher_->DidCompleteQueryingSuppressedForms()); - EXPECT_THAT(form_fetcher_->GetSuppressedHTTPSForms(), IsEmpty()); - - ASSERT_NO_FATAL_FAILURE(CompleteQueryingSuppressedForms( - test_case.all_suppressed_forms, suppressed_form_fetcher_ptr)); - - EXPECT_TRUE(form_fetcher_->DidCompleteQueryingSuppressedForms()); - EXPECT_THAT( - PointeeValues(form_fetcher_->GetSuppressedHTTPSForms()), - UnorderedElementsAreArray(test_case.expected_suppressed_https_forms)); - EXPECT_THAT( - PointeeValues(form_fetcher_->GetSuppressedPSLMatchingForms()), - UnorderedElementsAreArray(test_case.expected_suppressed_psl_forms)); - EXPECT_THAT( - PointeeValues(form_fetcher_->GetSuppressedSameOrganizationNameForms()), - UnorderedElementsAreArray( - test_case.expected_suppressed_same_org_name_forms)); - } -} - -TEST_F(FormFetcherImplTest, SuppressedForms_RequeriedOnRefetch) { - RecreateFormFetcherWithQueryingSuppressedForms(); - - base::WeakPtr<PasswordStoreConsumer> https_form_fetcher_ptr = nullptr; - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - std::vector<PasswordForm>(), kTestHttpURL, &https_form_fetcher_ptr)); - ASSERT_NO_FATAL_FAILURE(CompleteQueryingSuppressedForms( - std::vector<PasswordForm>(), https_form_fetcher_ptr)); - - // Another call to Fetch() should refetch the list of suppressed credentials. - const PasswordForm suppressed_https_form = CreateNonFederated(); - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - std::vector<PasswordForm>(), kTestHttpURL, &https_form_fetcher_ptr)); - ASSERT_NO_FATAL_FAILURE(CompleteQueryingSuppressedForms( - {suppressed_https_form}, https_form_fetcher_ptr)); - - EXPECT_THAT(form_fetcher_->GetSuppressedHTTPSForms(), - UnorderedElementsAre(Pointee(suppressed_https_form))); -} - -TEST_F(FormFetcherImplTest, SuppressedForms_NeverWiped) { - RecreateFormFetcherWithQueryingSuppressedForms(); - - static const PasswordForm kFormHttpsSameHost = - CreateHTMLForm(kTestHttpsURL, "user_1", "pass_1"); - static const PasswordForm kFormHttpPSLMatchingHost = - CreateHTMLForm(kTestPSLMatchingHttpURL, "user_2", "pass_2"); - static const PasswordForm kFormHttpSameOrgNameHost = - CreateHTMLForm(kTestHttpSameOrgNameURL, "user_3", "pass_3"); - - base::WeakPtr<PasswordStoreConsumer> https_form_fetcher_ptr = nullptr; - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - std::vector<PasswordForm>(), kTestHttpURL, &https_form_fetcher_ptr)); - ASSERT_NO_FATAL_FAILURE(CompleteQueryingSuppressedForms( - {kFormHttpsSameHost, kFormHttpPSLMatchingHost, kFormHttpSameOrgNameHost}, - https_form_fetcher_ptr)); - - // Ensure that calling Fetch() does not wipe (even temporarily) the previously - // fetched list of suppressed HTTPS credentials. Stale is better than nothing. - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - std::vector<PasswordForm>(), kTestHttpURL, &https_form_fetcher_ptr)); - - EXPECT_TRUE(form_fetcher_->DidCompleteQueryingSuppressedForms()); - EXPECT_THAT(form_fetcher_->GetSuppressedHTTPSForms(), - UnorderedElementsAre(Pointee(kFormHttpsSameHost))); - EXPECT_THAT(form_fetcher_->GetSuppressedPSLMatchingForms(), - UnorderedElementsAre(Pointee(kFormHttpPSLMatchingHost))); - EXPECT_THAT(form_fetcher_->GetSuppressedSameOrganizationNameForms(), - UnorderedElementsAre(Pointee(kFormHttpSameOrgNameHost))); -} - -TEST_F(FormFetcherImplTest, SuppressedForms_FormFetcherDestroyedWhileQuerying) { - RecreateFormFetcherWithQueryingSuppressedForms(); - - base::WeakPtr<PasswordStoreConsumer> https_form_fetcher_ptr = nullptr; - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - std::vector<PasswordForm>(), kTestHttpURL, &https_form_fetcher_ptr)); - - EXPECT_FALSE(form_fetcher_->DidCompleteQueryingSuppressedForms()); - - // Destroy FormFetcher while SuppressedHTTPSFormFetcher is busy. - form_fetcher_.reset(); -} - -// Exercise the scenario where querying the suppressed HTTPS logins takes so -// long that in the meantime there is another call to Fetch(), which completes, -// and triggers fetching HTTPS suppressed forms yet again. In this case, the -// first SuppressedHTTPSFormFetcher is destroyed and its query cancelled. -TEST_F(FormFetcherImplTest, SuppressedForms_SimultaneousQueries) { - RecreateFormFetcherWithQueryingSuppressedForms(); - - base::WeakPtr<PasswordStoreConsumer> https_form_fetcher_ptr1; - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - std::vector<PasswordForm>(), kTestHttpURL, &https_form_fetcher_ptr1)); - - base::WeakPtr<PasswordStoreConsumer> https_form_fetcher_ptr2; - ASSERT_NO_FATAL_FAILURE(SimulateFetchAndExpectQueryingSuppressedForms( - std::vector<PasswordForm>(), kTestHttpURL, &https_form_fetcher_ptr2)); - - EXPECT_FALSE(form_fetcher_->DidCompleteQueryingSuppressedForms()); - EXPECT_THAT(form_fetcher_->GetSuppressedHTTPSForms(), IsEmpty()); - EXPECT_FALSE(https_form_fetcher_ptr1); - ASSERT_TRUE(https_form_fetcher_ptr2); - - static const PasswordForm kFormHttpsSameHost = - CreateHTMLForm(kTestHttpsURL, "user_1", "pass_1"); - static const PasswordForm kFormHttpPSLMatchingHost = - CreateHTMLForm(kTestPSLMatchingHttpURL, "user_2", "pass_2"); - static const PasswordForm kFormHttpSameOrgNameHost = - CreateHTMLForm(kTestHttpSameOrgNameURL, "user_3", "pass_3"); - - ASSERT_NO_FATAL_FAILURE(CompleteQueryingSuppressedForms( - {kFormHttpsSameHost, kFormHttpPSLMatchingHost, kFormHttpSameOrgNameHost}, - https_form_fetcher_ptr2)); - - EXPECT_TRUE(form_fetcher_->DidCompleteQueryingSuppressedForms()); - - EXPECT_TRUE(form_fetcher_->DidCompleteQueryingSuppressedForms()); - EXPECT_THAT(form_fetcher_->GetSuppressedHTTPSForms(), - UnorderedElementsAre(Pointee(kFormHttpsSameHost))); - EXPECT_THAT(form_fetcher_->GetSuppressedPSLMatchingForms(), - UnorderedElementsAre(Pointee(kFormHttpPSLMatchingHost))); - EXPECT_THAT(form_fetcher_->GetSuppressedSameOrganizationNameForms(), - UnorderedElementsAre(Pointee(kFormHttpSameOrgNameHost))); -} - -TEST_F(FormFetcherImplTest, SuppressedForms_NotQueriedForFederatedRealms) { - form_digest_ = PasswordStore::FormDigest( - PasswordForm::SCHEME_HTML, kTestFederatedRealm, GURL(kTestFederationURL)); - RecreateFormFetcherWithQueryingSuppressedForms(); - Fetch(); - - EXPECT_CALL(*mock_store_, GetLogins(_, _)).Times(0); - EXPECT_CALL(consumer_, OnFetchCompleted); - - form_fetcher_->OnGetPasswordStoreResults( - MakeResults(std::vector<PasswordForm>())); - - EXPECT_EQ(FormFetcher::State::NOT_WAITING, form_fetcher_->GetState()); - EXPECT_FALSE(form_fetcher_->DidCompleteQueryingSuppressedForms()); -} - // Cloning a FormFetcherImpl with empty results should result in an // instance with empty results. TEST_F(FormFetcherImplTest, Clone_EmptyResults) { - RecreateFormFetcherWithQueryingSuppressedForms(); Fetch(); - EXPECT_CALL(consumer_, OnFetchCompleted); - EXPECT_CALL(*mock_store_, GetLoginsForSameOrganizationName(_, _)); form_fetcher_->OnGetPasswordStoreResults( std::vector<std::unique_ptr<PasswordForm>>()); ASSERT_TRUE(::testing::Mock::VerifyAndClearExpectations(mock_store_.get())); // Clone() should not cause re-fetching from PasswordStore. EXPECT_CALL(*mock_store_, GetLogins(_, _)).Times(0); - EXPECT_CALL(*mock_store_, GetLoginsForSameOrganizationName(_, _)).Times(0); auto clone = form_fetcher_->Clone(); EXPECT_EQ(FormFetcher::State::NOT_WAITING, clone->GetState()); EXPECT_THAT(clone->GetInteractionsStats(), IsEmpty()); EXPECT_THAT(clone->GetFederatedMatches(), IsEmpty()); - EXPECT_THAT(clone->GetSuppressedHTTPSForms(), IsEmpty()); MockConsumer consumer; EXPECT_CALL(consumer, OnFetchCompleted); clone->AddConsumer(&consumer); @@ -912,7 +633,6 @@ // Cloning a FormFetcherImpl with non-empty results should result in an // instance with the same results. TEST_F(FormFetcherImplTest, Clone_NonEmptyResults) { - RecreateFormFetcherWithQueryingSuppressedForms(); Fetch(); PasswordForm non_federated = CreateNonFederated(); PasswordForm federated = CreateFederated(); @@ -922,8 +642,6 @@ results.push_back(std::make_unique<PasswordForm>(federated)); results.push_back(std::make_unique<PasswordForm>(android_federated)); - EXPECT_CALL(consumer_, OnFetchCompleted); - EXPECT_CALL(*mock_store_, GetLoginsForSameOrganizationName(_, _)); form_fetcher_->OnGetPasswordStoreResults(std::move(results)); EXPECT_THAT(form_fetcher_->GetNonFederatedMatches(), UnorderedElementsAre(Pointee(non_federated))); @@ -936,7 +654,6 @@ // Clone() should not cause re-fetching from PasswordStore. EXPECT_CALL(*mock_store_, GetLogins(_, _)).Times(0); - EXPECT_CALL(*mock_store_, GetLoginsForSameOrganizationName(_, _)).Times(0); auto clone = form_fetcher_->Clone(); // Additionally, destroy the original FormFetcher. This should not invalidate @@ -969,33 +686,6 @@ EXPECT_EQ(1u, clone->GetInteractionsStats().size()); } -// Cloning a FormFetcherImpl with some suppressed credentials should -// result in an instance with the same suppressed credentials. -TEST_F(FormFetcherImplTest, Clone_SuppressedCredentials) { - Fetch(); - form_fetcher_->OnGetPasswordStoreResults( - std::vector<std::unique_ptr<PasswordForm>>()); - - static const PasswordForm kFormHttpsSameHost = - CreateHTMLForm(kTestHttpsURL, "user_1", "pass_1"); - static const PasswordForm kFormHttpPSLMatchingHost = - CreateHTMLForm(kTestPSLMatchingHttpURL, "user_2", "pass_2"); - static const PasswordForm kFormHttpSameOrgNameHost = - CreateHTMLForm(kTestHttpSameOrgNameURL, "user_3", "pass_3"); - - form_fetcher_->ProcessSuppressedForms( - MakeResults({kFormHttpsSameHost, kFormHttpPSLMatchingHost, - kFormHttpSameOrgNameHost})); - - auto clone = form_fetcher_->Clone(); - EXPECT_THAT(PointeeValues(clone->GetSuppressedHTTPSForms()), - UnorderedElementsAre(kFormHttpsSameHost)); - EXPECT_THAT(PointeeValues(clone->GetSuppressedPSLMatchingForms()), - UnorderedElementsAre(kFormHttpPSLMatchingHost)); - EXPECT_THAT(PointeeValues(clone->GetSuppressedSameOrganizationNameForms()), - UnorderedElementsAre(kFormHttpSameOrgNameHost)); -} - // Check that removing consumers stops them from receiving store updates. TEST_F(FormFetcherImplTest, RemoveConsumer) { Fetch();
diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc index de4f10e..5609806 100644 --- a/components/password_manager/core/browser/login_database.cc +++ b/components/password_manager/core/browser/login_database.cc
@@ -1395,52 +1395,6 @@ return true; } -bool LoginDatabase::GetLoginsForSameOrganizationName( - const std::string& signon_realm, - std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) { - DCHECK(forms); - forms->clear(); - - GURL signon_realm_as_url(signon_realm); - if (!signon_realm_as_url.SchemeIsHTTPOrHTTPS()) - return true; - - std::string organization_name = - GetOrganizationIdentifyingName(signon_realm_as_url); - if (organization_name.empty()) - return true; - - // SQLite does not provide a function to escape special characters, but - // seemingly uses POSIX Extended Regular Expressions (ERE), and so does RE2. - // In the worst case the bogus results will be filtered out below. - static constexpr char kRESchemeAndSubdomains[] = "^https?://([\\w+%-]+\\.)*"; - static constexpr char kREDotAndEffectiveTLD[] = "(\\.[\\w+%-]+)+/$"; - const std::string signon_realms_with_same_organization_name_regexp = - kRESchemeAndSubdomains + RE2::QuoteMeta(organization_name) + - kREDotAndEffectiveTLD; - sql::Statement s(db_.GetCachedStatement( - SQL_FROM_HERE, get_same_organization_name_logins_statement_.c_str())); - s.BindString(0, signon_realms_with_same_organization_name_regexp); - - PrimaryKeyToFormMap key_to_form_map; - FormRetrievalResult result = StatementToForms(&s, nullptr, &key_to_form_map); - for (auto& pair : key_to_form_map) { - forms->push_back(std::move(pair.second)); - } - - using PasswordFormPtr = std::unique_ptr<autofill::PasswordForm>; - base::EraseIf(*forms, [&organization_name](const PasswordFormPtr& form) { - GURL candidate_signon_realm_as_url(form->signon_realm); - DCHECK_EQ(form->scheme, PasswordForm::SCHEME_HTML); - DCHECK(candidate_signon_realm_as_url.SchemeIsHTTPOrHTTPS()); - std::string candidate_form_organization_name = - GetOrganizationIdentifyingName(candidate_signon_realm_as_url); - return candidate_form_organization_name != organization_name; - }); - - return result == FormRetrievalResult::kSuccess; -} - bool LoginDatabase::GetLoginsCreatedBetween( const base::Time begin, const base::Time end, @@ -1902,11 +1856,6 @@ DCHECK(get_statement_psl_federated_.empty()); get_statement_psl_federated_ = get_statement_ + psl_statement + psl_federated_statement; - DCHECK(get_same_organization_name_logins_statement_.empty()); - get_same_organization_name_logins_statement_ = - "SELECT " + all_column_names + - " FROM LOGINS" - " WHERE scheme == 0 AND signon_realm REGEXP ?"; DCHECK(created_statement_.empty()); created_statement_ = "SELECT " + all_column_names +
diff --git a/components/password_manager/core/browser/login_database.h b/components/password_manager/core/browser/login_database.h index f7d8fcc..1e949c22 100644 --- a/components/password_manager/core/browser/login_database.h +++ b/components/password_manager/core/browser/login_database.h
@@ -123,18 +123,6 @@ std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) WARN_UNUSED_RESULT; - // Retrieves all stored credentials with SCHEME_HTTP that have a realm whose - // organization-identifying name -- that is, the first domain name label below - // the effective TLD -- matches that of |signon_realm|. Return value indicates - // a successful query (but potentially no results). - // - // For example, the organization-identifying name of "https://foo.example.org" - // is `example`, and logins will be returned for "http://bar.example.co.uk", - // but not for "http://notexample.com" or "https://example.foo.com". - bool GetLoginsForSameOrganizationName( - const std::string& signon_realm, - std::vector<std::unique_ptr<autofill::PasswordForm>>* forms); - // Gets all logins created from |begin| onwards (inclusive) and before |end|. // You may use a null Time value to do an unbounded search in either // direction. |key_to_form_map| must not be null and will be used to return @@ -332,7 +320,6 @@ std::string get_statement_psl_; std::string get_statement_federated_; std::string get_statement_psl_federated_; - std::string get_same_organization_name_logins_statement_; std::string created_statement_; std::string synced_statement_; std::string blacklisted_statement_;
diff --git a/components/password_manager/core/browser/login_database_unittest.cc b/components/password_manager/core/browser/login_database_unittest.cc index 93f83e81..1a6e6bb 100644 --- a/components/password_manager/core/browser/login_database_unittest.cc +++ b/components/password_manager/core/browser/login_database_unittest.cc
@@ -897,151 +897,6 @@ EXPECT_EQ(0U, result.size()); } -TEST_F(LoginDatabaseTest, - GetLoginsForSameOrganizationName_OnlyWebHTTPFormsAreConsidered) { - static constexpr const struct { - const PasswordFormData form_data; - bool use_federated_login; - const char* other_queried_signon_realm; - bool expected_matches_itself; - bool expected_matches_other_realm; - } kTestCases[] = { - {{PasswordForm::SCHEME_HTML, "https://example.com/", - "https://example.com/origin", "", L"", L"", L"", L"u", L"p", false, 1}, - false, - nullptr, - true, - true}, - {{PasswordForm::SCHEME_BASIC, "http://example.com/realm", - "http://example.com/", "", L"", L"", L"", L"u", L"p", false, 1}, - false, - nullptr, - false, - false}, - {{PasswordForm::SCHEME_OTHER, "ftp://example.com/realm", - "ftp://example.com/", "", L"", L"", L"", L"u", L"p", false, 1}, - false, - "http://example.com/realm", - false, - false}, - {{PasswordForm::SCHEME_HTML, - "federation://example.com/accounts.google.com", - "https://example.com/orgin", "", L"", L"", L"", L"u", L"", false, 1}, - true, - "http://example.com/", - false, - false}, - {{PasswordForm::SCHEME_HTML, "android://hash@example.com/", - "android://hash@example.com/", "", L"", L"", L"", L"u", L"p", false, 1}, - false, - "http://example.com/", - false, - false}, - }; - - for (const auto& test_case : kTestCases) { - SCOPED_TRACE(test_case.form_data.signon_realm); - - std::unique_ptr<PasswordForm> form = FillPasswordFormWithData( - test_case.form_data, test_case.use_federated_login); - ASSERT_EQ(AddChangeForForm(*form), db().AddLogin(*form)); - - std::vector<std::unique_ptr<PasswordForm>> same_organization_forms; - EXPECT_TRUE(db().GetLoginsForSameOrganizationName( - form->signon_realm, &same_organization_forms)); - EXPECT_EQ(test_case.expected_matches_itself ? 1u : 0u, - same_organization_forms.size()); - - if (test_case.other_queried_signon_realm) { - same_organization_forms.clear(); - EXPECT_TRUE(db().GetLoginsForSameOrganizationName( - test_case.other_queried_signon_realm, &same_organization_forms)); - EXPECT_EQ(test_case.expected_matches_other_realm ? 1u : 0u, - same_organization_forms.size()); - } - - ASSERT_TRUE(db().RemoveLogin(*form, /*changes=*/nullptr)); - } -} - -TEST_F(LoginDatabaseTest, GetLoginsForSameOrganizationName_DetailsOfMatching) { - const struct { - const char* saved_signon_realm; - const char* queried_signon_realm; - bool expected_matches; - } kTestCases[] = { - // PSL matches are also same-organization-name matches. - {"http://psl.example.com/", "http://example.com/", true}, - {"http://example.com/", "http://sub.example.com/", true}, - {"https://a.b.example.co.uk/", "https://c.d.e.example.co.uk/", true}, - - // Non-PSL but same-organization-name matches. Also an illustration why it - // would be unsafe to offer these credentials for filling. - {"https://example.com/", "https://example.co.uk/", true}, - {"https://example.co.uk/", "https://example.com/", true}, - {"https://a.example.appspot.com/", "https://b.example.co.uk/", true}, - - // Same-organization-name matches are HTTP/HTTPS-agnostic. - {"https://example.com/", "http://example.com/", true}, - {"http://example.com/", "https://example.com/", true}, - - {"http://www.foo-bar.com/", "http://sub.foo-bar.com", true}, - {"http://www.foo_bar.com/", "http://sub.foo_bar.com", true}, - {"http://www.foo-bar.com/", "http://sub.foo%2Dbar.com", true}, - {"http://www.foo%21bar.com/", "http://sub.foo!bar.com", true}, - {"http://a.xn--sztr-7na0i.co.uk/", "http://xn--sztr-7na0i.com/", true}, - {"http://a.xn--sztr-7na0i.co.uk/", "http://www.sz\xc3\xb3t\xc3\xa1r.com/", - true}, - - {"http://www.foo+bar.com/", "http://sub.foo+bar.com", true}, - {"http://www.foooobar.com/", "http://sub.foo+bar.com", false}, - {"http://www.fobar.com/", "http://sub.foo?bar.com", false}, - {"http://www.foozbar.com/", "http://sub.foo.bar.com", false}, - {"http://www.foozbar.com/", "http://sub.foo[a-z]bar.com", false}, - - {"https://notexample.com/", "https://example.com/", false}, - {"https://a.notexample.com/", "https://example.com/", false}, - {"https://example.com/", "https://notexample.com/", false}, - {"https://example.com/", "https://example.bar.com/", false}, - {"https://example.foo.com/", "https://example.com/", false}, - {"https://example.foo.com/", "https://example.bar.com/", false}, - - // URLs without host portions, hosts without registry controlled domains - // or hosts consisting of a registry. - {"http://localhost/", "http://localhost/", false}, - {"https://example/", "https://example/", false}, - {"https://co.uk/", "https://co.uk/", false}, - {"https://example/", "https://example.com/", false}, - {"https://a.example/", "https://example.com/", false}, - {"https://example.com/", "https://example/", false}, - {"https://127.0.0.1/", "https://127.0.0.1/", false}, - {"https:/[3ffe:2a00:100:7031::1]/", "https:/[3ffe:2a00:100:7031::1]/", - false}, - - // Queried |signon-realms| are invalid URIs. - {"https://example.com/", "", false}, - {"https://example.com/", "bad url", false}, - {"https://example.com/", "https://", false}, - {"https://example.com/", "http://www.foo;bar.com", false}, - {"https://example.com/", "example", false}, - }; - - for (const auto& test_case : kTestCases) { - SCOPED_TRACE(test_case.saved_signon_realm); - SCOPED_TRACE(test_case.queried_signon_realm); - - std::unique_ptr<PasswordForm> form = FillPasswordFormWithData( - {PasswordForm::SCHEME_HTML, test_case.saved_signon_realm, - test_case.saved_signon_realm, "", L"", L"", L"", L"u", L"p", true, 1}); - std::vector<std::unique_ptr<PasswordForm>> result; - ASSERT_EQ(AddChangeForForm(*form), db().AddLogin(*form)); - EXPECT_TRUE(db().GetLoginsForSameOrganizationName( - test_case.queried_signon_realm, &result)); - EXPECT_EQ(test_case.expected_matches ? 1u : 0u, result.size()); - ASSERT_TRUE(db().RemoveLogin(*form, /*changes=*/nullptr)); - } -} - static bool AddTimestampedLogin(LoginDatabase* db, std::string url, const std::string& unique_string,
diff --git a/components/password_manager/core/browser/mock_password_store.h b/components/password_manager/core/browser/mock_password_store.h index 9c116d6..53aa478 100644 --- a/components/password_manager/core/browser/mock_password_store.h +++ b/components/password_manager/core/browser/mock_password_store.h
@@ -22,8 +22,6 @@ MOCK_METHOD1(RemoveLogin, void(const autofill::PasswordForm&)); MOCK_METHOD2(GetLogins, void(const PasswordStore::FormDigest&, PasswordStoreConsumer*)); - MOCK_METHOD2(GetLoginsForSameOrganizationName, - void(const std::string&, PasswordStoreConsumer*)); MOCK_METHOD1(AddLogin, void(const autofill::PasswordForm&)); MOCK_METHOD1(UpdateLogin, void(const autofill::PasswordForm&)); MOCK_METHOD2(UpdateLoginWithPrimaryKey, @@ -56,10 +54,6 @@ const PasswordStore::FormDigest& form) override { return std::vector<std::unique_ptr<autofill::PasswordForm>>(); } - std::vector<std::unique_ptr<autofill::PasswordForm>> - FillLoginsForSameOrganizationName(const std::string& signon_realm) override { - return std::vector<std::unique_ptr<autofill::PasswordForm>>(); - } MOCK_METHOD1(FillAutofillableLogins, bool(std::vector<std::unique_ptr<autofill::PasswordForm>>*)); MOCK_METHOD1(FillBlacklistLogins,
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 01ab485..1bb3857e 100644 --- a/components/password_manager/core/browser/new_password_form_manager.cc +++ b/components/password_manager/core/browser/new_password_form_manager.cc
@@ -713,13 +713,12 @@ const PasswordStore::FormDigest& form_digest) : client_(client), metrics_recorder_(metrics_recorder), - owned_form_fetcher_( - form_fetcher ? nullptr - : std::make_unique<FormFetcherImpl>( - form_digest, - client_, - true /* should_migrate_http_passwords */, - true /* should_query_suppressed_https_forms */)), + owned_form_fetcher_(form_fetcher + ? nullptr + : std::make_unique<FormFetcherImpl>( + form_digest, + client_, + true /* should_migrate_http_passwords */)), form_fetcher_(form_fetcher ? form_fetcher : owned_form_fetcher_.get()), form_saver_(std::move(form_saver)), // TODO(https://crbug.com/831123): set correctly
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc index c316deb..a8fb6c0 100644 --- a/components/password_manager/core/browser/password_form_manager.cc +++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -123,13 +123,12 @@ observed_form.IsPossibleChangePasswordFormWithoutUsername()), client_(client), form_saver_(std::move(form_saver)), - owned_form_fetcher_( - form_fetcher ? nullptr - : std::make_unique<FormFetcherImpl>( - PasswordStore::FormDigest(observed_form), - client, - true /* should_migrate_http_passwords */, - true /* should_query_suppressed_https_forms */)), + owned_form_fetcher_(form_fetcher + ? nullptr + : std::make_unique<FormFetcherImpl>( + PasswordStore::FormDigest(observed_form), + client, + true /* should_migrate_http_passwords */)), form_fetcher_(form_fetcher ? form_fetcher : owned_form_fetcher_.get()), votes_uploader_(client, observed_form.IsPossibleChangePasswordForm()) { // Non-HTML forms should not need any interaction with the renderer, and hence @@ -162,10 +161,6 @@ PasswordFormManager::~PasswordFormManager() { form_fetcher_->RemoveConsumer(this); - - metrics_recorder_->RecordHistogramsOnSuppressedAccounts( - observed_form_.origin.SchemeIsCryptographic(), *form_fetcher_, - pending_credentials_); } // static
diff --git a/components/password_manager/core/browser/password_form_manager_unittest.cc b/components/password_manager/core/browser/password_form_manager_unittest.cc index f47e6211..9f3d248a 100644 --- a/components/password_manager/core/browser/password_form_manager_unittest.cc +++ b/components/password_manager/core/browser/password_form_manager_unittest.cc
@@ -3794,254 +3794,6 @@ form_manager.GrabFetcher(std::move(new_fetcher)); } -TEST_F(PasswordFormManagerTest, - SuppressedHTTPSFormsHistogram_NotRecordedIfStoreWasTooSlow) { - base::HistogramTester histogram_tester; - - fake_form_fetcher()->set_did_complete_querying_suppressed_forms(false); - fake_form_fetcher()->Fetch(); - std::unique_ptr<PasswordFormManager> form_manager = - std::make_unique<PasswordFormManager>( - password_manager(), client(), client()->driver(), *observed_form(), - std::make_unique<NiceMock<MockFormSaver>>(), fake_form_fetcher()); - form_manager->Init(nullptr); - fake_form_fetcher()->NotifyFetchCompleted(); - form_manager.reset(); - - histogram_tester.ExpectUniqueSample( - "PasswordManager.QueryingSuppressedAccountsFinished", false, 1); - const auto sample_counts = histogram_tester.GetTotalCountsForPrefix( - "PasswordManager.SuppressedAccount."); - EXPECT_THAT(sample_counts, IsEmpty()); -} - -TEST_F(PasswordFormManagerTest, SuppressedFormsHistograms) { - static constexpr const struct { - SuppressedFormType type; - const char* expected_histogram_suffix; - void (FakeFormFetcher::*suppressed_forms_setter_func)( - const std::vector<const autofill::PasswordForm*>&); - } kSuppressedFormTypeParams[] = { - {SuppressedFormType::HTTPS, "HTTPSNotHTTP", - &FakeFormFetcher::set_suppressed_https_forms}, - {SuppressedFormType::PSL_MATCH, "PSLMatching", - &FakeFormFetcher::set_suppressed_psl_matching_forms}, - {SuppressedFormType::SAME_ORGANIZATION_NAME, "SameOrganizationName", - &FakeFormFetcher::set_suppressed_same_organization_name_forms}}; - - struct SuppressedFormData { - const char* username_value; - const char* password_value; - PasswordForm::Type manual_or_generated; - }; - - static constexpr const char kUsernameAlpha[] = "user-alpha@gmail.com"; - static constexpr const char kPasswordAlpha[] = "password-alpha"; - static constexpr const char kUsernameBeta[] = "user-beta@gmail.com"; - static constexpr const char kPasswordBeta[] = "password-beta"; - - static constexpr const SuppressedFormData kSuppressedGeneratedForm = { - kUsernameAlpha, kPasswordAlpha, PasswordForm::TYPE_GENERATED}; - static constexpr const SuppressedFormData kOtherSuppressedGeneratedForm = { - kUsernameBeta, kPasswordBeta, PasswordForm::TYPE_GENERATED}; - static constexpr const SuppressedFormData kSuppressedManualForm = { - kUsernameAlpha, kPasswordBeta, PasswordForm::TYPE_MANUAL}; - - const std::vector<const SuppressedFormData*> kSuppressedFormsNone; - const std::vector<const SuppressedFormData*> kSuppressedFormsOneGenerated = { - &kSuppressedGeneratedForm}; - const std::vector<const SuppressedFormData*> kSuppressedFormsTwoGenerated = { - &kSuppressedGeneratedForm, &kOtherSuppressedGeneratedForm}; - const std::vector<const SuppressedFormData*> kSuppressedFormsOneManual = { - &kSuppressedManualForm}; - const std::vector<const SuppressedFormData*> kSuppressedFormsTwoMixed = { - &kSuppressedGeneratedForm, &kSuppressedManualForm}; - - const struct { - std::vector<const SuppressedFormData*> simulated_suppressed_forms; - SimulatedManagerAction simulate_manager_action; - SimulatedSubmitResult simulate_submit_result; - const char* filled_username; - const char* filled_password; - int expected_histogram_sample_generated; - int expected_histogram_sample_manual; - const char* submitted_password; // nullptr if same as |filled_password|. - } kTestCases[] = { - // See PasswordManagerSuppressedAccountCrossActionsTaken in enums.xml. - // - // Legend: (SuppressAccountType, SubmitResult, SimulatedManagerAction, - // UserAction) - // 24 = (None, Passed, None, OverrideUsernameAndPassword) - {kSuppressedFormsNone, SimulatedManagerAction::NONE, - SimulatedSubmitResult::PASSED, kUsernameAlpha, kPasswordAlpha, 24, 24}, - // 5 = (None, NotSubmitted, Autofilled, None) - {kSuppressedFormsNone, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::NONE, kUsernameAlpha, kPasswordAlpha, 5, 5}, - // 15 = (None, Failed, Autofilled, None) - {kSuppressedFormsNone, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::FAILED, kUsernameAlpha, kPasswordAlpha, 15, 15}, - - // 35 = (Exists, NotSubmitted, Autofilled, None) - {kSuppressedFormsOneGenerated, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::NONE, kUsernameAlpha, kPasswordAlpha, 35, 5}, - // 145 = (ExistsSameUsernameAndPassword, Passed, Autofilled, None) - // 25 = (None, Passed, Autofilled, None) - {kSuppressedFormsOneGenerated, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::PASSED, kUsernameAlpha, kPasswordAlpha, 145, 25}, - // 104 = (ExistsSameUsername, Failed, None, OverrideUsernameAndPassword) - // 14 = (None, Failed, None, OverrideUsernameAndPassword) - {kSuppressedFormsOneGenerated, SimulatedManagerAction::NONE, - SimulatedSubmitResult::FAILED, kUsernameAlpha, kPasswordBeta, 104, 14}, - // 84 = (ExistsDifferentUsername, Passed, None, - // OverrideUsernameAndPassword) - {kSuppressedFormsOneGenerated, SimulatedManagerAction::NONE, - SimulatedSubmitResult::PASSED, kUsernameBeta, kPasswordAlpha, 84, 24}, - - // 144 = (ExistsSameUsernameAndPassword, Passed, None, - // OverrideUsernameAndPassword) - {kSuppressedFormsOneManual, SimulatedManagerAction::NONE, - SimulatedSubmitResult::PASSED, kUsernameAlpha, kPasswordBeta, 24, 144}, - {kSuppressedFormsTwoMixed, SimulatedManagerAction::NONE, - SimulatedSubmitResult::PASSED, kUsernameBeta, kPasswordAlpha, 84, 84}, - - // 115 = (ExistsSameUsername, Passed, Autofilled, None) - {kSuppressedFormsTwoGenerated, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::PASSED, kUsernameAlpha, kPasswordAlpha, 145, 25}, - {kSuppressedFormsTwoGenerated, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::PASSED, kUsernameAlpha, kPasswordBeta, 115, 25}, - {kSuppressedFormsTwoGenerated, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::PASSED, kUsernameBeta, kPasswordAlpha, 115, 25}, - {kSuppressedFormsTwoGenerated, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::PASSED, kUsernameBeta, kPasswordBeta, 145, 25}, - - // 86 = (ExistsDifferentUsername, Passed, Autofilled, Choose) - // 26 = (None, Passed, Autofilled, Choose) - {kSuppressedFormsOneGenerated, SimulatedManagerAction::OFFERED, - SimulatedSubmitResult::PASSED, kUsernameBeta, kPasswordAlpha, 86, 26}, - // 72 = (ExistsDifferentUsername, Failed, None, ChoosePSL) - // 12 = (None, Failed, None, ChoosePSL) - {kSuppressedFormsOneGenerated, SimulatedManagerAction::OFFERED_PSL, - SimulatedSubmitResult::FAILED, kUsernameBeta, kPasswordAlpha, 72, 12}, - // 148 = (ExistsSameUsernameAndPassword, Passed, Autofilled, - // OverridePassword) - // 28 = (None, Passed, Autofilled, OverridePassword) - {kSuppressedFormsTwoGenerated, SimulatedManagerAction::AUTOFILLED, - SimulatedSubmitResult::PASSED, kUsernameBeta, kPasswordAlpha, 148, 28, - kPasswordBeta}, - }; - - for (const auto& suppression_params : kSuppressedFormTypeParams) { - for (const auto& test_case : kTestCases) { - SCOPED_TRACE(suppression_params.expected_histogram_suffix); - SCOPED_TRACE(test_case.expected_histogram_sample_manual); - SCOPED_TRACE(test_case.expected_histogram_sample_generated); - - base::HistogramTester histogram_tester; - ukm::TestAutoSetUkmRecorder test_ukm_recorder; - - std::vector<PasswordForm> suppressed_forms; - for (const auto* form_data : test_case.simulated_suppressed_forms) { - suppressed_forms.push_back(CreateSuppressedForm( - suppression_params.type, form_data->username_value, - form_data->password_value, form_data->manual_or_generated)); - } - - std::vector<const PasswordForm*> suppressed_forms_ptrs; - for (const auto& form : suppressed_forms) - suppressed_forms_ptrs.push_back(&form); - - FakeFormFetcher fetcher; - fetcher.set_did_complete_querying_suppressed_forms(true); - - (&fetcher->*suppression_params.suppressed_forms_setter_func)( - suppressed_forms_ptrs); - - SimulateActionsOnHTTPObservedForm( - &fetcher, test_case.simulate_manager_action, - test_case.simulate_submit_result, test_case.filled_username, - test_case.filled_password, test_case.submitted_password); - - histogram_tester.ExpectUniqueSample( - "PasswordManager.QueryingSuppressedAccountsFinished", true, 1); - - EXPECT_THAT( - histogram_tester.GetAllSamples( - "PasswordManager.SuppressedAccount.Generated." + - std::string(suppression_params.expected_histogram_suffix)), - ::testing::ElementsAre( - base::Bucket(test_case.expected_histogram_sample_generated, 1))); - EXPECT_THAT( - histogram_tester.GetAllSamples( - "PasswordManager.SuppressedAccount.Manual." + - std::string(suppression_params.expected_histogram_suffix)), - ::testing::ElementsAre( - base::Bucket(test_case.expected_histogram_sample_manual, 1))); - - auto entries = test_ukm_recorder.GetEntriesByName( - ukm::builders::PasswordForm::kEntryName); - EXPECT_EQ(1u, entries.size()); - for (const auto* const entry : entries) { - test_ukm_recorder.ExpectEntryMetric( - entry, - "SuppressedAccount.Generated." + - std::string(suppression_params.expected_histogram_suffix), - test_case.expected_histogram_sample_generated / - PasswordFormMetricsRecorder::kMaxNumActionsTakenNew); - test_ukm_recorder.ExpectEntryMetric( - entry, - "SuppressedAccount.Manual." + - std::string(suppression_params.expected_histogram_suffix), - test_case.expected_histogram_sample_manual / - PasswordFormMetricsRecorder::kMaxNumActionsTakenNew); - } - } - } -} - -// If the frame containing the login form is served over HTTPS, no histograms on -// supressed HTTPS forms should be recorded. Everything else should still be. -TEST_F(PasswordFormManagerTest, SuppressedHTTPSFormsHistogram_NotRecordedFor) { - base::HistogramTester histogram_tester; - - PasswordForm https_observed_form = *observed_form(); - https_observed_form.origin = GURL("https://accounts.google.com/a/LoginAuth"); - https_observed_form.signon_realm = "https://accounts.google.com/"; - - // Only the scheme of the frame containing the login form maters, not the - // scheme of the main frame. - ASSERT_FALSE(client()->IsMainFrameSecure()); - - // Even if there were any suppressed HTTPS forms, they should be are ignored - // (but there should be none in production in this case). - FakeFormFetcher fetcher; - fetcher.set_suppressed_https_forms({saved_match()}); - fetcher.set_did_complete_querying_suppressed_forms(true); - fetcher.Fetch(); - - std::unique_ptr<PasswordFormManager> form_manager = - std::make_unique<PasswordFormManager>( - password_manager(), client(), client()->driver(), https_observed_form, - std::make_unique<NiceMock<MockFormSaver>>(), &fetcher); - form_manager->Init(nullptr); - fetcher.NotifyFetchCompleted(); - form_manager.reset(); - - histogram_tester.ExpectUniqueSample( - "PasswordManager.QueryingSuppressedAccountsFinished", true, 1); - histogram_tester.ExpectTotalCount( - "PasswordManager.SuppressedAccount.Generated.HTTPSNotHTTP", 0); - histogram_tester.ExpectTotalCount( - "PasswordManager.SuppressedAccount.Manual.HTTPSNotHTTP", 0); - histogram_tester.ExpectTotalCount( - "PasswordManager.SuppressedAccount.Generated.PSLMatching", 1); - histogram_tester.ExpectTotalCount( - "PasswordManager.SuppressedAccount.Manual.PSLMatching", 1); - histogram_tester.ExpectTotalCount( - "PasswordManager.SuppressedAccount.Generated.SameOrganizationName", 1); - histogram_tester.ExpectTotalCount( - "PasswordManager.SuppressedAccount.Manual.SameOrganizationName", 1); -} - // Check that a cloned PasswordFormManager reacts correctly to Save. TEST_F(PasswordFormManagerTest, Clone_OnSave) { FakeFormFetcher fetcher;
diff --git a/components/password_manager/core/browser/password_form_metrics_recorder.cc b/components/password_manager/core/browser/password_form_metrics_recorder.cc index 858b8aa..a0334a00 100644 --- a/components/password_manager/core/browser/password_form_metrics_recorder.cc +++ b/components/password_manager/core/browser/password_form_metrics_recorder.cc
@@ -557,78 +557,6 @@ (manager_action_ + kManagerActionMax * submit_result_); } -void PasswordFormMetricsRecorder::RecordHistogramsOnSuppressedAccounts( - bool observed_form_origin_has_cryptographic_scheme, - const FormFetcher& form_fetcher, - const PasswordForm& pending_credentials) { - UMA_HISTOGRAM_BOOLEAN("PasswordManager.QueryingSuppressedAccountsFinished", - form_fetcher.DidCompleteQueryingSuppressedForms()); - - if (!form_fetcher.DidCompleteQueryingSuppressedForms()) - return; - - SuppressedAccountExistence best_match = kSuppressedAccountNone; - - if (!observed_form_origin_has_cryptographic_scheme) { - best_match = GetBestMatchingSuppressedAccount( - form_fetcher.GetSuppressedHTTPSForms(), PasswordForm::TYPE_GENERATED, - pending_credentials); - UMA_HISTOGRAM_ENUMERATION( - "PasswordManager.SuppressedAccount.Generated.HTTPSNotHTTP", - GetHistogramSampleForSuppressedAccounts(best_match), - kMaxSuppressedAccountStats); - ukm_entry_builder_.SetSuppressedAccount_Generated_HTTPSNotHTTP(best_match); - - best_match = GetBestMatchingSuppressedAccount( - form_fetcher.GetSuppressedHTTPSForms(), PasswordForm::TYPE_MANUAL, - pending_credentials); - UMA_HISTOGRAM_ENUMERATION( - "PasswordManager.SuppressedAccount.Manual.HTTPSNotHTTP", - GetHistogramSampleForSuppressedAccounts(best_match), - kMaxSuppressedAccountStats); - ukm_entry_builder_.SetSuppressedAccount_Manual_HTTPSNotHTTP(best_match); - } - - best_match = GetBestMatchingSuppressedAccount( - form_fetcher.GetSuppressedPSLMatchingForms(), - PasswordForm::TYPE_GENERATED, pending_credentials); - UMA_HISTOGRAM_ENUMERATION( - "PasswordManager.SuppressedAccount.Generated.PSLMatching", - GetHistogramSampleForSuppressedAccounts(best_match), - kMaxSuppressedAccountStats); - ukm_entry_builder_.SetSuppressedAccount_Generated_PSLMatching(best_match); - best_match = GetBestMatchingSuppressedAccount( - form_fetcher.GetSuppressedPSLMatchingForms(), PasswordForm::TYPE_MANUAL, - pending_credentials); - UMA_HISTOGRAM_ENUMERATION( - "PasswordManager.SuppressedAccount.Manual.PSLMatching", - GetHistogramSampleForSuppressedAccounts(best_match), - kMaxSuppressedAccountStats); - ukm_entry_builder_.SetSuppressedAccount_Manual_PSLMatching(best_match); - - best_match = GetBestMatchingSuppressedAccount( - form_fetcher.GetSuppressedSameOrganizationNameForms(), - PasswordForm::TYPE_GENERATED, pending_credentials); - UMA_HISTOGRAM_ENUMERATION( - "PasswordManager.SuppressedAccount.Generated.SameOrganizationName", - GetHistogramSampleForSuppressedAccounts(best_match), - kMaxSuppressedAccountStats); - ukm_entry_builder_.SetSuppressedAccount_Generated_SameOrganizationName( - best_match); - best_match = GetBestMatchingSuppressedAccount( - form_fetcher.GetSuppressedSameOrganizationNameForms(), - PasswordForm::TYPE_MANUAL, pending_credentials); - UMA_HISTOGRAM_ENUMERATION( - "PasswordManager.SuppressedAccount.Manual.SameOrganizationName", - GetHistogramSampleForSuppressedAccounts(best_match), - kMaxSuppressedAccountStats); - ukm_entry_builder_.SetSuppressedAccount_Manual_SameOrganizationName( - best_match); - - if (current_bubble_ != CurrentBubbleOfInterest::kNone) - RecordUIDismissalReason(metrics_util::NO_DIRECT_INTERACTION); -} - void PasswordFormMetricsRecorder::RecordPasswordBubbleShown( metrics_util::CredentialSourceType credential_source_type, metrics_util::UIDisplayDisposition display_disposition) { @@ -715,40 +643,4 @@ ukm_entry_builder_.SetManagerFill_Action(event); } -PasswordFormMetricsRecorder::SuppressedAccountExistence -PasswordFormMetricsRecorder::GetBestMatchingSuppressedAccount( - const std::vector<const PasswordForm*>& suppressed_forms, - PasswordForm::Type manual_or_generated, - const PasswordForm& pending_credentials) const { - SuppressedAccountExistence best_matching_account = kSuppressedAccountNone; - for (const PasswordForm* form : suppressed_forms) { - if (form->type != manual_or_generated) - continue; - - SuppressedAccountExistence current_account; - if (pending_credentials.password_value.empty()) - current_account = kSuppressedAccountExists; - else if (form->username_value != pending_credentials.username_value) - current_account = kSuppressedAccountExistsDifferentUsername; - else if (form->password_value != pending_credentials.password_value) - current_account = kSuppressedAccountExistsSameUsername; - else - current_account = kSuppressedAccountExistsSameUsernameAndPassword; - - best_matching_account = std::max(best_matching_account, current_account); - } - return best_matching_account; -} - -int PasswordFormMetricsRecorder::GetHistogramSampleForSuppressedAccounts( - SuppressedAccountExistence best_matching_account) const { - // Encoding: most significant digit is the |best_matching_account|. - int mixed_base_encoding = 0; - mixed_base_encoding += best_matching_account; - mixed_base_encoding *= PasswordFormMetricsRecorder::kMaxNumActionsTakenNew; - mixed_base_encoding += GetActionsTakenNew(); - DCHECK_LT(mixed_base_encoding, kMaxSuppressedAccountStats); - return mixed_base_encoding; -} - } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_form_metrics_recorder.h b/components/password_manager/core/browser/password_form_metrics_recorder.h index 3627d22..cdce846 100644 --- a/components/password_manager/core/browser/password_form_metrics_recorder.h +++ b/components/password_manager/core/browser/password_form_metrics_recorder.h
@@ -29,7 +29,6 @@ namespace password_manager { -class FormFetcher; struct InteractionsStats; // The pupose of this class is to record various types of metrics about the @@ -93,24 +92,6 @@ kManagerFillEventAutofilled }; - // Enumerates whether there were `suppressed` credentials. These are stored - // credentials that were not filled, even though they might be related to the - // observed form. See FormFetcher::GetSuppressed* for details. - // - // If suppressed credentials exist, it is also recorded whether their username - // and/or password matched those submitted. - enum SuppressedAccountExistence { - kSuppressedAccountNone, - // Recorded when there exists a suppressed account, but there was no - // submitted form to compare its username and password to. - kSuppressedAccountExists, - // Recorded when there was a submitted form. - kSuppressedAccountExistsDifferentUsername, - kSuppressedAccountExistsSameUsername, - kSuppressedAccountExistsSameUsernameAndPassword, - kSuppressedAccountExistenceMax, - }; - // What the form is used for. kSubmittedFormTypeUnspecified is only set before // the SetSubmittedFormType() is called, and should never be actually // uploaded. @@ -287,14 +268,6 @@ kManagerActionNewMax * static_cast<int>(UserAction::kMax) * kSubmitResultMax; - // The maximum number of combinations recorded into histograms in the - // PasswordManager.SuppressedAccount.* family. - static constexpr int kMaxSuppressedAccountStats = - kSuppressedAccountExistenceMax * - PasswordFormMetricsRecorder::kManagerActionNewMax * - static_cast<int>(UserAction::kMax) * - PasswordFormMetricsRecorder::kSubmitResultMax; - // Called if the user could generate a password for this form. void MarkGenerationAvailable(); @@ -342,16 +315,6 @@ // submission. void SetSubmissionIndicatorEvent(autofill::SubmissionIndicatorEvent event); - // Records all histograms in the PasswordManager.SuppressedAccount.* family. - // Takes the FormFetcher intance which owns the login data from PasswordStore. - // |pending_credentials| stores credentials when the form was submitted but - // success was still unknown. It contains credentials that are ready to be - // written (saved or updated) to a password store. - void RecordHistogramsOnSuppressedAccounts( - bool observed_form_origin_has_cryptographic_scheme, - const FormFetcher& form_fetcher, - const autofill::PasswordForm& pending_credentials); - // Records the event that a password bubble was shown. void RecordPasswordBubbleShown( metrics_util::CredentialSourceType credential_source_type, @@ -441,29 +404,6 @@ // UMA. int GetActionsTaken() const; - // When supplied with the list of all |suppressed_forms| that belong to - // certain suppressed credential type (see FormFetcher::GetSuppressed*), - // filters that list down to forms whose type matches |manual_or_generated|, - // and selects the suppressed account that matches |pending_credentials| most - // closely. |pending_credentials| stores credentials when the form was - // submitted but success was still unknown. It contains credentials that are - // ready to be written (saved or updated) to a password store. - SuppressedAccountExistence GetBestMatchingSuppressedAccount( - const std::vector<const autofill::PasswordForm*>& suppressed_forms, - autofill::PasswordForm::Type manual_or_generated, - const autofill::PasswordForm& pending_credentials) const; - - // Encodes a UMA histogram sample for |best_matching_account| and - // GetActionsTakenNew(). This is a mixed-based representation of a combination - // of four attributes: - // -- whether there were suppressed credentials (and if so, their relation to - // the submitted username/password). - // -- whether the |observed_form_| got ultimately submitted - // -- what action the password manager performed (|manager_action_|), - // -- and what action the user performed (|user_action_|_). - int GetHistogramSampleForSuppressedAccounts( - SuppressedAccountExistence best_matching_account) const; - // True if the main frame's visible URL, at the time this PasswordFormManager // was created, is secure. const bool is_main_frame_secure_;
diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc index 4bd2f56..27304f9 100644 --- a/components/password_manager/core/browser/password_manager_unittest.cc +++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -241,8 +241,6 @@ void SetUp() override { store_ = new testing::StrictMock<MockPasswordStore>; EXPECT_CALL(*store_, ReportMetrics(_, _, _)).Times(AnyNumber()); - EXPECT_CALL(*store_, GetLoginsForSameOrganizationName(_, _)) - .Times(AnyNumber()); CHECK(store_->Init(syncer::SyncableService::StartSyncFlare(), nullptr)); ON_CALL(client_, GetPasswordStore()).WillByDefault(Return(store_.get())); @@ -2206,12 +2204,10 @@ if (found_matched_logins_in_store) { EXPECT_CALL(*store_, GetLogins(_, _)) .WillRepeatedly(WithArg<1>(InvokeConsumer(form))); - EXPECT_CALL(*store_, GetLoginsForSameOrganizationName(_, _)); EXPECT_CALL(driver_, FillPasswordForm(_)).Times(2); } else { EXPECT_CALL(*store_, GetLogins(_, _)) .WillRepeatedly(WithArg<1>(InvokeEmptyConsumerWithForms())); - EXPECT_CALL(*store_, GetLoginsForSameOrganizationName(_, _)); } std::unique_ptr<PasswordFormManagerForUI> form_manager; if (found_matched_logins_in_store) {
diff --git a/components/password_manager/core/browser/password_store.cc b/components/password_manager/core/browser/password_store.cc index 2cc35f3..1494ae963 100644 --- a/components/password_manager/core/browser/password_store.cc +++ b/components/password_manager/core/browser/password_store.cc
@@ -35,6 +35,7 @@ #include "components/sync/model_impl/proxy_model_type_controller_delegate.h" #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED) +#include "base/strings/string16.h" #include "components/password_manager/core/browser/password_store_signin_notifier.h" #include "components/safe_browsing/common/safe_browsing_prefs.h" #endif @@ -43,36 +44,26 @@ namespace password_manager { -PasswordStore::GetLoginsRequest::GetLoginsRequest( - PasswordStoreConsumer* consumer) - : consumer_weak_(consumer->GetWeakPtr()) { - origin_task_runner_ = base::SequencedTaskRunnerHandle::Get(); +namespace { + +// Utility function to simplify removing logins prior a given |cutoff| data. +// Runs |callback| with the result. +// +// TODO(http://crbug.com/121738): Remove this once filtering logins is no longer +// necessary. +void FilterLogins( + base::Time cutoff, + base::OnceCallback< + void(std::vector<std::unique_ptr<autofill::PasswordForm>>)> callback, + std::vector<std::unique_ptr<PasswordForm>> logins) { + base::EraseIf(logins, [cutoff](const auto& form) { + return form->date_created < cutoff; + }); + + std::move(callback).Run(std::move(logins)); } -PasswordStore::GetLoginsRequest::~GetLoginsRequest() { -} - -void PasswordStore::GetLoginsRequest::NotifyConsumerWithResults( - std::vector<std::unique_ptr<PasswordForm>> results) { - if (!ignore_logins_cutoff_.is_null()) { - base::EraseIf(results, - [this](const std::unique_ptr<PasswordForm>& credential) { - return (credential->date_created < ignore_logins_cutoff_); - }); - } - - origin_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&PasswordStoreConsumer::OnGetPasswordStoreResults, - consumer_weak_, std::move(results))); -} - -void PasswordStore::GetLoginsRequest::NotifyWithSiteStatistics( - std::vector<InteractionsStats> stats) { - origin_task_runner_->PostTask( - FROM_HERE, base::BindOnce(&PasswordStoreConsumer::OnGetSiteStatistics, - consumer_weak_, std::move(stats))); -} +} // namespace // TODO(crbug.com/706392): Fix password reuse detection for Android. #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED) @@ -227,69 +218,52 @@ // password manager, but we won't use them to autofill any forms. This is a // security feature to help minimize damage that can be done by XSS attacks. // TODO(mdm): actually delete them at some point, say M24 or so. - base::Time ignore_logins_cutoff; // the null time + base::Time cutoff; // the null time if (form.scheme == PasswordForm::SCHEME_HTML && (form.signon_realm == "http://www.google.com" || form.signon_realm == "http://www.google.com/" || form.signon_realm == "https://www.google.com" || form.signon_realm == "https://www.google.com/")) { - static const base::Time::Exploded exploded_cutoff = - { 2012, 1, 0, 1, 0, 0, 0, 0 }; // 00:00 Jan 1 2012 + static const base::Time::Exploded exploded_cutoff = { + 2012, 1, 0, 1, 0, 0, 0, 0}; // 00:00 Jan 1 2012 base::Time out_time; bool conversion_success = base::Time::FromUTCExploded(exploded_cutoff, &out_time); DCHECK(conversion_success); - ignore_logins_cutoff = out_time; + cutoff = out_time; } - std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer)); - request->set_ignore_logins_cutoff(ignore_logins_cutoff); if (affiliated_match_helper_) { affiliated_match_helper_->GetAffiliatedAndroidRealms( - form, base::Bind(&PasswordStore::ScheduleGetLoginsWithAffiliations, - this, form, base::Passed(&request))); - } else { - ScheduleTask(base::BindOnce(&PasswordStore::GetLoginsImpl, this, form, - base::Passed(&request))); + form, base::BindOnce( + &PasswordStore::ScheduleGetFilteredLoginsWithAffiliations, + this, consumer->GetWeakPtr(), form, cutoff)); + } + + else { + PostLoginsTaskAndReplyToConsumerWithProcessedResult( + consumer, base::BindOnce(&PasswordStore::GetLoginsImpl, this, form), + base::BindOnce(FilterLogins, cutoff)); } } -void PasswordStore::GetLoginsForSameOrganizationName( - const std::string& signon_realm, - PasswordStoreConsumer* consumer) { - std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer)); - ScheduleTask( - base::BindOnce(&PasswordStore::GetLoginsForSameOrganizationNameImpl, this, - signon_realm, base::Passed(&request))); -} - void PasswordStore::GetAutofillableLogins(PasswordStoreConsumer* consumer) { - Schedule(&PasswordStore::GetAutofillableLoginsImpl, consumer); + PostLoginsTaskAndReplyToConsumerWithResult( + consumer, + base::BindOnce(&PasswordStore::GetAutofillableLoginsImpl, this)); } -void PasswordStore::GetAutofillableLoginsWithAffiliationAndBrandingInformation( - PasswordStoreConsumer* consumer) { - Schedule(&PasswordStore:: - GetAutofillableLoginsWithAffiliationAndBrandingInformationImpl, - consumer); -} - -void PasswordStore::GetBlacklistLogins(PasswordStoreConsumer* consumer) { - Schedule(&PasswordStore::GetBlacklistLoginsImpl, consumer); -} - -void PasswordStore::GetBlacklistLoginsWithAffiliationAndBrandingInformation( - PasswordStoreConsumer* consumer) { - Schedule(&PasswordStore:: - GetBlacklistLoginsWithAffiliationAndBrandingInformationImpl, - consumer); +void PasswordStore::GetAllLogins(PasswordStoreConsumer* consumer) { + PostLoginsTaskAndReplyToConsumerWithResult( + consumer, base::BindOnce(&PasswordStore::GetAllLoginsImpl, this)); } void PasswordStore::GetAllLoginsWithAffiliationAndBrandingInformation( PasswordStoreConsumer* consumer) { - Schedule( - &PasswordStore::GetAllLoginsWithAffiliationAndBrandingInformationImpl, - consumer); + PostLoginsTaskAndReplyToConsumerWithProcessedResult( + consumer, base::BindOnce(&PasswordStore::GetAllLoginsImpl, this), + base::BindOnce(&PasswordStore::InjectAffiliationAndBrandingInformation, + this)); } void PasswordStore::ReportMetrics(const std::string& sync_username, @@ -326,16 +300,15 @@ } void PasswordStore::GetAllSiteStats(PasswordStoreConsumer* consumer) { - std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer)); - ScheduleTask(base::BindOnce(&PasswordStore::NotifyAllSiteStats, this, - base::Passed(&request))); + PostStatsTaskAndReplyToConsumerWithResult( + consumer, base::BindOnce(&PasswordStore::GetAllSiteStatsImpl, this)); } void PasswordStore::GetSiteStats(const GURL& origin_domain, PasswordStoreConsumer* consumer) { - std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer)); - ScheduleTask(base::BindOnce(&PasswordStore::NotifySiteStats, this, - origin_domain, base::Passed(&request))); + PostStatsTaskAndReplyToConsumerWithResult( + consumer, + base::BindOnce(&PasswordStore::GetSiteStatsImpl, this, origin_domain)); } void PasswordStore::AddObserver(Observer* observer) { @@ -524,19 +497,16 @@ // TODO(crbug.com/706392): Fix password reuse detection for Android. #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED) reuse_detector_ = new PasswordReuseDetector; - GetAutofillableLoginsImpl( - std::make_unique<GetLoginsRequest>(reuse_detector_)); + + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&PasswordStoreConsumer::OnGetPasswordStoreResults, + reuse_detector_->GetWeakPtr(), + GetAutofillableLoginsImpl())); #endif return true; } -void PasswordStore::GetLoginsImpl(const FormDigest& form, - std::unique_ptr<GetLoginsRequest> request) { - SCOPED_UMA_HISTOGRAM_TIMER("PasswordManager.StorePerformance.GetLogins"); - request->NotifyConsumerWithResults(FillMatchingLogins(form)); -} - - void PasswordStore::LogStatsForBulkDeletion(int num_deletions) { UMA_HISTOGRAM_COUNTS_1M("PasswordManager.NumPasswordsDeletedByBulkDelete", num_deletions); @@ -662,13 +632,34 @@ UMA_HISTOGRAM_BOOLEAN("PasswordManager.PasswordStoreInitResult", success); } -void PasswordStore::Schedule( - void (PasswordStore::*func)(std::unique_ptr<GetLoginsRequest>), - PasswordStoreConsumer* consumer) { - std::unique_ptr<GetLoginsRequest> request(new GetLoginsRequest(consumer)); - consumer->cancelable_task_tracker()->PostTask( - background_task_runner_.get(), FROM_HERE, - base::BindOnce(func, this, std::move(request))); +void PasswordStore::PostLoginsTaskAndReplyToConsumerWithResult( + PasswordStoreConsumer* consumer, + LoginsTask task) { + consumer->cancelable_task_tracker()->PostTaskAndReplyWithResult( + background_task_runner_.get(), FROM_HERE, std::move(task), + base::BindOnce(&PasswordStoreConsumer::OnGetPasswordStoreResults, + consumer->GetWeakPtr())); +} + +void PasswordStore::PostLoginsTaskAndReplyToConsumerWithProcessedResult( + PasswordStoreConsumer* consumer, + LoginsTask task, + LoginsResultProcessor processor) { + consumer->cancelable_task_tracker()->PostTaskAndReplyWithResult( + background_task_runner_.get(), FROM_HERE, std::move(task), + base::BindOnce( + std::move(processor), + base::BindOnce(&PasswordStoreConsumer::OnGetPasswordStoreResults, + consumer->GetWeakPtr()))); +} + +void PasswordStore::PostStatsTaskAndReplyToConsumerWithResult( + PasswordStoreConsumer* consumer, + StatsTask task) { + consumer->cancelable_task_tracker()->PostTaskAndReplyWithResult( + background_task_runner_.get(), FROM_HERE, std::move(task), + base::BindOnce(&PasswordStoreConsumer::OnGetSiteStatistics, + consumer->GetWeakPtr())); } void PasswordStore::AddLoginInternal(const PasswordForm& form) { @@ -788,58 +779,24 @@ main_task_runner_->PostTask(FROM_HERE, completion); } -void PasswordStore::GetLoginsForSameOrganizationNameImpl( - const std::string& signon_realm, - std::unique_ptr<GetLoginsRequest> request) { - request->NotifyConsumerWithResults( - FillLoginsForSameOrganizationName(signon_realm)); +std::vector<std::unique_ptr<autofill::PasswordForm>> +PasswordStore::GetLoginsImpl(const FormDigest& form) { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); + SCOPED_UMA_HISTOGRAM_TIMER("PasswordManager.StorePerformance.GetLogins"); + return FillMatchingLogins(form); } -void PasswordStore::GetAutofillableLoginsImpl( - std::unique_ptr<GetLoginsRequest> request) { +std::vector<std::unique_ptr<PasswordForm>> +PasswordStore::GetAutofillableLoginsImpl() { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); std::vector<std::unique_ptr<PasswordForm>> obtained_forms; if (!FillAutofillableLogins(&obtained_forms)) obtained_forms.clear(); - request->NotifyConsumerWithResults(std::move(obtained_forms)); + return obtained_forms; } -void PasswordStore:: - GetAutofillableLoginsWithAffiliationAndBrandingInformationImpl( - std::unique_ptr<GetLoginsRequest> request) { - std::vector<std::unique_ptr<PasswordForm>> obtained_forms; - if (!FillAutofillableLogins(&obtained_forms)) - obtained_forms.clear(); - // Since AffiliatedMatchHelper's requests should be sent from UI thread, - // post a request to UI thread. - main_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&PasswordStore::InjectAffiliationAndBrandingInformation, - this, std::move(obtained_forms), std::move(request))); -} - -void PasswordStore::GetBlacklistLoginsImpl( - std::unique_ptr<GetLoginsRequest> request) { - std::vector<std::unique_ptr<PasswordForm>> obtained_forms; - if (!FillBlacklistLogins(&obtained_forms)) - obtained_forms.clear(); - request->NotifyConsumerWithResults(std::move(obtained_forms)); -} - -void PasswordStore::GetBlacklistLoginsWithAffiliationAndBrandingInformationImpl( - std::unique_ptr<GetLoginsRequest> request) { - std::vector<std::unique_ptr<PasswordForm>> obtained_forms; - if (!FillBlacklistLogins(&obtained_forms)) - obtained_forms.clear(); - // Since AffiliatedMatchHelper's requests should be sent from UI thread, - // post a request to UI thread. - main_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&PasswordStore::InjectAffiliationAndBrandingInformation, - this, std::move(obtained_forms), std::move(request))); -} - -void PasswordStore::GetAllLoginsWithAffiliationAndBrandingInformationImpl( - std::unique_ptr<GetLoginsRequest> request) { +std::vector<std::unique_ptr<PasswordForm>> PasswordStore::GetAllLoginsImpl() { + DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); std::vector<std::unique_ptr<PasswordForm>> results; for (auto fill_logins : {&PasswordStore::FillAutofillableLogins, &PasswordStore::FillBlacklistLogins}) { @@ -851,27 +808,12 @@ } } - // Since AffiliatedMatchHelper's requests should be sent from UI thread, - // post a request to UI thread. - main_task_runner_->PostTask( - FROM_HERE, - base::BindOnce(&PasswordStore::InjectAffiliationAndBrandingInformation, - this, std::move(results), std::move(request))); + return results; } -void PasswordStore::NotifyAllSiteStats( - std::unique_ptr<GetLoginsRequest> request) { - request->NotifyWithSiteStatistics(GetAllSiteStatsImpl()); -} - -void PasswordStore::NotifySiteStats(const GURL& origin_domain, - std::unique_ptr<GetLoginsRequest> request) { - request->NotifyWithSiteStatistics(GetSiteStatsImpl(origin_domain)); -} - -void PasswordStore::GetLoginsWithAffiliationsImpl( +std::vector<std::unique_ptr<PasswordForm>> +PasswordStore::GetLoginsWithAffiliationsImpl( const FormDigest& form, - std::unique_ptr<GetLoginsRequest> request, const std::vector<std::string>& additional_android_realms) { DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); std::vector<std::unique_ptr<PasswordForm>> results(FillMatchingLogins(form)); @@ -881,34 +823,36 @@ for (auto& result : more_results) result->is_affiliation_based_match = true; password_manager_util::TrimUsernameOnlyCredentials(&more_results); - const size_t results_count = results.size(); - results.resize(results_count + more_results.size()); - std::move(more_results.begin(), more_results.end(), - results.begin() + results_count); + results.insert(results.end(), std::make_move_iterator(more_results.begin()), + std::make_move_iterator(more_results.end())); } - request->NotifyConsumerWithResults(std::move(results)); + + return results; } void PasswordStore::InjectAffiliationAndBrandingInformation( - std::vector<std::unique_ptr<PasswordForm>> forms, - std::unique_ptr<GetLoginsRequest> request) { + LoginsReply callback, + LoginsResult forms) { if (affiliated_match_helper_) { affiliated_match_helper_->InjectAffiliationAndBrandingInformation( - std::move(forms), - base::Bind(&PasswordStore::GetLoginsRequest::NotifyConsumerWithResults, - base::Owned(request.release()))); + std::move(forms), std::move(callback)); } else { - request->NotifyConsumerWithResults(std::move(forms)); + std::move(callback).Run(std::move(forms)); } } -void PasswordStore::ScheduleGetLoginsWithAffiliations( - const FormDigest& form, - std::unique_ptr<GetLoginsRequest> request, +void PasswordStore::ScheduleGetFilteredLoginsWithAffiliations( + base::WeakPtr<PasswordStoreConsumer> consumer, + const PasswordStore::FormDigest& form, + base::Time cutoff, const std::vector<std::string>& additional_android_realms) { - ScheduleTask(base::Bind(&PasswordStore::GetLoginsWithAffiliationsImpl, this, - form, base::Passed(&request), - additional_android_realms)); + if (consumer) { + PostLoginsTaskAndReplyToConsumerWithProcessedResult( + consumer.get(), + base::BindOnce(&PasswordStore::GetLoginsWithAffiliationsImpl, this, + form, additional_android_realms), + base::BindOnce(FilterLogins, cutoff)); + } } std::unique_ptr<PasswordForm> PasswordStore::GetLoginImpl(
diff --git a/components/password_manager/core/browser/password_store.h b/components/password_manager/core/browser/password_store.h index 5aab1e9..4a937b16 100644 --- a/components/password_manager/core/browser/password_store.h +++ b/components/password_manager/core/browser/password_store.h
@@ -190,40 +190,15 @@ virtual void GetLogins(const FormDigest& form, PasswordStoreConsumer* consumer); - // Returns all stored credentials with SCHEME_HTTP that have a realm whose - // organization-identifying name -- that is, the first domain name label below - // the effective TLD -- matches that of |signon_realm|. Notifies |consumer| on - // completion. The request will be cancelled if the consumer is destroyed. - // - // WARNING: This is *NOT* PSL (Public Suffix List) matching. The logins - // returned by this method are not safe to be filled into the observed form. - // - // For example, the organization-identifying name of "https://foo.example.org" - // is `example`, and logins will be returned for "http://bar.example.co.uk", - // but not for "http://notexample.com" or "https://example.foo.com". - virtual void GetLoginsForSameOrganizationName( - const std::string& signon_realm, - PasswordStoreConsumer* consumer); - // Gets the complete list of PasswordForms that are not blacklist entries--and // are thus auto-fillable. |consumer| will be notified on completion. // The request will be cancelled if the consumer is destroyed. virtual void GetAutofillableLogins(PasswordStoreConsumer* consumer); - // Same as above, but also fills in affiliation and branding information for - // Android credentials. - virtual void GetAutofillableLoginsWithAffiliationAndBrandingInformation( - PasswordStoreConsumer* consumer); - - // Gets the complete list of PasswordForms that are blacklist entries, - // and notify |consumer| on completion. The request will be cancelled if the - // consumer is destroyed. - virtual void GetBlacklistLogins(PasswordStoreConsumer* consumer); - - // Same as above, but also fills in affiliation and branding information for - // Android credentials. - virtual void GetBlacklistLoginsWithAffiliationAndBrandingInformation( - PasswordStoreConsumer* consumer); + // Gets the complete list of PasswordForms (regardless of their blacklist + // status) and notify |consumer| on completion. The request will be cancelled + // if the consumer is destroyed. + virtual void GetAllLogins(PasswordStoreConsumer* consumer); // Gets the complete list of PasswordForms, regardless of their blacklist // status. Also fills in affiliation and branding information for Android @@ -332,36 +307,6 @@ typedef base::Callback<PasswordStoreChangeList(void)> ModificationTask; - // Represents a single GetLogins() request. Implements functionality to filter - // results and send them to the consumer on the consumer's message loop. - class GetLoginsRequest { - public: - explicit GetLoginsRequest(PasswordStoreConsumer* consumer); - ~GetLoginsRequest(); - - // Removes any credentials in |results| that were saved before the cutoff, - // then notifies the consumer with the remaining results. - // Note that if this method is not called before destruction, the consumer - // will not be notified. - void NotifyConsumerWithResults( - std::vector<std::unique_ptr<autofill::PasswordForm>> results); - - void NotifyWithSiteStatistics(std::vector<InteractionsStats> stats); - - void set_ignore_logins_cutoff(base::Time cutoff) { - ignore_logins_cutoff_ = cutoff; - } - - private: - // See GetLogins(). Logins older than this will be removed from the reply. - base::Time ignore_logins_cutoff_; - - scoped_refptr<base::SequencedTaskRunner> origin_task_runner_; - base::WeakPtr<PasswordStoreConsumer> consumer_weak_; - - DISALLOW_COPY_AND_ASSIGN(GetLoginsRequest); - }; - // TODO(crbug.com/706392): Fix password reuse detection for Android. #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED) // Represents a single CheckReuse() request. Implements functionality to @@ -444,15 +389,6 @@ virtual PasswordStoreChangeList DisableAutoSignInForOriginsImpl( const base::Callback<bool(const GURL&)>& origin_filter) = 0; - // Finds all PasswordForms with a signon_realm that is equal to, or is a - // PSL-match to that of |form|, and takes care of notifying the consumer with - // the results when done. - // Note: subclasses should implement FillMatchingLogins() instead. This needs - // to be virtual only because asynchronous behavior in PasswordStoreWin. - // TODO(engedy): Make this non-virtual once https://crbug.com/78830 is fixed. - virtual void GetLoginsImpl(const FormDigest& form, - std::unique_ptr<GetLoginsRequest> request); - // Synchronous implementation provided by subclasses to add the given login. virtual PasswordStoreChangeList AddLoginImpl( const autofill::PasswordForm& form) = 0; @@ -472,11 +408,6 @@ virtual std::vector<std::unique_ptr<autofill::PasswordForm>> FillMatchingLogins(const FormDigest& form) = 0; - // Finds and returns all organization-name-matching logins, or returns an - // empty list on error. - virtual std::vector<std::unique_ptr<autofill::PasswordForm>> - FillLoginsForSameOrganizationName(const std::string& signon_realm) = 0; - // Synchronous implementation for manipulating with statistics. virtual void AddSiteStatsImpl(const InteractionsStats& stats) = 0; virtual void RemoveSiteStatsImpl(const GURL& origin_domain) = 0; @@ -554,15 +485,41 @@ FRIEND_TEST_ALL_PREFIXES(PasswordStoreTest, UpdatePasswordsStoredForAffiliatedWebsites); + using LoginsResult = std::vector<std::unique_ptr<autofill::PasswordForm>>; + using LoginsTask = base::OnceCallback<LoginsResult()>; + using LoginsReply = base::OnceCallback<void(LoginsResult)>; + using LoginsResultProcessor = + base::OnceCallback<void(LoginsReply, LoginsResult)>; + + using StatsResult = std::vector<InteractionsStats>; + using StatsTask = base::OnceCallback<StatsResult()>; + // Called on the main thread after initialization is completed. // |success| is true if initialization was successful. Sets the // |init_status_|. void OnInitCompleted(bool success); - // Schedule the given |func| to be run in the PasswordStore's own sequence - // with responses delivered to |consumer| on the current sequence. - void Schedule(void (PasswordStore::*func)(std::unique_ptr<GetLoginsRequest>), - PasswordStoreConsumer* consumer); + // Schedules the given |task| to be run on the PasswordStore's TaskRunner. + // Invokes |consumer|->OnGetPasswordStoreResults() on the caller's thread with + // the result. + void PostLoginsTaskAndReplyToConsumerWithResult( + PasswordStoreConsumer* consumer, + LoginsTask task); + + // Schedules the given |task| to be run on the PasswordStore's TaskRunner. + // Invokes |consumer|->OnGetPasswordStoreResults() on the caller's thread with + // the result, after it was post-processed by |processor|. + void PostLoginsTaskAndReplyToConsumerWithProcessedResult( + PasswordStoreConsumer* consumer, + LoginsTask task, + LoginsResultProcessor processor); + + // Schedules the given |task| to be run on the PasswordStore's TaskRunner. + // Invokes |consumer|->OnGetSiteStatistics() on the caller's thread with the + // result. + void PostStatsTaskAndReplyToConsumerWithResult( + PasswordStoreConsumer* consumer, + StatsTask task); // The following methods notify observers that the password store may have // been modified via NotifyLoginsChanged(). Note that there is no guarantee @@ -592,39 +549,19 @@ const base::Callback<bool(const GURL&)>& origin_filter, const base::Closure& completion); - // Finds all logins organization-name-matching |signon_realm| and notifies the - // consumer. - void GetLoginsForSameOrganizationNameImpl( - const std::string& signon_realm, - std::unique_ptr<GetLoginsRequest> request); + // Finds all PasswordForms with a signon_realm that is equal to, or is a + // PSL-match to that of |form|, and takes care of notifying the consumer with + // the results when done. + // Note: subclasses should implement FillMatchingLogins() instead. + std::vector<std::unique_ptr<autofill::PasswordForm>> GetLoginsImpl( + const FormDigest& form); - // Finds all non-blacklist PasswordForms, and notifies the consumer. - void GetAutofillableLoginsImpl(std::unique_ptr<GetLoginsRequest> request); + // Finds all non-blacklist PasswordForms and returns the result. + std::vector<std::unique_ptr<autofill::PasswordForm>> + GetAutofillableLoginsImpl(); - // Same as above, but also fills in affiliation and branding information for - // Android credentials. - void GetAutofillableLoginsWithAffiliationAndBrandingInformationImpl( - std::unique_ptr<GetLoginsRequest> request); - - // Finds all blacklist PasswordForms, and notifies the consumer. - void GetBlacklistLoginsImpl(std::unique_ptr<GetLoginsRequest> request); - - // Same as above, but also fills in affiliation and branding information for - // Android credentials. - void GetBlacklistLoginsWithAffiliationAndBrandingInformationImpl( - std::unique_ptr<GetLoginsRequest> request); - - // Find all PasswordForms, fills in affiliation and branding information for - // Android credentials, and notifies the consumer. - void GetAllLoginsWithAffiliationAndBrandingInformationImpl( - std::unique_ptr<GetLoginsRequest> request); - - // Notifies |request| about the stats for all sites. - void NotifyAllSiteStats(std::unique_ptr<GetLoginsRequest> request); - - // Notifies |request| about the stats for |origin_domain|. - void NotifySiteStats(const GURL& origin_domain, - std::unique_ptr<GetLoginsRequest> request); + // Finds all PasswordForms and returns the result. + std::vector<std::unique_ptr<autofill::PasswordForm>> GetAllLoginsImpl(); // Extended version of GetLoginsImpl that also returns credentials stored for // the specified affiliated Android applications. That is, it finds all @@ -632,23 +569,25 @@ // * equal to that of |form|, // * is a PSL-match to the realm of |form|, // * is one of those in |additional_android_realms|, - // and takes care of notifying the consumer with the results when done. - void GetLoginsWithAffiliationsImpl( + // and returns the result. + std::vector<std::unique_ptr<autofill::PasswordForm>> + GetLoginsWithAffiliationsImpl( const FormDigest& form, - std::unique_ptr<GetLoginsRequest> request, const std::vector<std::string>& additional_android_realms); // Retrieves and fills in affiliation and branding information for Android - // credentials in |forms|. Called on the main sequence. - void InjectAffiliationAndBrandingInformation( - std::vector<std::unique_ptr<autofill::PasswordForm>> forms, - std::unique_ptr<GetLoginsRequest> request); + // credentials in |forms| and invokes |callback| with the result. Called on + // the main sequence. + void InjectAffiliationAndBrandingInformation(LoginsReply callback, + LoginsResult forms); // Schedules GetLoginsWithAffiliationsImpl() to be run on the background - // sequence. - void ScheduleGetLoginsWithAffiliations( - const FormDigest& form, - std::unique_ptr<GetLoginsRequest> request, + // sequence. Logins older than |cutoff| will be deleted before |consumer| is + // notified with the result. + void ScheduleGetFilteredLoginsWithAffiliations( + base::WeakPtr<PasswordStoreConsumer> consumer, + const PasswordStore::FormDigest& form, + base::Time cutoff, const std::vector<std::string>& additional_android_realms); // Retrieves the currently stored form, if any, with the same primary key as
diff --git a/components/password_manager/core/browser/password_store_default.cc b/components/password_manager/core/browser/password_store_default.cc index 961f67b5..ce3a705e 100644 --- a/components/password_manager/core/browser/password_store_default.cc +++ b/components/password_manager/core/browser/password_store_default.cc
@@ -173,16 +173,6 @@ return matched_forms; } -std::vector<std::unique_ptr<PasswordForm>> -PasswordStoreDefault::FillLoginsForSameOrganizationName( - const std::string& signon_realm) { - std::vector<std::unique_ptr<PasswordForm>> forms; - if (login_db_ && - !login_db_->GetLoginsForSameOrganizationName(signon_realm, &forms)) - return std::vector<std::unique_ptr<PasswordForm>>(); - return forms; -} - bool PasswordStoreDefault::FillAutofillableLogins( std::vector<std::unique_ptr<PasswordForm>>* forms) { DCHECK(background_task_runner()->RunsTasksInCurrentSequence());
diff --git a/components/password_manager/core/browser/password_store_default.h b/components/password_manager/core/browser/password_store_default.h index e3d7a92..6bfeff9 100644 --- a/components/password_manager/core/browser/password_store_default.h +++ b/components/password_manager/core/browser/password_store_default.h
@@ -71,8 +71,6 @@ base::Time delete_end) override; std::vector<std::unique_ptr<autofill::PasswordForm>> FillMatchingLogins( const FormDigest& form) override; - std::vector<std::unique_ptr<autofill::PasswordForm>> - FillLoginsForSameOrganizationName(const std::string& signon_realm) override; bool FillAutofillableLogins( std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) override; bool FillBlacklistLogins(
diff --git a/components/password_manager/core/browser/password_store_default_unittest.cc b/components/password_manager/core/browser/password_store_default_unittest.cc index 7323fe8..6d94b7a 100644 --- a/components/password_manager/core/browser/password_store_default_unittest.cc +++ b/components/password_manager/core/browser/password_store_default_unittest.cc
@@ -276,7 +276,7 @@ delegate.FinishAsyncProcessing(); testing::Mock::VerifyAndClearExpectations(&mock_consumer); EXPECT_CALL(mock_consumer, OnGetPasswordStoreResultsConstRef(IsEmpty())); - bad_store->GetBlacklistLogins(&mock_consumer); + bad_store->GetAllLogins(&mock_consumer); delegate.FinishAsyncProcessing(); testing::Mock::VerifyAndClearExpectations(&mock_consumer);
diff --git a/components/password_manager/core/browser/password_store_unittest.cc b/components/password_manager/core/browser/password_store_unittest.cc index 67cd326c..e344680 100644 --- a/components/password_manager/core/browser/password_store_unittest.cc +++ b/components/password_manager/core/browser/password_store_unittest.cc
@@ -55,10 +55,6 @@ "https://psl.example.com/origin"; constexpr const char kTestUnrelatedWebRealm[] = "https://notexample.com/"; constexpr const char kTestUnrelatedWebOrigin[] = "https:/notexample.com/origin"; -constexpr const char kTestSameOrganizationNameWebRealm[] = - "https://example.appspot.com/"; -constexpr const char kTestSameOrganizationNameWebOrigin[] = - "https://example.appspot.com/origin"; constexpr const char kTestInsecureWebRealm[] = "http://one.example.com/"; constexpr const char kTestInsecureWebOrigin[] = "http://one.example.com/origin"; constexpr const char kTestAndroidRealm1[] = @@ -745,8 +741,8 @@ } } -TEST_F(PasswordStoreTest, GetLoginsWithAffiliationAndBrandingInformation) { - static const PasswordFormData kTestCredentials[] = { +TEST_F(PasswordStoreTest, GetAllLogins) { + static constexpr PasswordFormData kTestCredentials[] = { {PasswordForm::SCHEME_HTML, kTestAndroidRealm1, "", "", L"", L"", L"", L"username_value_1", L"", true, 1}, {PasswordForm::SCHEME_HTML, kTestAndroidRealm2, "", "", L"", L"", L"", @@ -754,68 +750,35 @@ {PasswordForm::SCHEME_HTML, kTestAndroidRealm3, "", "", L"", L"", L"", L"username_value_3", L"", true, 1}, {PasswordForm::SCHEME_HTML, kTestWebRealm1, kTestWebOrigin1, "", L"", L"", - L"", L"username_value_4", L"", true, 1}}; + L"", L"username_value_4", L"", true, 1}, + // A PasswordFormData with nullptr as the username_value will be converted + // in a blacklisted PasswordForm in FillPasswordFormWithData(). + {PasswordForm::SCHEME_HTML, kTestWebRealm2, kTestWebOrigin2, "", L"", L"", + L"", nullptr, L"", true, 1}, + {PasswordForm::SCHEME_HTML, kTestWebRealm3, kTestWebOrigin3, "", L"", L"", + L"", nullptr, L"", true, 1}}; - for (bool blacklisted : {false, true}) { - SCOPED_TRACE(testing::Message("use blacklisted logins: ") << blacklisted); - scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault( - std::make_unique<LoginDatabase>(test_login_db_file_path()))); - store->Init(syncer::SyncableService::StartSyncFlare(), nullptr); - store->RemoveLoginsCreatedBetween(base::Time(), base::Time::Max(), - base::Closure()); + auto store = base::MakeRefCounted<PasswordStoreDefault>( + std::make_unique<LoginDatabase>(test_login_db_file_path())); + store->Init(syncer::SyncableService::StartSyncFlare(), nullptr); - std::vector<std::unique_ptr<PasswordForm>> all_credentials; - for (const auto& test_credential : kTestCredentials) { - all_credentials.push_back(FillPasswordFormWithData(test_credential)); - all_credentials.back()->blacklisted_by_user = blacklisted; - store->AddLogin(*all_credentials.back()); - } - - MockPasswordStoreConsumer mock_consumer; - std::vector<std::unique_ptr<PasswordForm>> expected_results; - for (const auto& credential : all_credentials) - expected_results.push_back(std::make_unique<PasswordForm>(*credential)); - - std::vector<MockAffiliatedMatchHelper::AffiliationAndBrandingInformation> - affiliation_info_for_results = { - {kTestWebRealm1, kTestAndroidName1, GURL(kTestAndroidIconURL1)}, - {kTestWebRealm2, kTestAndroidName2, GURL(kTestAndroidIconURL2)}, - {/* Pretend affiliation or branding info is unavailable. */}, - {/* Pretend affiliation or branding info is unavailable. */}}; - - auto mock_helper = std::make_unique<MockAffiliatedMatchHelper>(); - mock_helper->ExpectCallToInjectAffiliationAndBrandingInformation( - affiliation_info_for_results); - store->SetAffiliatedMatchHelper(std::move(mock_helper)); - for (size_t i = 0; i < expected_results.size(); ++i) { - expected_results[i]->affiliated_web_realm = - affiliation_info_for_results[i].affiliated_web_realm; - expected_results[i]->app_display_name = - affiliation_info_for_results[i].app_display_name; - expected_results[i]->app_icon_url = - affiliation_info_for_results[i].app_icon_url; - } - - EXPECT_CALL(mock_consumer, - OnGetPasswordStoreResultsConstRef( - UnorderedPasswordFormElementsAre(&expected_results))); - if (blacklisted) { - store->GetBlacklistLoginsWithAffiliationAndBrandingInformation( - &mock_consumer); - } else { - store->GetAutofillableLoginsWithAffiliationAndBrandingInformation( - &mock_consumer); - } - - // Since GetAutofillableLoginsWithAffiliationAndBrandingInformation - // schedules a request for affiliation information to UI thread, don't - // shutdown UI thread until there are no tasks in the UI queue. - WaitForPasswordStore(); - store->ShutdownOnUIThread(); - store = nullptr; - // Finish processing so that the database isn't locked next iteration. - WaitForPasswordStore(); + std::vector<std::unique_ptr<PasswordForm>> all_credentials; + for (const auto& test_credential : kTestCredentials) { + all_credentials.push_back(FillPasswordFormWithData(test_credential)); + store->AddLogin(*all_credentials.back()); } + + MockPasswordStoreConsumer mock_consumer; + std::vector<std::unique_ptr<PasswordForm>> expected_results; + for (const auto& credential : all_credentials) + expected_results.push_back(std::make_unique<PasswordForm>(*credential)); + + EXPECT_CALL(mock_consumer, + OnGetPasswordStoreResultsConstRef( + UnorderedPasswordFormElementsAre(&expected_results))); + store->GetAllLogins(&mock_consumer); + WaitForPasswordStore(); + store->ShutdownOnUIThread(); } TEST_F(PasswordStoreTest, GetAllLoginsWithAffiliationAndBrandingInformation) { @@ -884,59 +847,6 @@ store->ShutdownOnUIThread(); } -TEST_F(PasswordStoreTest, GetLoginsForSameOrganizationName) { - static constexpr const PasswordFormData kSameOrganizationCredentials[] = { - // Credential that is an exact match of the observed form. - {PasswordForm::SCHEME_HTML, kTestWebRealm1, kTestWebOrigin1, "", L"", L"", - L"", L"username_value_1", L"", true, 1}, - // Credential that is a PSL match of the observed form. - {PasswordForm::SCHEME_HTML, kTestPSLMatchingWebRealm, - kTestPSLMatchingWebOrigin, "", L"", L"", L"", L"username_value_2", L"", - true, 1}, - // Credential for the HTTP version of the observed form. (Should not be - // filled, but returned as part of same-organization-name matches). - {PasswordForm::SCHEME_HTML, kTestInsecureWebRealm, kTestInsecureWebOrigin, - "", L"", L"", L"", L"username_value_3", L"", true, 1}, - // Credential for a signon realm with a different TLD, but same - // organization identifying name. - {PasswordForm::SCHEME_HTML, kTestSameOrganizationNameWebRealm, - kTestSameOrganizationNameWebOrigin, "", L"", L"", L"", - L"username_value_4", L"", true, 1}, - }; - - static constexpr const PasswordFormData kNotSameOrganizationCredentials[] = { - // Unrelated Web credential. - {PasswordForm::SCHEME_HTML, kTestUnrelatedWebRealm, - kTestUnrelatedWebOrigin, "", L"", L"", L"", L"username_value_5", L"", - true, 1}, - // Credential for an affiliated Android application. - {PasswordForm::SCHEME_HTML, kTestAndroidRealm1, "", "", L"", L"", L"", - L"username_value_6", L"", true, 1}}; - - scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault( - std::make_unique<LoginDatabase>(test_login_db_file_path()))); - store->Init(syncer::SyncableService::StartSyncFlare(), nullptr); - - std::vector<std::unique_ptr<PasswordForm>> expected_results; - for (const auto& form_data : kSameOrganizationCredentials) { - expected_results.push_back(FillPasswordFormWithData(form_data)); - store->AddLogin(*expected_results.back()); - } - - for (const auto& form_data : kNotSameOrganizationCredentials) { - store->AddLogin(*FillPasswordFormWithData(form_data)); - } - - const std::string observed_form_realm = kTestWebRealm1; - MockPasswordStoreConsumer mock_consumer; - EXPECT_CALL(mock_consumer, - OnGetPasswordStoreResultsConstRef( - UnorderedPasswordFormElementsAre(&expected_results))); - store->GetLoginsForSameOrganizationName(observed_form_realm, &mock_consumer); - WaitForPasswordStore(); - store->ShutdownOnUIThread(); -} - #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED) TEST_F(PasswordStoreTest, CheckPasswordReuse) { static constexpr PasswordFormData kTestCredentials[] = {
diff --git a/components/password_manager/core/browser/suppressed_form_fetcher.cc b/components/password_manager/core/browser/suppressed_form_fetcher.cc deleted file mode 100644 index 1a52b089..0000000 --- a/components/password_manager/core/browser/suppressed_form_fetcher.cc +++ /dev/null
@@ -1,41 +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. - -#include "components/password_manager/core/browser/suppressed_form_fetcher.h" - -#include "base/logging.h" -#include "base/stl_util.h" -#include "components/password_manager/core/browser/password_manager_client.h" -#include "components/password_manager/core/browser/password_store.h" -#include "url/gurl.h" - -namespace password_manager { - -SuppressedFormFetcher::SuppressedFormFetcher( - const std::string& observed_signon_realm, - const PasswordManagerClient* client, - Consumer* consumer) - : client_(client), - consumer_(consumer), - observed_signon_realm_(observed_signon_realm) { - DCHECK(client_); - DCHECK(consumer_); - DCHECK(GURL(observed_signon_realm_).SchemeIsHTTPOrHTTPS()); - client_->GetPasswordStore()->GetLoginsForSameOrganizationName( - observed_signon_realm_, this); -} - -SuppressedFormFetcher::~SuppressedFormFetcher() = default; - -void SuppressedFormFetcher::OnGetPasswordStoreResults( - std::vector<std::unique_ptr<autofill::PasswordForm>> results) { - base::EraseIf(results, - [this](const std::unique_ptr<autofill::PasswordForm>& form) { - return form->signon_realm == observed_signon_realm_; - }); - - consumer_->ProcessSuppressedForms(std::move(results)); -} - -} // namespace password_manager
diff --git a/components/password_manager/core/browser/suppressed_form_fetcher.h b/components/password_manager/core/browser/suppressed_form_fetcher.h deleted file mode 100644 index 7f663494..0000000 --- a/components/password_manager/core/browser/suppressed_form_fetcher.h +++ /dev/null
@@ -1,62 +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. - -#ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SUPPRESSED_FORM_FETCHER_H_ -#define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SUPPRESSED_FORM_FETCHER_H_ - -#include <memory> -#include <vector> - -#include "base/gtest_prod_util.h" -#include "base/macros.h" -#include "components/autofill/core/common/password_form.h" -#include "components/password_manager/core/browser/password_store_consumer.h" - -namespace password_manager { - -class PasswordManagerClient; - -// Fetches credentials saved for the HTTPS counterpart of the given HTTP realm. -// -// Filling these HTTPS credentials into forms served over HTTP is obviously -// suppressed, the purpose of doing such a query is to collect metrics on how -// often this happens and inconveniences the user. -// -// This logic is implemented by this class, a separate PasswordStore consumer, -// to make it very sure that these credentials will not get mistakenly filled. -class SuppressedFormFetcher : public PasswordStoreConsumer { - public: - // Interface to be implemented by the consumer of this class. - class Consumer { - public: - virtual void ProcessSuppressedForms( - std::vector<std::unique_ptr<autofill::PasswordForm>> forms) = 0; - }; - - SuppressedFormFetcher(const std::string& observed_signon_realm, - const PasswordManagerClient* client, - Consumer* consumer); - ~SuppressedFormFetcher() override; - - protected: - // PasswordStoreConsumer: - void OnGetPasswordStoreResults( - std::vector<std::unique_ptr<autofill::PasswordForm>> results) override; - - private: - FRIEND_TEST_ALL_PREFIXES(SuppressedFormFetcherTest, EmptyStore); - FRIEND_TEST_ALL_PREFIXES(SuppressedFormFetcherTest, FullStore); - - // The client and the consumer should outlive |this|. - const PasswordManagerClient* client_; - Consumer* consumer_; - - const std::string observed_signon_realm_; - - DISALLOW_COPY_AND_ASSIGN(SuppressedFormFetcher); -}; - -} // namespace password_manager - -#endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_SUPPRESSED_FORM_FETCHER_H_
diff --git a/components/password_manager/core/browser/suppressed_form_fetcher_unittest.cc b/components/password_manager/core/browser/suppressed_form_fetcher_unittest.cc deleted file mode 100644 index 97d9f7e..0000000 --- a/components/password_manager/core/browser/suppressed_form_fetcher_unittest.cc +++ /dev/null
@@ -1,155 +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. - -#include "components/password_manager/core/browser/suppressed_form_fetcher.h" - -#include "base/macros.h" -#include "base/test/scoped_task_environment.h" -#include "components/password_manager/core/browser/mock_password_store.h" -#include "components/password_manager/core/browser/password_manager_test_utils.h" -#include "components/password_manager/core/browser/stub_password_manager_client.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace password_manager { -namespace { - -using autofill::PasswordForm; -using testing::_; - -constexpr const char kTestHttpURL[] = "http://one.example.com/"; -constexpr const char kTestHttpsURL[] = "https://one.example.com/"; -constexpr const char kTestPSLMatchingHttpURL[] = "http://psl.example.com/"; -constexpr const char kTestPSLMatchingHttpsURL[] = "https://psl.example.com/"; -constexpr const char kTestHttpSameOrgNameURL[] = "http://login.example.co.uk/"; -constexpr const char kTestHttpsSameOrgNameURL[] = - "https://login.example.co.uk/"; - -class MockConsumer : public SuppressedFormFetcher::Consumer { - public: - MockConsumer() = default; - ~MockConsumer() = default; - - // GMock still cannot mock methods with move-only args. - MOCK_METHOD1(ProcessSuppressedHTTPSFormsConstRef, - void(const std::vector<std::unique_ptr<PasswordForm>>&)); - - protected: - // SuppressedFormFetcher::Consumer: - void ProcessSuppressedForms( - std::vector<std::unique_ptr<PasswordForm>> forms) override { - ProcessSuppressedHTTPSFormsConstRef(forms); - } - - private: - DISALLOW_COPY_AND_ASSIGN(MockConsumer); -}; - -class PasswordManagerClientWithMockStore : public StubPasswordManagerClient { - public: - PasswordManagerClientWithMockStore() - : mock_store_(new ::testing::StrictMock<MockPasswordStore>()) {} - ~PasswordManagerClientWithMockStore() override { - mock_store_->ShutdownOnUIThread(); - } - - MockPasswordStore& mock_password_store() const { return *mock_store_; } - - protected: - // StubPasswordManagerClient: - PasswordStore* GetPasswordStore() const override { return mock_store_.get(); } - - private: - scoped_refptr<MockPasswordStore> mock_store_; - - DISALLOW_COPY_AND_ASSIGN(PasswordManagerClientWithMockStore); -}; - -} // namespace - -class SuppressedFormFetcherTest : public testing::Test { - public: - SuppressedFormFetcherTest() = default; - ~SuppressedFormFetcherTest() override = default; - - MockConsumer* mock_consumer() { return &consumer_; } - MockPasswordStore* mock_store() { return &client_.mock_password_store(); } - PasswordManagerClientWithMockStore* mock_client() { return &client_; } - - private: - base::test::ScopedTaskEnvironment - task_environment_; // Needed by the MockPasswordStore. - - MockConsumer consumer_; - PasswordManagerClientWithMockStore client_; - - DISALLOW_COPY_AND_ASSIGN(SuppressedFormFetcherTest); -}; - -TEST_F(SuppressedFormFetcherTest, EmptyStore) { - EXPECT_CALL(*mock_store(), GetLoginsForSameOrganizationName(kTestHttpURL, _)); - SuppressedFormFetcher suppressed_form_fetcher(kTestHttpURL, mock_client(), - mock_consumer()); - EXPECT_CALL(*mock_consumer(), - ProcessSuppressedHTTPSFormsConstRef(::testing::IsEmpty())); - suppressed_form_fetcher.OnGetPasswordStoreResults( - std::vector<std::unique_ptr<PasswordForm>>()); -} - -TEST_F(SuppressedFormFetcherTest, FullStore) { - static constexpr const PasswordFormData kSuppressedCredentials[] = { - // Credential that is for the HTTPS counterpart of the observed form. - {PasswordForm::SCHEME_HTML, kTestHttpsURL, kTestHttpsURL, "", L"", L"", - L"", L"username_value_1", L"password_value_1", true, 1}, - // Once again, but with a different username/password. - {PasswordForm::SCHEME_HTML, kTestHttpsURL, kTestHttpsURL, "", L"", L"", - L"", L"username_value_2", L"password_value_2", true, 1}, - // A PSL match to the observed form. - {PasswordForm::SCHEME_HTML, kTestPSLMatchingHttpURL, - kTestPSLMatchingHttpURL, "", L"", L"", L"", L"username_value_2", - L"password_value_2", true, 1}, - // A PSL match to the HTTPS counterpart of the observed form. Note that - // this is *not* a PSL match to the observed form, but a same organization - // name match. - {PasswordForm::SCHEME_HTML, kTestPSLMatchingHttpsURL, - kTestPSLMatchingHttpsURL, "", L"", L"", L"", L"username_value_3", - L"password_value_3", true, 1}, - // Credentials for a HTTP origin with the same organization - // identifying name. - {PasswordForm::SCHEME_HTML, kTestHttpSameOrgNameURL, - kTestHttpSameOrgNameURL, "", L"", L"", L"", L"username_value_4", - L"password_value_4", true, 1}, - // Credentials for a HTTPS origin with the same organization - // identifying name. - {PasswordForm::SCHEME_HTML, kTestHttpsSameOrgNameURL, - kTestHttpsSameOrgNameURL, "", L"", L"", L"", L"username_value_5", - L"password_value_5", true, 1}}; - - static const PasswordFormData kNotSuppressedCredentials[] = { - // Credential exactly matching the observed form. - {PasswordForm::SCHEME_HTML, kTestHttpURL, kTestHttpURL, "", L"", L"", L"", - L"username_value_1", L"password_value_1", true, 1}, - }; - - std::vector<std::unique_ptr<PasswordForm>> simulated_store_results; - std::vector<std::unique_ptr<PasswordForm>> expected_results; - for (const auto& form_data : kSuppressedCredentials) { - expected_results.push_back(FillPasswordFormWithData(form_data)); - simulated_store_results.push_back(FillPasswordFormWithData(form_data)); - } - for (const auto& form_data : kNotSuppressedCredentials) { - simulated_store_results.push_back(FillPasswordFormWithData(form_data)); - } - - EXPECT_CALL(*mock_store(), GetLoginsForSameOrganizationName(kTestHttpURL, _)); - SuppressedFormFetcher suppressed_form_fetcher(kTestHttpURL, mock_client(), - mock_consumer()); - EXPECT_CALL(*mock_consumer(), - ProcessSuppressedHTTPSFormsConstRef( - UnorderedPasswordFormElementsAre(&expected_results))); - suppressed_form_fetcher.OnGetPasswordStoreResults( - std::move(simulated_store_results)); -} - -} // namespace password_manager
diff --git a/components/password_manager/core/browser/test_password_store.cc b/components/password_manager/core/browser/test_password_store.cc index 80ba9bd0..654d5fee 100644 --- a/components/password_manager/core/browser/test_password_store.cc +++ b/components/password_manager/core/browser/test_password_store.cc
@@ -143,16 +143,6 @@ return DatabaseCleanupResult::kSuccess; } -std::vector<std::unique_ptr<autofill::PasswordForm>> -TestPasswordStore::FillLoginsForSameOrganizationName( - const std::string& signon_realm) { - // Note: To keep TestPasswordStore simple, and because no tests currently - // require anything more complex, this is a simplistic implementation which - // assumes that that the signon_realm is a serialised URL. - return FillMatchingLogins(FormDigest(autofill::PasswordForm::SCHEME_HTML, - signon_realm, GURL(signon_realm))); -} - std::vector<InteractionsStats> TestPasswordStore::GetSiteStatsImpl( const GURL& origin_domain) { return std::vector<InteractionsStats>();
diff --git a/components/password_manager/core/browser/test_password_store.h b/components/password_manager/core/browser/test_password_store.h index ba764c4..62107b98 100644 --- a/components/password_manager/core/browser/test_password_store.h +++ b/components/password_manager/core/browser/test_password_store.h
@@ -59,8 +59,6 @@ bool FillBlacklistLogins( std::vector<std::unique_ptr<autofill::PasswordForm>>* forms) override; DatabaseCleanupResult DeleteUndecryptableLogins() override; - std::vector<std::unique_ptr<autofill::PasswordForm>> - FillLoginsForSameOrganizationName(const std::string& signon_realm) override; std::vector<InteractionsStats> GetSiteStatsImpl( const GURL& origin_domain) override;
diff --git a/components/policy/core/common/BUILD.gn b/components/policy/core/common/BUILD.gn index 3e3b3ff..e6406071 100644 --- a/components/policy/core/common/BUILD.gn +++ b/components/policy/core/common/BUILD.gn
@@ -154,7 +154,6 @@ "//base:i18n", "//base/third_party/dynamic_annotations", "//components/account_id", - "//components/crash/core/common:crash_key", # Remove once https://crbug.com/685996 is fixed. "//components/data_use_measurement/core", "//components/prefs", "//components/strings",
diff --git a/components/policy/core/common/DEPS b/components/policy/core/common/DEPS index d64281e..601dffbe 100644 --- a/components/policy/core/common/DEPS +++ b/components/policy/core/common/DEPS
@@ -2,7 +2,6 @@ "+components/account_id", "-components/policy/core/browser", "+components/strings", - "+components/crash/core/common/crash_key.h", # Remove once https://crbug.com/685996 is fixed. "+components/data_use_measurement/core", "+extensions/buildflags", "+net/http",
diff --git a/components/policy/core/common/cloud/user_cloud_policy_manager.cc b/components/policy/core/common/cloud/user_cloud_policy_manager.cc index 11b50e09..10d8b77 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_manager.cc +++ b/components/policy/core/common/cloud/user_cloud_policy_manager.cc
@@ -12,7 +12,6 @@ #include "base/sequenced_task_runner.h" #include "build/build_config.h" #include "components/account_id/account_id.h" -#include "components/crash/core/common/crash_key.h" #include "components/policy/core/common/cloud/cloud_external_data_manager.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_service.h" @@ -57,16 +56,6 @@ void UserCloudPolicyManager::Connect( PrefService* local_state, std::unique_ptr<CloudPolicyClient> client) { - // TODO(emaxx): Remove the crash key after the crashes tracked at - // https://crbug.com/685996 are fixed. - if (core()->client()) { - static crash_reporter::CrashKeyString<1024> connect_callstack_key( - "user-cloud-policy-manager-connect-trace"); - crash_reporter::SetCrashKeyStringToStackTrace(&connect_callstack_key, - connect_callstack_); - } else { - connect_callstack_ = base::debug::StackTrace(); - } CHECK(!core()->client()); scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory =
diff --git a/components/policy/core/common/cloud/user_cloud_policy_manager.h b/components/policy/core/common/cloud/user_cloud_policy_manager.h index f781e24..d3c188b9 100644 --- a/components/policy/core/common/cloud/user_cloud_policy_manager.h +++ b/components/policy/core/common/cloud/user_cloud_policy_manager.h
@@ -8,7 +8,6 @@ #include <memory> #include "base/compiler_specific.h" -#include "base/debug/stack_trace.h" #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -90,11 +89,6 @@ // Manages external data referenced by policies. std::unique_ptr<CloudExternalDataManager> external_data_manager_; - // Stack trace of the previous Connect() method call. - // TODO(emaxx): Remove after the crashes tracked at https://crbug.com/685996 - // are fixed. - base::debug::StackTrace connect_callstack_; - DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager); };
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc index ecfc9b0..b4dd648 100644 --- a/components/search_engines/template_url_service.cc +++ b/components/search_engines/template_url_service.cc
@@ -888,6 +888,8 @@ } void TemplateURLService::WaitUntilReadyToSync(base::OnceClosure done) { + DCHECK(!on_loaded_callback_for_sync_); + // We force a load here to allow remote updates to be processed, without // waiting for the lazy load. Load();
diff --git a/components/security_interstitials/core/common/resources/interstitial_core.css b/components/security_interstitials/core/common/resources/interstitial_core.css index c0d75f2..a75a3c7 100644 --- a/components/security_interstitials/core/common/resources/interstitial_core.css +++ b/components/security_interstitials/core/common/resources/interstitial_core.css
@@ -14,6 +14,7 @@ --google-gray-500: rgb(154, 160, 166); --google-gray-600: rgb(128, 134, 139); --google-gray-700: rgb(95, 99, 104); + --google-gray-900: rgb(32, 33, 36); background-color: #fff; color: var(--google-gray-700); word-wrap: break-word;
diff --git a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc index dab1469..334c36b 100644 --- a/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc +++ b/components/subresource_filter/content/browser/content_subresource_filter_throttle_manager_unittest.cc
@@ -846,18 +846,18 @@ EXPECT_TRUE(throttle_manager()->IsFrameTaggedAsAdForTesting(subframe)); SimulateStartAndExpectResult(content::NavigationThrottle::PROCEED); - subframe = SimulateCommitAndExpectResult(content::NavigationThrottle::PROCEED); EXPECT_TRUE(subframe); - ExpectActivationSignalForFrame(subframe, true /* expect_activation */, true /* is_ad_subframe */); // A non-ad navigation for the same frame should be considered an ad // subframe as well. CreateTestNavigation(GURL("https://example.com/allowed2.html"), subframe); - SimulateCommitAndExpectResult(content::NavigationThrottle::PROCEED); + subframe = + SimulateCommitAndExpectResult(content::NavigationThrottle::PROCEED); + EXPECT_TRUE(subframe); ExpectActivationSignalForFrame(subframe, true /* expect_activation */, true /* is_ad_subframe */); }
diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn index 22da6fa..9abbe31 100644 --- a/components/sync/BUILD.gn +++ b/components/sync/BUILD.gn
@@ -49,6 +49,7 @@ "base/invalidation_interface.h", "base/logging.cc", "base/logging.h", + "base/model_type.cc", "base/model_type.h", "base/nigori.cc", "base/nigori.h", @@ -442,7 +443,6 @@ "model/sync_merge_result.cc", "model/sync_merge_result.h", "model/sync_metadata_store.h", - "model/syncable_service.cc", "model/syncable_service.h", "model/time.h", "model_impl/blocking_model_type_store_impl.cc", @@ -508,7 +508,6 @@ "syncable/metahandle_set.h", "syncable/model_neutral_mutable_entry.cc", "syncable/model_neutral_mutable_entry.h", - "syncable/model_type.cc", "syncable/mutable_entry.cc", "syncable/mutable_entry.h", "syncable/nigori_handler.cc", @@ -819,6 +818,8 @@ "driver/sync_client_mock.h", "driver/sync_user_settings_mock.cc", "driver/sync_user_settings_mock.h", + "driver/test_profile_sync_service.cc", + "driver/test_profile_sync_service.h", "driver/test_sync_service.cc", "driver/test_sync_service.h", "driver/test_sync_user_settings.cc",
diff --git a/components/sync/PRESUBMIT_test.py b/components/sync/PRESUBMIT_test.py index df563a0..f717bcbf 100755 --- a/components/sync/PRESUBMIT_test.py +++ b/components/sync/PRESUBMIT_test.py
@@ -164,7 +164,7 @@ mock_input_api.files = [ MockFile(os.path.abspath('./protocol/sync.proto'), MOCK_PROTOFILE_CONTENTS), - MockFile(os.path.abspath('./syncable/model_type.cc'), + MockFile(os.path.abspath('./base/model_type.cc'), MOCK_MODELTYPE_CONTENTS % (modeltype_literal)) ]
diff --git a/components/sync/syncable/model_type.cc b/components/sync/base/model_type.cc similarity index 98% rename from components/sync/syncable/model_type.cc rename to components/sync/base/model_type.cc index 5350b81a..2341a59a 100644 --- a/components/sync/syncable/model_type.cc +++ b/components/sync/base/model_type.cc
@@ -26,7 +26,6 @@ #include "components/sync/protocol/sync.pb.h" #include "components/sync/protocol/theme_specifics.pb.h" #include "components/sync/protocol/typed_url_specifics.pb.h" -#include "components/sync/syncable/syncable_proto_util.h" namespace syncer { @@ -339,8 +338,6 @@ // Note: keep this consistent with GetModelType in entry.cc! ModelType GetModelType(const sync_pb::SyncEntity& sync_entity) { - DCHECK(!IsRoot(sync_entity)); // Root shouldn't ever go over the wire. - ModelType specifics_type = GetModelTypeFromSpecifics(sync_entity.specifics()); if (specifics_type != UNSPECIFIED) return specifics_type; @@ -348,14 +345,14 @@ // Loose check for server-created top-level folders that aren't // bound to a particular model type. if (!sync_entity.server_defined_unique_tag().empty() && - IsFolder(sync_entity)) { + sync_entity.folder()) { return TOP_LEVEL_FOLDER; } // This is an item of a datatype we can't understand. Maybe it's // from the future? Either we mis-encoded the object, or the // server sent us entries it shouldn't have. - NOTREACHED() << "Unknown datatype in sync proto."; + DVLOG(1) << "Unknown datatype in sync proto."; return UNSPECIFIED; }
diff --git a/components/sync/driver/profile_sync_service.cc b/components/sync/driver/profile_sync_service.cc index 593bb12..c62c67f7 100644 --- a/components/sync/driver/profile_sync_service.cc +++ b/components/sync/driver/profile_sync_service.cc
@@ -47,12 +47,7 @@ #include "services/identity/public/cpp/primary_account_mutator.h" #include "services/network/public/cpp/shared_url_loader_factory.h" -using syncer::DataTypeController; -using syncer::DataTypeManager; -using syncer::EngineComponentsFactory; -using syncer::EngineComponentsFactoryImpl; - -namespace browser_sync { +namespace syncer { namespace { @@ -122,7 +117,7 @@ DataTypeController::TypeMap type_map; for (std::unique_ptr<DataTypeController>& controller : controllers) { DCHECK(controller); - syncer::ModelType type = controller->type(); + ModelType type = controller->type(); DCHECK_EQ(0U, type_map.count(type)); type_map[type] = std::move(controller); } @@ -139,7 +134,7 @@ : sync_client_(std::move(init_params.sync_client)), sync_prefs_(sync_client_->GetPrefService()), identity_manager_(init_params.identity_manager), - auth_manager_(std::make_unique<syncer::SyncAuthManager>( + auth_manager_(std::make_unique<SyncAuthManager>( identity_manager_, base::BindRepeating(&ProfileSyncService::AccountStateChanged, base::Unretained(this)), @@ -149,10 +144,10 @@ autofill_enable_account_wallet_storage_( init_params.autofill_enable_account_wallet_storage), sync_service_url_( - syncer::GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), - sync_client_->GetDeviceInfoSyncService() - ->GetLocalDeviceInfoProvider() - ->GetChannel())), + GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), + sync_client_->GetDeviceInfoSyncService() + ->GetLocalDeviceInfoProvider() + ->GetChannel())), crypto_( base::BindRepeating(&ProfileSyncService::NotifyObservers, base::Unretained(this)), @@ -170,8 +165,7 @@ expect_sync_configuration_aborted_(false), invalidations_identity_providers_( init_params.invalidations_identity_providers), - network_resources_( - std::make_unique<syncer::HttpBridgeNetworkResources>()), + network_resources_(std::make_unique<HttpBridgeNetworkResources>()), start_behavior_(init_params.start_behavior), passphrase_prompt_triggered_by_version_(false), is_stopping_and_clearing_(false), @@ -196,7 +190,7 @@ passphrase_prompt_triggered_by_version_ = true; } - startup_controller_ = std::make_unique<syncer::StartupController>( + startup_controller_ = std::make_unique<StartupController>( base::BindRepeating(&ProfileSyncService::GetPreferredDataTypes, base::Unretained(this)), base::BindRepeating(&ProfileSyncService::IsEngineAllowedToStart, @@ -204,12 +198,12 @@ base::BindRepeating(&ProfileSyncService::StartUpSlowEngineComponents, base::Unretained(this))); - sync_stopped_reporter_ = std::make_unique<syncer::SyncStoppedReporter>( + sync_stopped_reporter_ = std::make_unique<SyncStoppedReporter>( sync_service_url_, sync_client_->GetDeviceInfoSyncService() ->GetLocalDeviceInfoProvider() ->GetSyncUserAgent(), - url_loader_factory_, syncer::SyncStoppedReporter::ResultCallback()); + url_loader_factory_, SyncStoppedReporter::ResultCallback()); if (identity_manager_) identity_manager_->AddObserver(this); @@ -243,7 +237,7 @@ data_type_controllers_ = BuildDataTypeControllerMap(sync_client_->CreateDataTypeControllers(this)); - user_settings_ = std::make_unique<syncer::SyncUserSettingsImpl>( + user_settings_ = std::make_unique<SyncUserSettingsImpl>( &crypto_, &sync_prefs_, GetRegisteredDataTypes(), base::BindRepeating(&ProfileSyncService::SyncAllowedByPlatformChanged, base::Unretained(this)), @@ -299,13 +293,12 @@ engine_->StartSyncingWithServer(); if (IsLocalSyncEnabled()) { - TriggerRefresh( - syncer::Intersection(GetActiveDataTypes(), syncer::ProtocolTypes())); + TriggerRefresh(Intersection(GetActiveDataTypes(), ProtocolTypes())); } } bool ProfileSyncService::IsDataTypeControllerRunningForTest( - syncer::ModelType type) const { + ModelType type) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto iter = data_type_controllers_.find(type); if (iter == data_type_controllers_.end()) { @@ -314,22 +307,21 @@ return iter->second->state() == DataTypeController::RUNNING; } -syncer::WeakHandle<syncer::JsEventHandler> -ProfileSyncService::GetJsEventHandler() { - return syncer::MakeWeakHandle(sync_js_controller_.AsWeakPtr()); +WeakHandle<JsEventHandler> ProfileSyncService::GetJsEventHandler() { + return MakeWeakHandle(sync_js_controller_.AsWeakPtr()); } -syncer::SyncEngine::HttpPostProviderFactoryGetter +SyncEngine::HttpPostProviderFactoryGetter ProfileSyncService::MakeHttpPostProviderFactoryGetter() { - return base::BindOnce(&syncer::NetworkResources::GetHttpPostProviderFactory, + return base::BindOnce(&NetworkResources::GetHttpPostProviderFactory, base::Unretained(network_resources_.get()), url_loader_factory_->Clone(), network_time_update_callback_); } -syncer::WeakHandle<syncer::UnrecoverableErrorHandler> +WeakHandle<UnrecoverableErrorHandler> ProfileSyncService::GetUnrecoverableErrorHandler() { - return syncer::MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()); + return MakeWeakHandle(sync_enabled_weak_factory_.GetWeakPtr()); } void ProfileSyncService::AccountStateChanged() { @@ -366,7 +358,7 @@ startup_controller_->TryStart(/*force_immediate=*/true); } else { // If the engine already exists, just propagate the new credentials. - syncer::SyncCredentials credentials = auth_manager_->GetCredentials(); + SyncCredentials credentials = auth_manager_->GetCredentials(); if (credentials.sync_token.empty()) { engine_->InvalidateCredentials(); } else { @@ -386,45 +378,45 @@ return (GetDisableReasons() & kDisableReasonMask) == DISABLE_REASON_NONE; } -void ProfileSyncService::OnProtocolEvent(const syncer::ProtocolEvent& event) { +void ProfileSyncService::OnProtocolEvent(const ProtocolEvent& event) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (auto& observer : protocol_event_observers_) observer.OnProtocolEvent(event); } void ProfileSyncService::OnDirectoryTypeCommitCounterUpdated( - syncer::ModelType type, - const syncer::CommitCounters& counters) { + ModelType type, + const CommitCounters& counters) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (auto& observer : type_debug_info_observers_) observer.OnCommitCountersUpdated(type, counters); } void ProfileSyncService::OnDirectoryTypeUpdateCounterUpdated( - syncer::ModelType type, - const syncer::UpdateCounters& counters) { + ModelType type, + const UpdateCounters& counters) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (auto& observer : type_debug_info_observers_) observer.OnUpdateCountersUpdated(type, counters); } void ProfileSyncService::OnDatatypeStatusCounterUpdated( - syncer::ModelType type, - const syncer::StatusCounters& counters) { + ModelType type, + const StatusCounters& counters) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); for (auto& observer : type_debug_info_observers_) observer.OnStatusCountersUpdated(type, counters); } -void ProfileSyncService::OnDataTypeRequestsSyncStartup(syncer::ModelType type) { +void ProfileSyncService::OnDataTypeRequestsSyncStartup(ModelType type) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(syncer::UserTypes().Has(type)); + DCHECK(UserTypes().Has(type)); if (!GetPreferredDataTypes().Has(type)) { // We can get here as datatype SyncableServices are typically wired up // to the native datatype even if sync isn't enabled. DVLOG(1) << "Dropping sync startup request because type " - << syncer::ModelTypeToString(type) << "not enabled."; + << ModelTypeToString(type) << "not enabled."; return; } @@ -457,7 +449,7 @@ // Clear any old errors the first time sync starts. if (!user_settings_->IsFirstSetupComplete()) { - last_actionable_error_ = syncer::SyncProtocolError(); + last_actionable_error_ = SyncProtocolError(); } if (!sync_thread_) { @@ -468,12 +460,12 @@ DCHECK(success); } - syncer::SyncEngine::InitParams params; + SyncEngine::InitParams params; params.sync_task_runner = sync_thread_->task_runner(); params.host = this; - params.registrar = std::make_unique<syncer::SyncBackendRegistrar>( + params.registrar = std::make_unique<SyncBackendRegistrar>( debug_identifier_, - base::BindRepeating(&syncer::SyncClient::CreateModelWorkerForGroup, + base::BindRepeating(&SyncClient::CreateModelWorkerForGroup, base::Unretained(sync_client_.get()))); params.encryption_observer_proxy = crypto_.GetEncryptionObserverProxy(); @@ -493,7 +485,7 @@ invalidator ? invalidator->GetInvalidatorClientId() : std::string(); } params.sync_manager_factory = - std::make_unique<syncer::SyncManagerFactory>(network_connection_tracker_); + std::make_unique<SyncManagerFactory>(network_connection_tracker_); // The first time we start up the engine we want to ensure we have a clean // directory, so delete any old one that might be there. params.delete_sync_data_folder = !user_settings_->IsFirstSetupComplete(); @@ -511,15 +503,15 @@ EngineSwitchesFromCommandLine()); params.unrecoverable_error_handler = GetUnrecoverableErrorHandler(); params.report_unrecoverable_error_function = base::BindRepeating( - syncer::ReportUnrecoverableError, sync_client_->GetDeviceInfoSyncService() - ->GetLocalDeviceInfoProvider() - ->GetChannel()); + ReportUnrecoverableError, sync_client_->GetDeviceInfoSyncService() + ->GetLocalDeviceInfoProvider() + ->GetChannel()); params.saved_nigori_state = crypto_.TakeSavedNigoriState(); sync_prefs_.GetInvalidationVersions(¶ms.invalidation_versions); params.poll_interval = sync_prefs_.GetPollInterval(); if (params.poll_interval.is_zero()) { params.poll_interval = - base::TimeDelta::FromSeconds(syncer::kDefaultPollIntervalSeconds); + base::TimeDelta::FromSeconds(kDefaultPollIntervalSeconds); } engine_->Initialize(std::move(params)); @@ -529,15 +521,15 @@ // TODO(crbug.com/948148): Consider kicking off an access token fetch here. // Currently, the flow goes as follows: The SyncEngine tries to connect to the // server, but has no access token, so it ends up calling - // OnConnectionStatusChange(syncer::CONNECTION_AUTH_ERROR) which in turn - // causes SyncAuthManager to request a new access token. + // OnConnectionStatusChange(CONNECTION_AUTH_ERROR) which in turn causes + // SyncAuthManager to request a new access token. } void ProfileSyncService::Shutdown() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); NotifyShutdown(); - ShutdownImpl(syncer::BROWSER_SHUTDOWN); + ShutdownImpl(BROWSER_SHUTDOWN); DCHECK(!data_type_manager_); data_type_controllers_.clear(); @@ -556,21 +548,20 @@ sync_thread_->Stop(); } -void ProfileSyncService::ShutdownImpl(syncer::ShutdownReason reason) { +void ProfileSyncService::ShutdownImpl(ShutdownReason reason) { if (!engine_) { - if (reason == syncer::ShutdownReason::DISABLE_SYNC && sync_thread_) { + if (reason == ShutdownReason::DISABLE_SYNC && sync_thread_) { // If the engine is already shut down when a DISABLE_SYNC happens, // the data directory needs to be cleaned up here. sync_thread_->task_runner()->PostTask( - FROM_HERE, - base::BindOnce(&syncer::syncable::Directory::DeleteDirectoryFiles, - sync_client_->GetSyncDataPath())); + FROM_HERE, base::BindOnce(&syncable::Directory::DeleteDirectoryFiles, + sync_client_->GetSyncDataPath())); } return; } - if (reason == syncer::ShutdownReason::STOP_SYNC || - reason == syncer::ShutdownReason::DISABLE_SYNC) { + if (reason == ShutdownReason::STOP_SYNC || + reason == ShutdownReason::DISABLE_SYNC) { RemoveClientFromServer(); } @@ -597,14 +588,14 @@ // Shutdown the migrator before the engine to ensure it doesn't pull a null // snapshot. migrator_.reset(); - sync_js_controller_.AttachJsBackend(syncer::WeakHandle<syncer::JsBackend>()); + sync_js_controller_.AttachJsBackend(WeakHandle<JsBackend>()); if (base::FeatureList::IsEnabled(switches::kSyncUSSNigori)) { // We need to remove ModelTypeController for Nigori before the engine // shutdown because it's no longer valid after shutdown. // TODO(crbug.com/943019): This logic can be removed if Nigori local // model will be moved to UI thread. - data_type_controllers_.erase(syncer::NIGORI); + data_type_controllers_.erase(NIGORI); } engine_->Shutdown(reason); @@ -619,7 +610,7 @@ // If the sync DB is getting destroyed, the local DeviceInfo is no longer // valid and should be cleared from the cache. - if (reason == syncer::ShutdownReason::DISABLE_SYNC) { + if (reason == ShutdownReason::DISABLE_SYNC) { sync_client_->GetDeviceInfoSyncService()->ClearLocalCacheGuid(); } @@ -627,7 +618,7 @@ crypto_.Reset(); expect_sync_configuration_aborted_ = false; engine_initialized_ = false; - last_snapshot_ = syncer::SyncCycleSnapshot(); + last_snapshot_ = SyncCycleSnapshot(); auth_manager_->ConnectionClosed(); NotifyObservers(); @@ -639,11 +630,11 @@ void ProfileSyncService::StopImpl(SyncStopDataFate data_fate) { switch (data_fate) { case KEEP_DATA: - ShutdownImpl(syncer::STOP_SYNC); + ShutdownImpl(STOP_SYNC); break; case CLEAR_DATA: ClearUnrecoverableError(); - ShutdownImpl(syncer::DISABLE_SYNC); + ShutdownImpl(DISABLE_SYNC); // Clear prefs (including SyncSetupHasCompleted) before shutting down so // PSS clients don't think we're set up while we're shutting down. // Note: We do this after shutting down, so that notifications about the @@ -653,12 +644,12 @@ } } -syncer::SyncUserSettings* ProfileSyncService::GetUserSettings() { +SyncUserSettings* ProfileSyncService::GetUserSettings() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return user_settings_.get(); } -const syncer::SyncUserSettings* ProfileSyncService::GetUserSettings() const { +const SyncUserSettings* ProfileSyncService::GetUserSettings() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return user_settings_.get(); } @@ -697,8 +688,7 @@ return result; } -syncer::SyncService::TransportState ProfileSyncService::GetTransportState() - const { +SyncService::TransportState ProfileSyncService::GetTransportState() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!IsEngineAllowedToStart()) { @@ -714,11 +704,11 @@ // NOT_STARTED should be impossible. But we can temporarily be in this // state between shutting down and starting up again (e.g. during the // NotifyObservers() call in ShutdownImpl()). - case syncer::StartupController::State::NOT_STARTED: - case syncer::StartupController::State::STARTING_DEFERRED: + case StartupController::State::NOT_STARTED: + case StartupController::State::STARTING_DEFERRED: DCHECK(!engine_); return TransportState::START_DEFERRED; - case syncer::StartupController::State::STARTED: + case StartupController::State::STARTED: DCHECK(engine_); return TransportState::INITIALIZING; } @@ -784,7 +774,7 @@ // TODO(crbug.com/840720): Get rid of the UnrecoverableErrorHandler interface // and instead pass a callback. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - // Unrecoverable errors that arrive via the syncer::UnrecoverableErrorHandler + // Unrecoverable errors that arrive via the UnrecoverableErrorHandler // interface are assumed to originate within the syncer. OnUnrecoverableErrorImpl(from_here, message, ERROR_REASON_SYNCER); } @@ -805,7 +795,7 @@ << " -- ProfileSyncService unusable: " << message; // Shut all data types down. - ShutdownImpl(syncer::DISABLE_SYNC); + ShutdownImpl(DISABLE_SYNC); // This is the equivalent for Directory::DeleteDirectoryFiles(), guaranteed // to be called, either directly in ShutdownImpl(), or later in @@ -817,14 +807,14 @@ sync_prefs_.ClearDirectoryConsistencyPreferences(); } -void ProfileSyncService::ReenableDatatype(syncer::ModelType type) { +void ProfileSyncService::ReenableDatatype(ModelType type) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!engine_initialized_ || !data_type_manager_) return; data_type_manager_->ReenableType(type); } -void ProfileSyncService::ReadyForStartChanged(syncer::ModelType type) { +void ProfileSyncService::ReadyForStartChanged(ModelType type) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!engine_initialized_ || !data_type_manager_) return; @@ -849,10 +839,9 @@ } void ProfileSyncService::OnEngineInitialized( - syncer::ModelTypeSet initial_types, - const syncer::WeakHandle<syncer::JsBackend>& js_backend, - const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& - debug_info_listener, + ModelTypeSet initial_types, + const WeakHandle<JsBackend>& js_backend, + const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, const std::string& cache_guid, const std::string& session_name, const std::string& birthday, @@ -913,9 +902,8 @@ // in BuildDataTypeControllerMap(). // TODO(crbug.com/943019): This logic can be removed if Nigori local // model will be moved to UI thread. - data_type_controllers_[syncer::NIGORI] = - std::make_unique<syncer::ModelTypeController>( - syncer::NIGORI, engine_->GetNigoriControllerDelegate()); + data_type_controllers_[NIGORI] = std::make_unique<ModelTypeController>( + NIGORI, engine_->GetNigoriControllerDelegate()); } data_type_manager_ = @@ -936,7 +924,7 @@ // previous configuration left off). // TODO(sync): consider detecting configuration recovery and setting // the reason here appropriately. - ConfigureDataTypeManager(syncer::CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE); + ConfigureDataTypeManager(CONFIGURE_REASON_NEWLY_ENABLED_DATA_TYPE); } // Check for a cookie jar mismatch. @@ -953,7 +941,7 @@ } void ProfileSyncService::OnSyncCycleCompleted( - const syncer::SyncCycleSnapshot& snapshot) { + const SyncCycleSnapshot& snapshot) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); last_snapshot_ = snapshot; @@ -964,7 +952,7 @@ DCHECK(!snapshot.poll_interval().is_zero()); sync_prefs_.SetPollInterval(snapshot.poll_interval()); - syncer::UserShare* user_share = GetUserShare(); + UserShare* user_share = GetUserShare(); if (user_share) { sync_prefs_.SetBirthday(user_share->directory->store_birthday()); sync_prefs_.SetBagOfChips(user_share->directory->bag_of_chips()); @@ -974,14 +962,13 @@ NotifySyncCycleCompleted(); } -void ProfileSyncService::OnConnectionStatusChange( - syncer::ConnectionStatus status) { +void ProfileSyncService::OnConnectionStatusChange(ConnectionStatus status) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auth_manager_->ConnectionStatusChanged(status); NotifyObservers(); } -void ProfileSyncService::OnMigrationNeededForTypes(syncer::ModelTypeSet types) { +void ProfileSyncService::OnMigrationNeededForTypes(ModelTypeSet types) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(engine_initialized_); DCHECK(data_type_manager_); @@ -991,13 +978,12 @@ migrator_->MigrateTypes(types); } -void ProfileSyncService::OnActionableError( - const syncer::SyncProtocolError& error) { +void ProfileSyncService::OnActionableError(const SyncProtocolError& error) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); last_actionable_error_ = error; - DCHECK_NE(last_actionable_error_.action, syncer::UNKNOWN_ACTION); + DCHECK_NE(last_actionable_error_.action, UNKNOWN_ACTION); switch (error.action) { - case syncer::UPGRADE_CLIENT: + case UPGRADE_CLIENT: // TODO(lipalani) : if setup in progress we want to display these // actions in the popup. The current experience might not be optimal for // the user. We just dismiss the dialog. @@ -1010,10 +996,10 @@ last_actionable_error_.error_description, ERROR_REASON_ACTIONABLE_ERROR); break; - case syncer::DISABLE_SYNC_ON_CLIENT: - if (error.error_type == syncer::NOT_MY_BIRTHDAY) { - UMA_HISTOGRAM_ENUMERATION("Sync.StopSource", syncer::BIRTHDAY_ERROR, - syncer::STOP_SOURCE_LIMIT); + case DISABLE_SYNC_ON_CLIENT: + if (error.error_type == NOT_MY_BIRTHDAY) { + UMA_HISTOGRAM_ENUMERATION("Sync.StopSource", BIRTHDAY_ERROR, + STOP_SOURCE_LIMIT); } // Note: Here we explicitly want StopAndClear (rather than StopImpl), so // that IsSyncRequested gets set to false, and Sync won't start again on @@ -1034,11 +1020,11 @@ } #endif break; - case syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT: + case STOP_SYNC_FOR_DISABLED_ACCOUNT: // Sync disabled by domain admin. we should stop syncing until next // restart. sync_disabled_by_admin_ = true; - ShutdownImpl(syncer::DISABLE_SYNC); + ShutdownImpl(DISABLE_SYNC); // This is the equivalent for Directory::DeleteDirectoryFiles(), // guaranteed to be called, either directly in ShutdownImpl(), or later in // SyncBackendHostCore::DoShutdown(). @@ -1049,8 +1035,8 @@ // passphrase being set. sync_prefs_.ClearDirectoryConsistencyPreferences(); break; - case syncer::RESET_LOCAL_SYNC_DATA: - ShutdownImpl(syncer::DISABLE_SYNC); + case RESET_LOCAL_SYNC_DATA: + ShutdownImpl(DISABLE_SYNC); // This is the equivalent for Directory::DeleteDirectoryFiles(), // guaranteed to be called, either directly in ShutdownImpl(), or later in // SyncBackendHostCore::DoShutdown(). @@ -1062,7 +1048,7 @@ sync_prefs_.ClearDirectoryConsistencyPreferences(); startup_controller_->TryStart(IsSetupInProgress()); break; - case syncer::UNKNOWN_ACTION: + case UNKNOWN_ACTION: NOTREACHED(); } NotifyObservers(); @@ -1106,14 +1092,13 @@ if (result.status != DataTypeManager::OK) { // Something catastrophic had happened. We should only have one // error representing it. - syncer::SyncError error = - result.data_type_status_table.GetUnrecoverableError(); + SyncError error = result.data_type_status_table.GetUnrecoverableError(); DCHECK(error.IsSet()); std::string message = "Sync configuration failed with status " + DataTypeManager::ConfigureStatusToString(result.status) + " caused by " + - syncer::ModelTypeSetToString( + ModelTypeSetToString( result.data_type_status_table.GetUnrecoverableErrorTypes()) + ": " + error.message(); LOG(ERROR) << "ProfileSyncService error: " << message; @@ -1139,7 +1124,7 @@ engine_->EnableEncryptEverything(); NotifyObservers(); - if (migrator_.get() && migrator_->state() != syncer::BackendMigrator::IDLE) { + if (migrator_.get() && migrator_->state() != BackendMigrator::IDLE) { // Migration in progress. Let the migrator know we just finished // configuring something. It will be up to the migrator to call // StartSyncingWithServer() if migration is now finished. @@ -1165,13 +1150,13 @@ } bool ProfileSyncService::QueryDetailedSyncStatusForDebugging( - syncer::SyncStatus* result) const { + SyncStatus* result) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (engine_ && engine_initialized_) { *result = engine_->GetDetailedStatus(); return true; } - syncer::SyncStatus status; + SyncStatus status; status.sync_protocol_error = last_actionable_error_; *result = status; return false; @@ -1183,7 +1168,7 @@ } bool ProfileSyncService::RequiresClientUpgrade() const { - return last_actionable_error_.action == syncer::UPGRADE_CLIENT; + return last_actionable_error_.action == UPGRADE_CLIENT; } bool ProfileSyncService::CanConfigureDataTypes( @@ -1196,7 +1181,7 @@ (bypass_setup_in_progress_check || !IsSetupInProgress()); } -std::unique_ptr<syncer::SyncSetupInProgressHandle> +std::unique_ptr<SyncSetupInProgressHandle> ProfileSyncService::GetSetupInProgressHandle() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -1206,7 +1191,7 @@ NotifyObservers(); } - return std::make_unique<syncer::SyncSetupInProgressHandle>( + return std::make_unique<SyncSetupInProgressHandle>( base::BindRepeating(&ProfileSyncService::OnSetupInProgressHandleDestroyed, weak_factory_.GetWeakPtr())); } @@ -1216,7 +1201,7 @@ return sync_prefs_.IsLocalSyncEnabled(); } -void ProfileSyncService::TriggerRefresh(const syncer::ModelTypeSet& types) { +void ProfileSyncService::TriggerRefresh(const ModelTypeSet& types) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (engine_initialized_) engine_->TriggerRefresh(types); @@ -1244,60 +1229,59 @@ ReconfigureDatatypeManager(/*bypass_setup_in_progress_check=*/false); } -syncer::SyncClient* ProfileSyncService::GetSyncClientForTest() { +SyncClient* ProfileSyncService::GetSyncClientForTest() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return sync_client_.get(); } -void ProfileSyncService::AddObserver(syncer::SyncServiceObserver* observer) { +void ProfileSyncService::AddObserver(SyncServiceObserver* observer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); observers_.AddObserver(observer); } -void ProfileSyncService::RemoveObserver(syncer::SyncServiceObserver* observer) { +void ProfileSyncService::RemoveObserver(SyncServiceObserver* observer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); observers_.RemoveObserver(observer); } bool ProfileSyncService::HasObserver( - const syncer::SyncServiceObserver* observer) const { + const SyncServiceObserver* observer) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return observers_.HasObserver(observer); } -syncer::ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const { +ModelTypeSet ProfileSyncService::GetRegisteredDataTypes() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - syncer::ModelTypeSet registered_types; + ModelTypeSet registered_types; // The |data_type_controllers_| are determined by command-line flags; // that's effectively what controls the values returned here. - for (const std::pair<const syncer::ModelType, - std::unique_ptr<DataTypeController>>& + for (const std::pair<const ModelType, std::unique_ptr<DataTypeController>>& type_and_controller : data_type_controllers_) { registered_types.Put(type_and_controller.first); } return registered_types; } -syncer::ModelTypeSet ProfileSyncService::GetForcedDataTypes() const { +ModelTypeSet ProfileSyncService::GetForcedDataTypes() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - const syncer::SyncTypePreferenceProvider* provider = + const SyncTypePreferenceProvider* provider = sync_client_->GetPreferenceProvider(); if (provider) { return Intersection(provider->GetForcedDataTypes(), GetRegisteredDataTypes()); } - return syncer::ModelTypeSet(); + return ModelTypeSet(); } -syncer::ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const { +ModelTypeSet ProfileSyncService::GetPreferredDataTypes() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return Union(user_settings_->GetPreferredDataTypes(), GetForcedDataTypes()); } -syncer::ModelTypeSet ProfileSyncService::GetActiveDataTypes() const { +ModelTypeSet ProfileSyncService::GetActiveDataTypes() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!data_type_manager_ || GetAuthError().IsPersistentError()) - return syncer::ModelTypeSet(); + return ModelTypeSet(); return data_type_manager_->GetActiveDataTypes(); } @@ -1315,7 +1299,7 @@ bool ProfileSyncService::IsEncryptEverythingAllowed() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - const syncer::SyncTypePreferenceProvider* provider = + const SyncTypePreferenceProvider* provider = sync_client_->GetPreferenceProvider(); if (provider) { return provider->IsEncryptEverythingAllowed(); @@ -1323,13 +1307,12 @@ return true; } -void ProfileSyncService::ConfigureDataTypeManager( - syncer::ConfigureReason reason) { - syncer::ConfigureContext configure_context; +void ProfileSyncService::ConfigureDataTypeManager(ConfigureReason reason) { + ConfigureContext configure_context; configure_context.authenticated_account_id = GetAuthenticatedAccountInfo().account_id; configure_context.cache_guid = sync_prefs_.GetCacheGuid(); - configure_context.storage_option = syncer::STORAGE_ON_DISK; + configure_context.storage_option = STORAGE_ON_DISK; configure_context.reason = reason; configure_context.configuration_start_time = base::Time::Now(); @@ -1337,34 +1320,33 @@ if (!migrator_) { // We create the migrator at the same time. - migrator_ = std::make_unique<syncer::BackendMigrator>( + migrator_ = std::make_unique<BackendMigrator>( debug_identifier_, GetUserShare(), data_type_manager_.get(), base::BindRepeating(&ProfileSyncService::ConfigureDataTypeManager, - base::Unretained(this), - syncer::CONFIGURE_REASON_MIGRATION), + base::Unretained(this), CONFIGURE_REASON_MIGRATION), base::BindRepeating(&ProfileSyncService::StartSyncingWithServer, base::Unretained(this))); // Override reason if no configuration has completed ever. if (is_first_time_sync_configure_) { - configure_context.reason = syncer::CONFIGURE_REASON_NEW_CLIENT; + configure_context.reason = CONFIGURE_REASON_NEW_CLIENT; } } DCHECK(!configure_context.authenticated_account_id.empty() || IsLocalSyncEnabled()); DCHECK(!configure_context.cache_guid.empty()); - DCHECK_NE(configure_context.reason, syncer::CONFIGURE_REASON_UNKNOWN); + DCHECK_NE(configure_context.reason, CONFIGURE_REASON_UNKNOWN); // Note: When local Sync is enabled, then we want full-sync mode (not just // transport), even though Sync-the-feature is not considered enabled. bool use_transport_only_mode = !IsSyncFeatureEnabled() && !IsLocalSyncEnabled(); - syncer::ModelTypeSet types = GetPreferredDataTypes(); + ModelTypeSet types = GetPreferredDataTypes(); // In transport-only mode, only a subset of data types is supported. if (use_transport_only_mode) { - syncer::ModelTypeSet allowed_types = {syncer::USER_CONSENTS}; + ModelTypeSet allowed_types = {USER_CONSENTS}; if (autofill_enable_account_wallet_storage_ && base::FeatureList::IsEnabled(switches::kSyncUSSAutofillWalletData)) { @@ -1372,12 +1354,12 @@ base::FeatureList::IsEnabled( switches:: kSyncAllowWalletDataInTransportModeWithCustomPassphrase)) { - allowed_types.Put(syncer::AUTOFILL_WALLET_DATA); + allowed_types.Put(AUTOFILL_WALLET_DATA); } } types = Intersection(types, allowed_types); - configure_context.storage_option = syncer::STORAGE_IN_MEMORY; + configure_context.storage_option = STORAGE_IN_MEMORY; } data_type_manager_->Configure(types, configure_context); @@ -1400,19 +1382,19 @@ UMA_HISTOGRAM_BOOLEAN("Sync.SyncEverything2", sync_everything); if (!sync_everything) { - syncer::ModelTypeSet chosen_types = GetPreferredDataTypes(); - chosen_types.RetainAll(syncer::UserSelectableTypes()); + ModelTypeSet chosen_types = GetPreferredDataTypes(); + chosen_types.RetainAll(UserSelectableTypes()); - for (syncer::ModelType type : chosen_types) { + for (ModelType type : chosen_types) { UMA_HISTOGRAM_ENUMERATION("Sync.CustomSync2", - syncer::ModelTypeToHistogramInt(type), - static_cast<int>(syncer::MODEL_TYPE_COUNT)); + ModelTypeToHistogramInt(type), + static_cast<int>(MODEL_TYPE_COUNT)); } } } } -syncer::UserShare* ProfileSyncService::GetUserShare() const { +UserShare* ProfileSyncService::GetUserShare() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (engine_ && engine_initialized_) { return engine_->GetUserShare(); @@ -1421,12 +1403,12 @@ return nullptr; } -syncer::SyncCycleSnapshot ProfileSyncService::GetLastCycleSnapshot() const { +SyncCycleSnapshot ProfileSyncService::GetLastCycleSnapshot() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return last_snapshot_; } -syncer::PassphraseRequiredReason +PassphraseRequiredReason ProfileSyncService::GetPassphraseRequiredReasonForTest() const { return crypto_.passphrase_required_reason(); } @@ -1439,7 +1421,7 @@ engine_->HasUnsyncedItemsForTest(std::move(cb)); } -syncer::BackendMigrator* ProfileSyncService::GetBackendMigratorForTest() { +BackendMigrator* ProfileSyncService::GetBackendMigratorForTest() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return migrator_.get(); } @@ -1453,10 +1435,9 @@ return std::move(result); } - syncer::SyncStatus detailed_status = engine_->GetDetailedStatus(); - const syncer::ModelTypeSet& throttled_types(detailed_status.throttled_types); - const syncer::ModelTypeSet& backed_off_types( - detailed_status.backed_off_types); + SyncStatus detailed_status = engine_->GetDetailedStatus(); + const ModelTypeSet& throttled_types(detailed_status.throttled_types); + const ModelTypeSet& backed_off_types(detailed_status.backed_off_types); std::unique_ptr<base::DictionaryValue> type_status_header( new base::DictionaryValue()); @@ -1469,26 +1450,26 @@ type_status_header->SetString("group_type", "Group Type"); result->Append(std::move(type_status_header)); - syncer::ModelSafeRoutingInfo routing_info; + ModelSafeRoutingInfo routing_info; engine_->GetModelSafeRoutingInfo(&routing_info); - const syncer::ModelTypeSet registered = GetRegisteredDataTypes(); - for (syncer::ModelType type : registered) { + const ModelTypeSet registered = GetRegisteredDataTypes(); + for (ModelType type : registered) { auto type_status = std::make_unique<base::DictionaryValue>(); type_status->SetString("name", ModelTypeToString(type)); type_status->SetString("group_type", ModelSafeGroupToString(routing_info[type])); if (data_type_error_map_.find(type) != data_type_error_map_.end()) { - const syncer::SyncError& error = data_type_error_map_.find(type)->second; + const SyncError& error = data_type_error_map_.find(type)->second; DCHECK(error.IsSet()); switch (error.GetSeverity()) { - case syncer::SyncError::SYNC_ERROR_SEVERITY_ERROR: + case SyncError::SYNC_ERROR_SEVERITY_ERROR: type_status->SetString("status", "error"); type_status->SetString( "message", "Error: " + error.location().ToString() + ", " + error.GetMessagePrefix() + error.message()); break; - case syncer::SyncError::SYNC_ERROR_SEVERITY_INFO: + case SyncError::SYNC_ERROR_SEVERITY_INFO: type_status->SetString("status", "disabled"); type_status->SetString("message", error.message()); break; @@ -1511,8 +1492,7 @@ if (dtc_iter != data_type_controllers_.end()) { type_status->SetString("state", DataTypeController::StateToString( dtc_iter->second->state())); - if (dtc_iter->second->state() != - syncer::DataTypeController::NOT_RUNNING) { + if (dtc_iter->second->state() != DataTypeController::NOT_RUNNING) { // We use BindToCurrentSequence() to make sure observers (i.e. // |type_debug_info_observers_|) are not notified synchronously, which // the UI code (chrome://sync-internals) doesn't handle well. @@ -1615,7 +1595,7 @@ } void ProfileSyncService::AddProtocolEventObserver( - syncer::ProtocolEventObserver* observer) { + ProtocolEventObserver* observer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); protocol_event_observers_.AddObserver(observer); if (engine_) { @@ -1624,7 +1604,7 @@ } void ProfileSyncService::RemoveProtocolEventObserver( - syncer::ProtocolEventObserver* observer) { + ProtocolEventObserver* observer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); protocol_event_observers_.RemoveObserver(observer); if (engine_ && !protocol_event_observers_.might_have_observers()) { @@ -1633,7 +1613,7 @@ } void ProfileSyncService::AddTypeDebugInfoObserver( - syncer::TypeDebugInfoObserver* type_debug_info_observer) { + TypeDebugInfoObserver* type_debug_info_observer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); type_debug_info_observers_.AddObserver(type_debug_info_observer); if (type_debug_info_observers_.might_have_observers() && @@ -1643,7 +1623,7 @@ } void ProfileSyncService::RemoveTypeDebugInfoObserver( - syncer::TypeDebugInfoObserver* type_debug_info_observer) { + TypeDebugInfoObserver* type_debug_info_observer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); type_debug_info_observers_.RemoveObserver(type_debug_info_observer); if (!type_debug_info_observers_.might_have_observers() && @@ -1658,10 +1638,10 @@ : public base::RefCountedThreadSafe<GetAllNodesRequestHelper> { public: GetAllNodesRequestHelper( - syncer::ModelTypeSet requested_types, + ModelTypeSet requested_types, base::OnceCallback<void(std::unique_ptr<base::ListValue>)> callback); - void OnReceivedNodesForType(const syncer::ModelType type, + void OnReceivedNodesForType(const ModelType type, std::unique_ptr<base::ListValue> node_list); private: @@ -1669,7 +1649,7 @@ virtual ~GetAllNodesRequestHelper(); std::unique_ptr<base::ListValue> result_accumulator_; - syncer::ModelTypeSet awaiting_types_; + ModelTypeSet awaiting_types_; base::OnceCallback<void(std::unique_ptr<base::ListValue>)> callback_; SEQUENCE_CHECKER(sequence_checker_); @@ -1677,7 +1657,7 @@ }; GetAllNodesRequestHelper::GetAllNodesRequestHelper( - syncer::ModelTypeSet requested_types, + ModelTypeSet requested_types, base::OnceCallback<void(std::unique_ptr<base::ListValue>)> callback) : result_accumulator_(std::make_unique<base::ListValue>()), awaiting_types_(requested_types), @@ -1694,7 +1674,7 @@ // Called when the set of nodes for a type has been returned. // Only return one type of nodes each time. void GetAllNodesRequestHelper::OnReceivedNodesForType( - const syncer::ModelType type, + const ModelType type, std::unique_ptr<base::ListValue> node_list) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -1725,16 +1705,15 @@ return; } - syncer::ModelTypeSet all_types = GetActiveDataTypes(); - all_types.PutAll(syncer::ControlTypes()); + ModelTypeSet all_types = GetActiveDataTypes(); + all_types.PutAll(ControlTypes()); scoped_refptr<GetAllNodesRequestHelper> helper = new GetAllNodesRequestHelper(all_types, callback); - for (syncer::ModelType type : all_types) { + for (ModelType type : all_types) { const auto dtc_iter = data_type_controllers_.find(type); if (dtc_iter != data_type_controllers_.end()) { - if (dtc_iter->second->state() == - syncer::DataTypeController::NOT_RUNNING) { + if (dtc_iter->second->state() == DataTypeController::NOT_RUNNING) { // In the NOT_RUNNING state it's not allowed to call GetAllNodes on the // DataTypeController, so just return an empty result. // This can happen e.g. if we're waiting for a custom passphrase to be @@ -1749,9 +1728,8 @@ } else { // Control Types. helper->OnReceivedNodesForType( - type, - syncer::DirectoryDataTypeController::GetAllNodesForTypeFromDirectory( - type, GetUserShare()->directory.get())); + type, DirectoryDataTypeController::GetAllNodesForTypeFromDirectory( + type, GetUserShare()->directory.get())); } } } @@ -1772,7 +1750,7 @@ engine_->SetInvalidationsForSessionsEnabled(enabled); } -base::WeakPtr<syncer::JsController> ProfileSyncService::GetJsController() { +base::WeakPtr<JsController> ProfileSyncService::GetJsController() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return sync_js_controller_.AsWeakPtr(); } @@ -1813,7 +1791,7 @@ // etc. ReconfigureDatatypeManager() will get called again once the last // SyncSetupInProgressHandle is released. if (CanConfigureDataTypes(bypass_setup_in_progress_check)) { - ConfigureDataTypeManager(syncer::CONFIGURE_REASON_RECONFIGURATION); + ConfigureDataTypeManager(CONFIGURE_REASON_RECONFIGURATION); } else { DVLOG(0) << "ConfigureDataTypeManager not invoked because datatypes " << "cannot be configured now"; @@ -1843,13 +1821,13 @@ return auth_manager_->access_token(); } -syncer::SyncTokenStatus ProfileSyncService::GetSyncTokenStatus() const { +SyncTokenStatus ProfileSyncService::GetSyncTokenStatus() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return auth_manager_->GetSyncTokenStatus(); } void ProfileSyncService::OverrideNetworkResourcesForTest( - std::unique_ptr<syncer::NetworkResources> network_resources) { + std::unique_ptr<NetworkResources> network_resources) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // If the engine has already been created, then it holds a pointer to the // previous |network_resources_| which will become invalid. In that case, shut @@ -1898,7 +1876,7 @@ return sync_thread_ ? sync_thread_->task_runner() : nullptr; } -syncer::SyncEncryptionHandler::Observer* +SyncEncryptionHandler::Observer* ProfileSyncService::GetEncryptionObserverForTest() { return &crypto_; } @@ -1909,7 +1887,7 @@ const std::string cache_guid = sync_prefs_.GetCacheGuid(); DCHECK(!cache_guid.empty()); std::string birthday; - syncer::UserShare* user_share = GetUserShare(); + UserShare* user_share = GetUserShare(); if (user_share && user_share->directory.get()) { birthday = user_share->directory->store_birthday(); } @@ -1949,11 +1927,11 @@ } void ProfileSyncService::RecordMemoryUsageHistograms() { - syncer::ModelTypeSet active_types = GetActiveDataTypes(); - for (syncer::ModelType type : active_types) { + ModelTypeSet active_types = GetActiveDataTypes(); + for (ModelType type : active_types) { auto dtc_it = data_type_controllers_.find(type); if (dtc_it != data_type_controllers_.end() && - dtc_it->second->state() != syncer::DataTypeController::NOT_RUNNING) { + dtc_it->second->state() != DataTypeController::NOT_RUNNING) { // It's possible that a data type is considered active, but its // DataTypeController is still NOT_RUNNING, in the case where we're // waiting for a custom passphrase. @@ -1992,8 +1970,7 @@ NotifyObservers(); } -void ProfileSyncService::ReconfigureDueToPassphrase( - syncer::ConfigureReason reason) { +void ProfileSyncService::ReconfigureDueToPassphrase(ConfigureReason reason) { if (CanConfigureDataTypes(/*bypass_setup_in_progress_check=*/false)) { DCHECK(data_type_manager_->IsNigoriEnabled()); ConfigureDataTypeManager(reason); @@ -2005,4 +1982,4 @@ NotifyObservers(); } -} // namespace browser_sync +} // namespace syncer
diff --git a/components/sync/driver/profile_sync_service.h b/components/sync/driver/profile_sync_service.h index 6ffec49..1141db8e 100644 --- a/components/sync/driver/profile_sync_service.h +++ b/components/sync/driver/profile_sync_service.h
@@ -52,6 +52,7 @@ } // namespace network namespace syncer { + class BackendMigrator; class NetworkResources; class SyncAuthManager; @@ -60,18 +61,14 @@ struct StatusCounters; struct UpdateCounters; struct UserShare; -} // namespace syncer -// TODO(crbug.com/896303): Change to namespace syncer. -namespace browser_sync { - -// Look at the syncer::SyncService interface for information on how to use this -// class. You should not need to know about ProfileSyncService directly. -class ProfileSyncService : public syncer::SyncService, - public syncer::SyncEngineHost, - public syncer::SyncPrefObserver, - public syncer::DataTypeManagerObserver, - public syncer::UnrecoverableErrorHandler, +// Look at the SyncService interface for information on how to use this class. +// You should not need to know about ProfileSyncService directly. +class ProfileSyncService : public SyncService, + public SyncEngineHost, + public SyncPrefObserver, + public DataTypeManagerObserver, + public UnrecoverableErrorHandler, public identity::IdentityManager::Observer { public: // If AUTO_START, sync will set IsFirstSetupComplete() automatically and sync @@ -90,12 +87,12 @@ InitParams(InitParams&& other); ~InitParams(); - std::unique_ptr<syncer::SyncClient> sync_client; + std::unique_ptr<SyncClient> sync_client; identity::IdentityManager* identity_manager = nullptr; std::vector<invalidation::IdentityProvider*> invalidations_identity_providers; StartBehavior start_behavior = MANUAL_START; - syncer::NetworkTimeUpdateCallback network_time_update_callback; + NetworkTimeUpdateCallback network_time_update_callback; scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory; network::NetworkConnectionTracker* network_connection_tracker = nullptr; std::string debug_identifier; @@ -114,9 +111,9 @@ // TODO(mastiz): Rename this to Start(). void Initialize(); - // syncer::SyncService implementation - syncer::SyncUserSettings* GetUserSettings() override; - const syncer::SyncUserSettings* GetUserSettings() const override; + // SyncService implementation + SyncUserSettings* GetUserSettings() override; + const SyncUserSettings* GetUserSettings() const override; int GetDisableReasons() const override; TransportState GetTransportState() const override; bool IsLocalSyncEnabled() const override; @@ -124,73 +121,65 @@ bool IsAuthenticatedAccountPrimary() const override; GoogleServiceAuthError GetAuthError() const override; bool RequiresClientUpgrade() const override; - std::unique_ptr<syncer::SyncSetupInProgressHandle> GetSetupInProgressHandle() + std::unique_ptr<SyncSetupInProgressHandle> GetSetupInProgressHandle() override; bool IsSetupInProgress() const override; - syncer::ModelTypeSet GetRegisteredDataTypes() const override; - syncer::ModelTypeSet GetForcedDataTypes() const override; - syncer::ModelTypeSet GetPreferredDataTypes() const override; - syncer::ModelTypeSet GetActiveDataTypes() const override; + ModelTypeSet GetRegisteredDataTypes() const override; + ModelTypeSet GetForcedDataTypes() const override; + ModelTypeSet GetPreferredDataTypes() const override; + ModelTypeSet GetActiveDataTypes() const override; void StopAndClear() override; - void OnDataTypeRequestsSyncStartup(syncer::ModelType type) override; - void TriggerRefresh(const syncer::ModelTypeSet& types) override; - void ReenableDatatype(syncer::ModelType type) override; - void ReadyForStartChanged(syncer::ModelType type) override; + void OnDataTypeRequestsSyncStartup(ModelType type) override; + void TriggerRefresh(const ModelTypeSet& types) override; + void ReenableDatatype(ModelType type) override; + void ReadyForStartChanged(ModelType type) override; void SetInvalidationsForSessionsEnabled(bool enabled) override; - void AddObserver(syncer::SyncServiceObserver* observer) override; - void RemoveObserver(syncer::SyncServiceObserver* observer) override; - bool HasObserver(const syncer::SyncServiceObserver* observer) const override; - syncer::UserShare* GetUserShare() const override; - syncer::SyncTokenStatus GetSyncTokenStatus() const override; - bool QueryDetailedSyncStatusForDebugging( - syncer::SyncStatus* result) const override; + void AddObserver(SyncServiceObserver* observer) override; + void RemoveObserver(SyncServiceObserver* observer) override; + bool HasObserver(const SyncServiceObserver* observer) const override; + UserShare* GetUserShare() const override; + SyncTokenStatus GetSyncTokenStatus() const override; + bool QueryDetailedSyncStatusForDebugging(SyncStatus* result) const override; base::Time GetLastSyncedTime() const override; - syncer::SyncCycleSnapshot GetLastCycleSnapshot() const override; + SyncCycleSnapshot GetLastCycleSnapshot() const override; std::unique_ptr<base::Value> GetTypeStatusMapForDebugging() override; const GURL& sync_service_url() const override; std::string unrecoverable_error_message() const override; base::Location unrecoverable_error_location() const override; - void AddProtocolEventObserver( - syncer::ProtocolEventObserver* observer) override; - void RemoveProtocolEventObserver( - syncer::ProtocolEventObserver* observer) override; - void AddTypeDebugInfoObserver( - syncer::TypeDebugInfoObserver* observer) override; - void RemoveTypeDebugInfoObserver( - syncer::TypeDebugInfoObserver* observer) override; - base::WeakPtr<syncer::JsController> GetJsController() override; + void AddProtocolEventObserver(ProtocolEventObserver* observer) override; + void RemoveProtocolEventObserver(ProtocolEventObserver* observer) override; + void AddTypeDebugInfoObserver(TypeDebugInfoObserver* observer) override; + void RemoveTypeDebugInfoObserver(TypeDebugInfoObserver* observer) override; + base::WeakPtr<JsController> GetJsController() override; void GetAllNodes(const base::Callback<void(std::unique_ptr<base::ListValue>)>& callback) override; // SyncEngineHost implementation. void OnEngineInitialized( - syncer::ModelTypeSet initial_types, - const syncer::WeakHandle<syncer::JsBackend>& js_backend, - const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& - debug_info_listener, + ModelTypeSet initial_types, + const WeakHandle<JsBackend>& js_backend, + const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, const std::string& cache_guid, const std::string& session_name, const std::string& birthday, const std::string& bag_of_chips, bool success) override; - void OnSyncCycleCompleted(const syncer::SyncCycleSnapshot& snapshot) override; - void OnProtocolEvent(const syncer::ProtocolEvent& event) override; + void OnSyncCycleCompleted(const SyncCycleSnapshot& snapshot) override; + void OnProtocolEvent(const ProtocolEvent& event) override; void OnDirectoryTypeCommitCounterUpdated( - syncer::ModelType type, - const syncer::CommitCounters& counters) override; + ModelType type, + const CommitCounters& counters) override; void OnDirectoryTypeUpdateCounterUpdated( - syncer::ModelType type, - const syncer::UpdateCounters& counters) override; - void OnDatatypeStatusCounterUpdated( - syncer::ModelType type, - const syncer::StatusCounters& counters) override; - void OnConnectionStatusChange(syncer::ConnectionStatus status) override; - void OnMigrationNeededForTypes(syncer::ModelTypeSet types) override; - void OnActionableError(const syncer::SyncProtocolError& error) override; + ModelType type, + const UpdateCounters& counters) override; + void OnDatatypeStatusCounterUpdated(ModelType type, + const StatusCounters& counters) override; + void OnConnectionStatusChange(ConnectionStatus status) override; + void OnMigrationNeededForTypes(ModelTypeSet types) override; + void OnActionableError(const SyncProtocolError& error) override; // DataTypeManagerObserver implementation. - void OnConfigureDone( - const syncer::DataTypeManager::ConfigureResult& result) override; + void OnConfigureDone(const DataTypeManager::ConfigureResult& result) override; void OnConfigureStart() override; // IdentityManager::Observer implementation. @@ -208,7 +197,7 @@ bool HasCookieJarMismatch( const std::vector<gaia::ListedAccount>& cookie_jar_accounts); - // syncer::UnrecoverableErrorHandler implementation. + // UnrecoverableErrorHandler implementation. void OnUnrecoverableError(const base::Location& from_here, const std::string& message) override; @@ -230,7 +219,7 @@ bool IsPassphrasePrompted() const; void SetPassphrasePrompted(bool prompted); - syncer::PassphraseRequiredReason GetPassphraseRequiredReasonForTest() const; + PassphraseRequiredReason GetPassphraseRequiredReasonForTest() const; // Returns whether or not the underlying sync engine has made any // local changes to items that have not yet been synced with the @@ -238,7 +227,7 @@ void HasUnsyncedItemsForTest(base::OnceCallback<void(bool)> cb) const; // Used by MigrationWatcher. May return null. - syncer::BackendMigrator* GetBackendMigratorForTest(); + BackendMigrator* GetBackendMigratorForTest(); // Used by tests to inspect interaction with OAuth2TokenService. bool IsRetryingAccessTokenFetchForTest() const; @@ -254,18 +243,18 @@ // the real NetworkResources were already used before the test had a chance // to call this. void OverrideNetworkResourcesForTest( - std::unique_ptr<syncer::NetworkResources> network_resources); + std::unique_ptr<NetworkResources> network_resources); - bool IsDataTypeControllerRunningForTest(syncer::ModelType type) const; + bool IsDataTypeControllerRunningForTest(ModelType type) const; // Sometimes we need to wait for tasks on the sync thread in tests. scoped_refptr<base::SingleThreadTaskRunner> GetSyncThreadTaskRunnerForTest() const; // Some tests rely on injecting calls to the encryption observer. - syncer::SyncEncryptionHandler::Observer* GetEncryptionObserverForTest(); + SyncEncryptionHandler::Observer* GetEncryptionObserverForTest(); - syncer::SyncClient* GetSyncClientForTest(); + SyncClient* GetSyncClientForTest(); private: friend class TestProfileSyncService; @@ -289,13 +278,11 @@ }; // Virtual for testing. - virtual syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler(); + virtual WeakHandle<JsEventHandler> GetJsEventHandler(); - syncer::SyncEngine::HttpPostProviderFactoryGetter - MakeHttpPostProviderFactoryGetter(); + SyncEngine::HttpPostProviderFactoryGetter MakeHttpPostProviderFactoryGetter(); - syncer::WeakHandle<syncer::UnrecoverableErrorHandler> - GetUnrecoverableErrorHandler(); + WeakHandle<UnrecoverableErrorHandler> GetUnrecoverableErrorHandler(); // Callbacks for SyncAuthManager. void AccountStateChanged(); @@ -315,11 +302,11 @@ void ReconfigureDatatypeManager(bool bypass_setup_in_progress_check); // Helper to install and configure a data type manager. - void ConfigureDataTypeManager(syncer::ConfigureReason reason); + void ConfigureDataTypeManager(ConfigureReason reason); // Shuts down the engine sync components. // |reason| dictates if syncing is being disabled or not. - void ShutdownImpl(syncer::ShutdownReason reason); + void ShutdownImpl(ShutdownReason reason); // Helper for OnUnrecoverableError. void OnUnrecoverableErrorImpl(const base::Location& from_here, @@ -375,25 +362,25 @@ void OnSetupInProgressHandleDestroyed(); // Called by SyncServiceCrypto when a passphrase is required or accepted. - void ReconfigureDueToPassphrase(syncer::ConfigureReason reason); + void ReconfigureDueToPassphrase(ConfigureReason reason); // This profile's SyncClient, which abstracts away non-Sync dependencies and // the Sync API component factory. - const std::unique_ptr<syncer::SyncClient> sync_client_; + const std::unique_ptr<SyncClient> sync_client_; // The class that handles getting, setting, and persisting sync preferences. - syncer::SyncPrefs sync_prefs_; + SyncPrefs sync_prefs_; // Encapsulates user signin - used to set/get the user's authenticated // email address and sign-out upon error. identity::IdentityManager* const identity_manager_; // The user-configurable knobs. Non-null between Initialize() and Shutdown(). - std::unique_ptr<syncer::SyncUserSettingsImpl> user_settings_; + std::unique_ptr<SyncUserSettingsImpl> user_settings_; // Handles tracking of the authenticated account and acquiring access tokens. // Only null after Shutdown(). - std::unique_ptr<syncer::SyncAuthManager> auth_manager_; + std::unique_ptr<SyncAuthManager> auth_manager_; // An identifier representing this instance for debugging purposes. const std::string debug_identifier_; @@ -404,7 +391,7 @@ const GURL sync_service_url_; // A utility object containing logic and state relating to encryption. - syncer::SyncServiceCrypto crypto_; + SyncServiceCrypto crypto_; // The thread where all the sync operations happen. This thread is kept alive // until browser shutdown and reused if sync is turned off and on again. It is @@ -414,14 +401,14 @@ // Our asynchronous engine to communicate with sync components living on // other threads. - std::unique_ptr<syncer::SyncEngine> engine_; + std::unique_ptr<SyncEngine> engine_; // Used to ensure that certain operations are performed on the sequence that // this object was created on. SEQUENCE_CHECKER(sequence_checker_); // Cache of the last SyncCycleSnapshot received from the sync engine. - syncer::SyncCycleSnapshot last_snapshot_; + SyncCycleSnapshot last_snapshot_; // The time that OnConfigureStart is called. This member is zero if // OnConfigureStart has not yet been called, and is reset to zero once @@ -429,7 +416,7 @@ base::Time sync_configure_start_time_; // Callback to update the network time; used for initializing the engine. - syncer::NetworkTimeUpdateCallback network_time_update_callback_; + NetworkTimeUpdateCallback network_time_update_callback_; // The URL loader factory for the sync. scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_; @@ -460,30 +447,30 @@ base::Location unrecoverable_error_location_; // Manages the start and stop of the data types. - std::unique_ptr<syncer::DataTypeManager> data_type_manager_; + std::unique_ptr<DataTypeManager> data_type_manager_; - base::ObserverList<syncer::SyncServiceObserver>::Unchecked observers_; - base::ObserverList<syncer::ProtocolEventObserver>::Unchecked + base::ObserverList<SyncServiceObserver>::Unchecked observers_; + base::ObserverList<ProtocolEventObserver>::Unchecked protocol_event_observers_; - base::ObserverList<syncer::TypeDebugInfoObserver>::Unchecked + base::ObserverList<TypeDebugInfoObserver>::Unchecked type_debug_info_observers_; - syncer::SyncJsController sync_js_controller_; + SyncJsController sync_js_controller_; // This allows us to gracefully handle an ABORTED return code from the // DataTypeManager in the event that the server informed us to cease and // desist syncing immediately. bool expect_sync_configuration_aborted_; - std::unique_ptr<syncer::BackendMigrator> migrator_; + std::unique_ptr<BackendMigrator> migrator_; // This is the last |SyncProtocolError| we received from the server that had // an action set on it. - syncer::SyncProtocolError last_actionable_error_; + SyncProtocolError last_actionable_error_; // Tracks the set of failed data types (those that encounter an error // or must delay loading for some reason). - syncer::DataTypeStatusTable::TypeErrorMap data_type_error_map_; + DataTypeStatusTable::TypeErrorMap data_type_error_map_; // This providers tells the invalidations code which identity to register for. // The account that it registers for should be the same as the currently @@ -492,14 +479,14 @@ invalidations_identity_providers_; // List of available data type controllers. - syncer::DataTypeController::TypeMap data_type_controllers_; + DataTypeController::TypeMap data_type_controllers_; - std::unique_ptr<syncer::NetworkResources> network_resources_; + std::unique_ptr<NetworkResources> network_resources_; const StartBehavior start_behavior_; - std::unique_ptr<syncer::StartupController> startup_controller_; + std::unique_ptr<StartupController> startup_controller_; - std::unique_ptr<syncer::SyncStoppedReporter> sync_stopped_reporter_; + std::unique_ptr<SyncStoppedReporter> sync_stopped_reporter_; // Listens for the system being under memory pressure. std::unique_ptr<base::MemoryPressureListener> memory_pressure_listener_; @@ -522,6 +509,6 @@ DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); }; -} // namespace browser_sync +} // namespace syncer #endif // COMPONENTS_SYNC_DRIVER_PROFILE_SYNC_SERVICE_H_
diff --git a/components/browser_sync/test_profile_sync_service.cc b/components/sync/driver/test_profile_sync_service.cc similarity index 82% rename from components/browser_sync/test_profile_sync_service.cc rename to components/sync/driver/test_profile_sync_service.cc index a76d9db..d9fccd3 100644 --- a/components/browser_sync/test_profile_sync_service.cc +++ b/components/sync/driver/test_profile_sync_service.cc
@@ -2,17 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/browser_sync/test_profile_sync_service.h" +#include "components/sync/driver/test_profile_sync_service.h" #include <utility> #include "base/run_loop.h" -namespace browser_sync { - -syncer::TestIdFactory* TestProfileSyncService::id_factory() { - return &id_factory_; -} +namespace syncer { syncer::WeakHandle<syncer::JsEventHandler> TestProfileSyncService::GetJsEventHandler() { @@ -39,4 +35,4 @@ return engine_->GetUserShare(); } -} // namespace browser_sync +} // namespace syncer
diff --git a/components/browser_sync/test_profile_sync_service.h b/components/sync/driver/test_profile_sync_service.h similarity index 74% rename from components/browser_sync/test_profile_sync_service.h rename to components/sync/driver/test_profile_sync_service.h index 7f70bc3..091a91e 100644 --- a/components/browser_sync/test_profile_sync_service.h +++ b/components/sync/driver/test_profile_sync_service.h
@@ -2,23 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ -#define COMPONENTS_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ +#ifndef COMPONENTS_SYNC_DRIVER_TEST_PROFILE_SYNC_SERVICE_H_ +#define COMPONENTS_SYNC_DRIVER_TEST_PROFILE_SYNC_SERVICE_H_ #include "base/macros.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/sync/base/weak_handle.h" #include "components/sync/driver/data_type_manager.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/js/js_event_handler.h" -#include "components/sync/test/engine/test_id_factory.h" namespace syncer { + class SyncPrefs; -} // namespace syncer -namespace browser_sync { - -class TestProfileSyncService : public ProfileSyncService { +class TestProfileSyncService : public syncer::ProfileSyncService { public: explicit TestProfileSyncService(InitParams init_params); @@ -35,8 +32,6 @@ // We implement our own version to avoid some DCHECKs. syncer::UserShare* GetUserShare() const override; - syncer::TestIdFactory* id_factory(); - // Raise visibility to ease testing. using ProfileSyncService::NotifyObservers; @@ -49,11 +44,9 @@ syncer::WeakHandle<syncer::JsEventHandler> GetJsEventHandler() override; private: - syncer::TestIdFactory id_factory_; - DISALLOW_COPY_AND_ASSIGN(TestProfileSyncService); }; -} // namespace browser_sync +} // namespace syncer -#endif // COMPONENTS_BROWSER_SYNC_TEST_PROFILE_SYNC_SERVICE_H_ +#endif // COMPONENTS_SYNC_DRIVER_TEST_PROFILE_SYNC_SERVICE_H_
diff --git a/components/sync/engine_impl/get_updates_processor.cc b/components/sync/engine_impl/get_updates_processor.cc index 5171a2c..faeff07 100644 --- a/components/sync/engine_impl/get_updates_processor.cc +++ b/components/sync/engine_impl/get_updates_processor.cc
@@ -5,7 +5,7 @@ #include "components/sync/engine_impl/get_updates_processor.h" #include <stddef.h> - +#include <string> #include <utility> #include "base/trace_event/trace_event.h" @@ -17,6 +17,7 @@ #include "components/sync/engine_impl/update_handler.h" #include "components/sync/nigori/keystore_keys_handler.h" #include "components/sync/syncable/syncable_read_transaction.h" +#include "third_party/protobuf/src/google/protobuf/repeated_field.h" namespace syncer { @@ -40,9 +41,12 @@ LOG(ERROR) << "Failed to receive encryption key from server."; return SyncerError(SyncerError::SERVER_RESPONSE_VALIDATION_FAILED); } + + const google::protobuf::RepeatedPtrField<std::string>& raw_keys = + update_response.get_updates().encryption_keys(); success = context->model_type_registry()->keystore_keys_handler()->SetKeystoreKeys( - update_response.get_updates().encryption_keys()); + std::vector<std::string>(raw_keys.begin(), raw_keys.end())); DVLOG(1) << "GetUpdates returned " << update_response.get_updates().encryption_keys_size()
diff --git a/components/sync/engine_impl/sync_encryption_handler_impl.cc b/components/sync/engine_impl/sync_encryption_handler_impl.cc index 3a921b2d..3b9009a 100644 --- a/components/sync/engine_impl/sync_encryption_handler_impl.cc +++ b/components/sync/engine_impl/sync_encryption_handler_impl.cc
@@ -785,14 +785,14 @@ } bool SyncEncryptionHandlerImpl::SetKeystoreKeys( - const google::protobuf::RepeatedPtrField<google::protobuf::string>& keys) { + const std::vector<std::string>& keys) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); syncable::ReadTransaction trans(FROM_HERE, user_share_->directory.get()); - if (keys.size() == 0) + if (keys.empty()) return false; // The last key in the vector is the current keystore key. The others are kept // around for decryption only. - const std::string& raw_keystore_key = keys.Get(keys.size() - 1); + const std::string& raw_keystore_key = keys.back(); if (raw_keystore_key.empty()) return false; @@ -803,8 +803,8 @@ // Go through and save the old keystore keys. We always persist all keystore // keys the server sends us. old_keystore_keys_.resize(keys.size() - 1); - for (int i = 0; i < keys.size() - 1; ++i) - base::Base64Encode(keys.Get(i), &old_keystore_keys_[i]); + for (size_t i = 0; i < keys.size() - 1; ++i) + base::Base64Encode(keys[i], &old_keystore_keys_[i]); Cryptographer* cryptographer = &UnlockVaultMutable(&trans)->cryptographer;
diff --git a/components/sync/engine_impl/sync_encryption_handler_impl.h b/components/sync/engine_impl/sync_encryption_handler_impl.h index 24d17b11..c0485bb6 100644 --- a/components/sync/engine_impl/sync_encryption_handler_impl.h +++ b/components/sync/engine_impl/sync_encryption_handler_impl.h
@@ -84,8 +84,7 @@ // KeystoreKeysHandler implementation. bool NeedKeystoreKey() const override; - bool SetKeystoreKeys( - const google::protobuf::RepeatedPtrField<std::string>& keys) override; + bool SetKeystoreKeys(const std::vector<std::string>& keys) override; // Unsafe getters. Use only if sync is not up and running and there is no risk // of other threads calling this.
diff --git a/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc index 95af66a..baa6fdd 100644 --- a/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc +++ b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
@@ -84,13 +84,6 @@ void(const SyncEncryptionHandler::NigoriState&)); // NOLINT }; -google::protobuf::RepeatedPtrField<google::protobuf::string> -BuildEncryptionKeyProto(const std::string& encryption_key) { - google::protobuf::RepeatedPtrField<google::protobuf::string> keys; - keys.Add()->assign(encryption_key); - return keys; -} - } // namespace class SyncEncryptionHandlerImplTest : public ::testing::Test { @@ -382,17 +375,11 @@ encryption_handler()->GetPassphraseType(trans.GetWrappedTrans())); } - // Builds a list of keys and call SyncEncryptionHandlerImpl::SetKeystoreKeys. - void SetupKeystoreKeys(const std::vector<std::string> keystore_keys) { - google::protobuf::RepeatedPtrField<google::protobuf::string> - proto_keystore_keys; - for (const std::string& keystore_key : keystore_keys) { - proto_keystore_keys.Add()->assign(keystore_key); - } - + // Calls SyncEncryptionHandlerImpl::SetKeystoreKeys(). + void SetupKeystoreKeys(const std::vector<std::string>& keystore_keys) { EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys(proto_keystore_keys); + encryption_handler()->SetKeystoreKeys(keystore_keys); PumpLoop(); Mock::VerifyAndClearExpectations(observer()); } @@ -847,8 +834,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, _)).Times(0); EXPECT_FALSE(GetCryptographer()->is_initialized()); EXPECT_TRUE(encryption_handler()->NeedKeystoreKey()); - EXPECT_FALSE(encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(std::string()))); + EXPECT_FALSE(encryption_handler()->SetKeystoreKeys({""})); EXPECT_TRUE(encryption_handler()->NeedKeystoreKey()); Mock::VerifyAndClearExpectations(observer()); @@ -856,9 +842,6 @@ const char kRawOldKeystoreKey[] = "old_keystore_key"; std::string old_keystore_key; base::Base64Encode(kRawOldKeystoreKey, &old_keystore_key); - google::protobuf::RepeatedPtrField<google::protobuf::string> keys; - keys.Add()->assign(kRawOldKeystoreKey); - keys.Add()->assign(kRawKeystoreKey); // Pass them to the encryption handler, triggering a migration and bootstrap // token update. @@ -871,7 +854,8 @@ OnPassphraseTypeChanged(PassphraseType::KEYSTORE_PASSPHRASE, _)); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)) .WillOnce(SaveArg<0>(&keystore_bootstrap)); - EXPECT_TRUE(encryption_handler()->SetKeystoreKeys(keys)); + EXPECT_TRUE(encryption_handler()->SetKeystoreKeys( + {kRawOldKeystoreKey, kRawKeystoreKey})); EXPECT_FALSE(encryption_handler()->NeedKeystoreKey()); EXPECT_FALSE(GetCryptographer()->is_initialized()); PumpLoop(); @@ -936,8 +920,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); Mock::VerifyAndClearExpectations(observer()); EXPECT_FALSE(encryption_handler()->MigratedToKeystore()); @@ -986,8 +969,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); Mock::VerifyAndClearExpectations(observer()); EXPECT_FALSE(encryption_handler()->MigratedToKeystore()); @@ -1057,8 +1039,7 @@ EXPECT_CALL(*observer(), OnCryptographerStateChanged(_)).Times(AnyNumber()); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); EXPECT_CALL(*observer(), OnPassphraseTypeChanged(PassphraseType::KEYSTORE_PASSPHRASE, _)); // The actual migration gets posted, so run all pending tasks. @@ -1094,8 +1075,7 @@ EXPECT_CALL(*observer(), OnCryptographerStateChanged(_)).Times(AnyNumber()); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); EXPECT_CALL(*observer(), OnPassphraseTypeChanged( PassphraseType::FROZEN_IMPLICIT_PASSPHRASE, _)); @@ -1155,8 +1135,7 @@ OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); EXPECT_CALL(*observer(), OnLocalSetPassphraseEncryption(_)) .WillOnce(testing::SaveArg<0>(&captured_nigori_state)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); // The actual migration gets posted, so run all pending tasks. PumpLoop(); @@ -1202,8 +1181,7 @@ EXPECT_CALL(*observer(), OnCryptographerStateChanged(_)).Times(AnyNumber()); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); EXPECT_CALL(*observer(), OnEncryptedTypesChanged(_, true)); SyncEncryptionHandler::NigoriState captured_nigori_state; EXPECT_CALL(*observer(), OnLocalSetPassphraseEncryption(_)) @@ -1260,8 +1238,7 @@ EXPECT_CALL(*observer(), OnPassphraseTypeChanged(PassphraseType::KEYSTORE_PASSPHRASE, _)); EXPECT_CALL(*observer(), OnCryptographerStateChanged(_)).Times(AnyNumber()); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); { WriteTransaction trans(FROM_HERE, user_share()); WriteNode nigori_node(&trans); @@ -1310,8 +1287,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); EXPECT_FALSE(encryption_handler()->MigratedToKeystore()); { @@ -1384,8 +1360,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); EXPECT_FALSE(encryption_handler()->MigratedToKeystore()); { @@ -1485,8 +1460,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); Mock::VerifyAndClearExpectations(observer()); @@ -1574,8 +1548,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); Mock::VerifyAndClearExpectations(observer()); @@ -1681,8 +1654,7 @@ OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN)); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); PumpLoop(); EXPECT_TRUE(encryption_handler()->MigratedToKeystore()); @@ -1740,8 +1712,7 @@ } EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); EXPECT_CALL(*observer(), OnPassphraseAccepted()); EXPECT_CALL(*observer(), @@ -2048,8 +2019,7 @@ EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); EXPECT_CALL(*observer(), OnPassphraseTypeChanged(PassphraseType::KEYSTORE_PASSPHRASE, _)); @@ -2171,12 +2141,9 @@ PassphraseType::IMPLICIT_PASSPHRASE); // Pass multiple keystore keys, signaling a rotation has happened. - google::protobuf::RepeatedPtrField<google::protobuf::string> keys; - keys.Add()->assign(kRawOldKeystoreKey); - keys.Add()->assign(kRawKeystoreKey); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys(keys); + encryption_handler()->SetKeystoreKeys({kRawOldKeystoreKey, kRawKeystoreKey}); PumpLoop(); Mock::VerifyAndClearExpectations(observer()); @@ -2239,12 +2206,9 @@ PassphraseType::IMPLICIT_PASSPHRASE); // Pass multiple keystore keys, signaling a rotation has happened. - google::protobuf::RepeatedPtrField<google::protobuf::string> keys; - keys.Add()->assign(kRawOldKeystoreKey); - keys.Add()->assign(kRawKeystoreKey); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys(keys); + encryption_handler()->SetKeystoreKeys({kRawOldKeystoreKey, kRawKeystoreKey}); PumpLoop(); Mock::VerifyAndClearExpectations(observer()); @@ -2286,12 +2250,9 @@ InitAndVerifyUnmigratedNigori(kCustomPass, PassphraseType::CUSTOM_PASSPHRASE); // Pass multiple keystore keys, signaling a rotation has happened. - google::protobuf::RepeatedPtrField<google::protobuf::string> keys; - keys.Add()->assign(kRawOldKeystoreKey); - keys.Add()->assign(kRawKeystoreKey); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys(keys); + encryption_handler()->SetKeystoreKeys({kRawOldKeystoreKey, kRawKeystoreKey}); PumpLoop(); Mock::VerifyAndClearExpectations(observer()); @@ -2341,15 +2302,12 @@ SyncEncryptionHandler::NigoriState captured_nigori_state; // Pass multiple keystore keys, signaling a rotation has happened. - google::protobuf::RepeatedPtrField<google::protobuf::string> keys; - keys.Add()->assign(kRawOldKeystoreKey); - keys.Add()->assign(kRawKeystoreKey); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); EXPECT_CALL(*observer(), OnCryptographerStateChanged(_)).Times(AnyNumber()); EXPECT_CALL(*observer(), OnLocalSetPassphraseEncryption(_)) .WillOnce(testing::SaveArg<0>(&captured_nigori_state)); - encryption_handler()->SetKeystoreKeys(keys); + encryption_handler()->SetKeystoreKeys({kRawOldKeystoreKey, kRawKeystoreKey}); PumpLoop(); Mock::VerifyAndClearExpectations(observer()); @@ -2401,8 +2359,7 @@ EXPECT_CALL(*observer(), OnCryptographerStateChanged(_)).Times(AnyNumber()); EXPECT_CALL(*observer(), OnBootstrapTokenUpdated(_, KEYSTORE_BOOTSTRAP_TOKEN)); - encryption_handler()->SetKeystoreKeys( - BuildEncryptionKeyProto(kRawKeystoreKey)); + encryption_handler()->SetKeystoreKeys({kRawKeystoreKey}); } // When we receive a remote Nigori with UNSPECIFIED as the key derivation
diff --git a/components/sync/model/fake_syncable_service.cc b/components/sync/model/fake_syncable_service.cc index fcdf12476..3d9440a 100644 --- a/components/sync/model/fake_syncable_service.cc +++ b/components/sync/model/fake_syncable_service.cc
@@ -31,7 +31,10 @@ return syncing_; } -// SyncableService implementation. +void FakeSyncableService::WaitUntilReadyToSync(base::OnceClosure done) { + std::move(done).Run(); +} + SyncMergeResult FakeSyncableService::MergeDataAndStartSyncing( ModelType type, const SyncDataList& initial_sync_data,
diff --git a/components/sync/model/fake_syncable_service.h b/components/sync/model/fake_syncable_service.h index 93e8878..3f2657d 100644 --- a/components/sync/model/fake_syncable_service.h +++ b/components/sync/model/fake_syncable_service.h
@@ -29,6 +29,7 @@ bool syncing() const; // SyncableService implementation. + void WaitUntilReadyToSync(base::OnceClosure done) override; SyncMergeResult MergeDataAndStartSyncing( ModelType type, const SyncDataList& initial_sync_data,
diff --git a/components/sync/model/syncable_service.cc b/components/sync/model/syncable_service.cc deleted file mode 100644 index 91ee623..0000000 --- a/components/sync/model/syncable_service.cc +++ /dev/null
@@ -1,19 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "components/sync/model/syncable_service.h" - -#include <utility> - -namespace syncer { - -SyncableService::SyncableService() {} - -SyncableService::~SyncableService() {} - -void SyncableService::WaitUntilReadyToSync(base::OnceClosure done) { - std::move(done).Run(); -} - -} // namespace syncer
diff --git a/components/sync/model/syncable_service.h b/components/sync/model/syncable_service.h index b7b68cf..d79c299 100644 --- a/components/sync/model/syncable_service.h +++ b/components/sync/model/syncable_service.h
@@ -26,8 +26,8 @@ // See crbug.com/100114. class SyncableService : public base::SupportsWeakPtr<SyncableService> { public: - SyncableService(); - virtual ~SyncableService(); + SyncableService() = default; + virtual ~SyncableService() = default; // A StartSyncFlare is useful when your SyncableService has a need for sync // to start ASAP. This is typically for one of three reasons: @@ -44,10 +44,9 @@ using StartSyncFlare = base::Callback<void(ModelType)>; // Allows the SyncableService to delay sync events (all below) until the model - // becomes ready to sync. - // TODO(crbug.com/939329): Make this pure to enforce discussion on all - // subclasses. - virtual void WaitUntilReadyToSync(base::OnceClosure done); + // becomes ready to sync. Callers must ensure there is no previous ongoing + // wait (per datatype, if the SyncableService supports multiple). + virtual void WaitUntilReadyToSync(base::OnceClosure done) = 0; // Informs the service to begin syncing the specified synced datatype |type|. // The service should then merge |initial_sync_data| into it's local data,
diff --git a/components/sync/nigori/keystore_keys_handler.h b/components/sync/nigori/keystore_keys_handler.h index ef5476c7..20a9dabe 100644 --- a/components/sync/nigori/keystore_keys_handler.h +++ b/components/sync/nigori/keystore_keys_handler.h
@@ -5,8 +5,8 @@ #ifndef COMPONENTS_SYNC_NIGORI_KEYSTORE_KEYS_HANDLER_H_ #define COMPONENTS_SYNC_NIGORI_KEYSTORE_KEYS_HANDLER_H_ -#include <google/protobuf/repeated_field.h> #include <string> +#include <vector> #include "base/macros.h" @@ -23,8 +23,7 @@ // Sets the keystore keys the server returned for this account. // Returns true on success, false otherwise. - virtual bool SetKeystoreKeys( - const google::protobuf::RepeatedPtrField<std::string>& keys) = 0; + virtual bool SetKeystoreKeys(const std::vector<std::string>& keys) = 0; private: DISALLOW_COPY_AND_ASSIGN(KeystoreKeysHandler);
diff --git a/components/sync/test/fake_sync_encryption_handler.cc b/components/sync/test/fake_sync_encryption_handler.cc index 2169f96..6dc60e4 100644 --- a/components/sync/test/fake_sync_encryption_handler.cc +++ b/components/sync/test/fake_sync_encryption_handler.cc
@@ -68,10 +68,10 @@ } bool FakeSyncEncryptionHandler::SetKeystoreKeys( - const google::protobuf::RepeatedPtrField<std::string>& keys) { - if (keys.size() == 0) + const std::vector<std::string>& keys) { + if (keys.empty()) return false; - std::string new_key = keys.Get(keys.size() - 1); + std::string new_key = keys.back(); if (new_key.empty()) return false; keystore_key_ = new_key;
diff --git a/components/sync/test/fake_sync_encryption_handler.h b/components/sync/test/fake_sync_encryption_handler.h index 2141139..f79e9762 100644 --- a/components/sync/test/fake_sync_encryption_handler.h +++ b/components/sync/test/fake_sync_encryption_handler.h
@@ -6,6 +6,7 @@ #define COMPONENTS_SYNC_TEST_FAKE_SYNC_ENCRYPTION_HANDLER_H_ #include <string> +#include <vector> #include "base/compiler_specific.h" #include "base/observer_list.h" @@ -52,8 +53,7 @@ // KeystoreKeysHandler implementation. bool NeedKeystoreKey() const override; - bool SetKeystoreKeys( - const google::protobuf::RepeatedPtrField<std::string>& keys) override; + bool SetKeystoreKeys(const std::vector<std::string>& keys) override; Cryptographer* cryptographer() { return &cryptographer_; }
diff --git a/components/test/data/autofill_assistant/autofill_assistant_target_website.html b/components/test/data/autofill_assistant/autofill_assistant_target_website.html index 55e279b..e8ef87b 100644 --- a/components/test/data/autofill_assistant/autofill_assistant_target_website.html +++ b/components/test/data/autofill_assistant/autofill_assistant_target_website.html
@@ -157,6 +157,19 @@ <input id="input6" type="field" value="" /> </div> + <div> + <input id="input_js_event_listener" type="text"> + <!-- Uses the 'key' property of a keydown event. --> + <script> + var t = document.getElementById("input_js_event_listener"); + t.addEventListener('keydown', e => { + var value = e.target.value; + e.preventDefault(); + e.target.value = value + e.key; + }); + </script> + </div> + <div id="testOuterHtml"><span>Span</span><p>Paragraph</p></div> <div id="hidden" style="display: none;">This text is hidden</div>
diff --git a/components/tracing/common/trace_startup_config.cc b/components/tracing/common/trace_startup_config.cc index 47b396fd..a8f1051 100644 --- a/components/tracing/common/trace_startup_config.cc +++ b/components/tracing/common/trace_startup_config.cc
@@ -80,13 +80,14 @@ return trace_config; } -TraceStartupConfig::TraceStartupConfig() - : is_enabled_(false), - is_enabled_from_background_tracing_(false), - trace_config_(base::trace_event::TraceConfig()), - startup_duration_(0), - should_trace_to_result_file_(false), - finished_writing_to_file_(false) { +TraceStartupConfig::TraceStartupConfig() { + auto* command_line = base::CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch(switches::kDisablePerfetto) && + command_line->GetSwitchValueASCII(switches::kTraceStartupOwner) == + "devtools") { + session_owner_ = SessionOwner::kDevToolsTracingHandler; + } + if (EnableFromCommandLine()) { DCHECK(IsEnabled()); } else if (EnableFromConfigFile()) { @@ -115,7 +116,8 @@ } bool TraceStartupConfig::IsTracingStartupForDuration() const { - return IsEnabled() && startup_duration_ > 0; + return IsEnabled() && startup_duration_ > 0 && + session_owner_ == SessionOwner::kTracingController; } base::trace_event::TraceConfig TraceStartupConfig::GetTraceConfig() const { @@ -157,6 +159,20 @@ #endif } +TraceStartupConfig::SessionOwner TraceStartupConfig::GetSessionOwner() const { + DCHECK(IsEnabled()); + return session_owner_; +} + +bool TraceStartupConfig::AttemptAdoptBySessionOwner(SessionOwner owner) { + if (IsEnabled() && GetSessionOwner() == owner && !session_adopted_) { + // The session can only be adopted once. + session_adopted_ = true; + return true; + } + return false; +} + bool TraceStartupConfig::EnableFromCommandLine() { auto* command_line = base::CommandLine::ForCurrentProcess();
diff --git a/components/tracing/common/trace_startup_config.h b/components/tracing/common/trace_startup_config.h index 675ce3e..bc132ab8 100644 --- a/components/tracing/common/trace_startup_config.h +++ b/components/tracing/common/trace_startup_config.h
@@ -76,6 +76,8 @@ // TracingControllerAndroid::GenerateTracingFilePath. class TRACING_EXPORT TraceStartupConfig { public: + enum class SessionOwner { kTracingController, kDevToolsTracingHandler }; + static TraceStartupConfig* GetInstance(); // Default minimum startup trace config with enough events to debug issues. @@ -119,6 +121,13 @@ return finished_writing_to_file_; } + SessionOwner GetSessionOwner() const; + + // Called by a potential session owner to determine if it should take + // ownership of the startup tracing session and begin tracing. Returns |true| + // if the passed |owner| should adopt the session. + bool AttemptAdoptBySessionOwner(SessionOwner owner); + private: // This allows constructor and destructor to be private and usable only // by the Singleton class. @@ -136,13 +145,15 @@ bool ParseTraceConfigFileContent(const std::string& content); - bool is_enabled_; - bool is_enabled_from_background_tracing_; + bool is_enabled_ = false; + bool is_enabled_from_background_tracing_ = false; base::trace_event::TraceConfig trace_config_; - int startup_duration_; - bool should_trace_to_result_file_; + int startup_duration_ = 0; + bool should_trace_to_result_file_ = false; base::FilePath result_file_; - bool finished_writing_to_file_; + bool finished_writing_to_file_ = false; + SessionOwner session_owner_ = SessionOwner::kTracingController; + bool session_adopted_ = false; DISALLOW_COPY_AND_ASSIGN(TraceStartupConfig); };
diff --git a/components/tracing/common/tracing_switches.cc b/components/tracing/common/tracing_switches.cc index 3899cf20..26125bf 100644 --- a/components/tracing/common/tracing_switches.cc +++ b/components/tracing/common/tracing_switches.cc
@@ -54,6 +54,18 @@ // "record-until-full" mode will be used. const char kTraceStartupRecordMode[] = "trace-startup-record-mode"; +// Specifies the coordinator of the startup tracing session. If the legacy +// tracing backend is used instead of perfetto, providing this flag is not +// necessary. Valid values: 'controller', 'devtools'. Defaults to 'controller'. +// +// If 'controller' is specified, the session is controlled and stopped via the +// TracingController (e.g. to implement the timeout). +// +// If 'devtools' is specified, the startup tracing session will be owned by +// DevTools and thus can be controlled (i.e. stopped) via the DevTools Tracing +// domain on the first session connected to the browser endpoint. +const char kTraceStartupOwner[] = "trace-startup-owner"; + // Disables the perfetto tracing backend. We need a separate command line // argument from the kTracingPerfettoBackend feature, because feature flags are // parsed too late during startup for early startup tracing support.
diff --git a/components/tracing/common/tracing_switches.h b/components/tracing/common/tracing_switches.h index d81c6d0..4bc094be 100644 --- a/components/tracing/common/tracing_switches.h +++ b/components/tracing/common/tracing_switches.h
@@ -17,6 +17,7 @@ TRACING_EXPORT extern const char kTraceStartupDuration[]; TRACING_EXPORT extern const char kTraceStartupFile[]; TRACING_EXPORT extern const char kTraceStartupRecordMode[]; +TRACING_EXPORT extern const char kTraceStartupOwner[]; TRACING_EXPORT extern const char kDisablePerfetto[]; TRACING_EXPORT extern const char kPerfettoDisableInterning[]; TRACING_EXPORT extern const char kPerfettoOutputFile[];
diff --git a/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc b/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc index 5c0013aa..1542435 100644 --- a/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc +++ b/content/browser/accessibility/accessibility_tree_formatter_auralinux.cc
@@ -257,13 +257,19 @@ "class", "colcount", "colindex", + "colspan", + "coltext", "container-atomic", "container-busy", "container-live", "container-relevant", + "current", + "dropeffect", "display", "explicit-name", + "grabbed", "haspopup", + "hidden", "id", "keyshortcuts", "level", @@ -274,7 +280,10 @@ "roledescription", "rowcount", "rowindex", + "rowspan", + "rowtext", "setsize", + "sort", "src", "table-cell-index", "tag",
diff --git a/content/browser/appcache/appcache_storage_impl_unittest.cc b/content/browser/appcache/appcache_storage_impl_unittest.cc index 88bf3d7..0776fc0 100644 --- a/content/browser/appcache/appcache_storage_impl_unittest.cc +++ b/content/browser/appcache/appcache_storage_impl_unittest.cc
@@ -308,14 +308,13 @@ template <class Method> void RunTestOnIOThread(Method method) { - test_finished_event_.reset(new base::WaitableEvent( - base::WaitableEvent::ResetPolicy::AUTOMATIC, - base::WaitableEvent::InitialState::NOT_SIGNALED)); + base::RunLoop run_loop; + test_finished_cb_ = run_loop.QuitClosure(); io_runner->PostTask( FROM_HERE, base::BindOnce(&AppCacheStorageImplTest::MethodWrapper<Method>, base::Unretained(this), method)); - test_finished_event_->Wait(); + run_loop.Run(); } void SetUpTest() { @@ -354,7 +353,7 @@ void TestFinishedUnwound() { TearDownTest(); - test_finished_event_->Signal(); + std::move(test_finished_cb_).Run(); } void PushNextTask(base::OnceClosure task) { @@ -1809,7 +1808,7 @@ // Data members -------------------------------------------------- - std::unique_ptr<base::WaitableEvent> test_finished_event_; + base::OnceClosure test_finished_cb_; base::stack<base::OnceClosure> task_stack_; std::unique_ptr<AppCacheServiceImpl> service_; std::unique_ptr<MockStorageDelegate> delegate_;
diff --git a/content/browser/appcache/appcache_update_job_unittest.cc b/content/browser/appcache/appcache_update_job_unittest.cc index b858764..b1b85de5 100644 --- a/content/browser/appcache/appcache_update_job_unittest.cc +++ b/content/browser/appcache/appcache_update_job_unittest.cc
@@ -15,6 +15,7 @@ #include "base/location.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" +#include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/strings/stringprintf.h" @@ -726,15 +727,11 @@ // when it goes out of scope. template <class Method> void RunTestOnIOThread(Method method) { - event_.reset(new base::WaitableEvent( - base::WaitableEvent::ResetPolicy::AUTOMATIC, - base::WaitableEvent::InitialState::NOT_SIGNALED)); - + base::RunLoop run_loop; + test_completed_cb_ = run_loop.QuitClosure(); base::PostTaskWithTraits(FROM_HERE, {BrowserThread::IO}, base::BindOnce(method, base::Unretained(this))); - - // Wait until task is done before exiting the test. - event_->Wait(); + run_loop.Run(); } void InitializeFactory() { @@ -3468,7 +3465,7 @@ response_infos_.clear(); service_.reset(nullptr); - event_->Signal(); + std::move(test_completed_cb_).Run(); } void MakeService() { @@ -3824,7 +3821,7 @@ std::unique_ptr<MockAppCacheService> service_; scoped_refptr<AppCacheGroup> group_; scoped_refptr<AppCache> protect_newest_cache_; - std::unique_ptr<base::WaitableEvent> event_; + base::OnceClosure test_completed_cb_; std::unique_ptr<AppCacheResponseWriter> response_writer_;
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index bf5367d..4c5c2fb 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc
@@ -303,11 +303,6 @@ } #endif // defined(USE_GLIB) -void OnStoppedStartupTracing(const base::FilePath& trace_file) { - VLOG(0) << "Completed startup tracing to " << trace_file.value(); - tracing::TraceStartupConfig::GetInstance()->OnTraceToResultFileFinished(); -} - // Tell compiler not to inline this function so it's possible to tell what // thread was unresponsive by inspecting the callstack. NOINLINE void ResetThread_IO( @@ -792,7 +787,10 @@ skia::SkiaMemoryDumpProvider::GetInstance(), "Skia", nullptr); base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( sql::SqlMemoryDumpProvider::GetInstance(), "Sql", nullptr); +#if !defined(OS_CHROMEOS) + // Chrome Remote Desktop needs TransitionalURLLoaderFactoryOwner on ChromeOS. network::TransitionalURLLoaderFactoryOwner::DisallowUsageInProcess(); +#endif } int BrowserMainLoop::PreCreateThreads() { @@ -1183,10 +1181,6 @@ #endif } -void BrowserMainLoop::StopStartupTracingTimer() { - startup_trace_timer_.Stop(); -} - void BrowserMainLoop::InitializeMainThread() { TRACE_EVENT0("startup", "BrowserMainLoop::InitializeMainThread"); base::PlatformThread::SetName("CrBrowserMain"); @@ -1597,25 +1591,9 @@ // Start startup tracing through TracingController's interface. TraceLog has // been enabled in content_main_runner where threads are not available. Now We // need to start tracing for all other tracing agents, which require threads. - auto* trace_startup_config = tracing::TraceStartupConfig::GetInstance(); - if (trace_startup_config->IsEnabled()) { - // This checks kTraceConfigFile switch. - TracingController::GetInstance()->StartTracing( - trace_startup_config->GetTraceConfig(), - TracingController::StartTracingDoneCallback()); - } else if (parsed_command_line_.HasSwitch(switches::kTraceToConsole)) { - TracingController::GetInstance()->StartTracing( - tracing::GetConfigForTraceToConsole(), - TracingController::StartTracingDoneCallback()); - } - // Start tracing to a file for certain duration if needed. Only do this after - // starting the main message loop to avoid calling - // MessagePumpForUI::ScheduleWork() before MessagePumpForUI::Start() as it - // will crash the browser. - if (trace_startup_config->IsTracingStartupForDuration()) { - TRACE_EVENT0("startup", "BrowserMainLoop::InitStartupTracingForDuration"); - InitStartupTracingForDuration(); - } + // We can only do this after starting the main message loop to avoid calling + // MessagePumpForUI::ScheduleWork() before MessagePumpForUI::Start(). + TracingControllerImpl::GetInstance()->StartStartupTracingIfNeeded(); if (parts_) { parts_->ServiceManagerConnectionStarted( @@ -1627,46 +1605,6 @@ #endif } -base::FilePath BrowserMainLoop::GetStartupTraceFileName() const { - base::FilePath trace_file; - - trace_file = tracing::TraceStartupConfig::GetInstance()->GetResultFile(); - if (trace_file.empty()) { -#if defined(OS_ANDROID) - TracingControllerAndroid::GenerateTracingFilePath(&trace_file); -#else - // Default to saving the startup trace into the current dir. - trace_file = base::FilePath().AppendASCII("chrometrace.log"); -#endif - } - - return trace_file; -} - -void BrowserMainLoop::InitStartupTracingForDuration() { - DCHECK(tracing::TraceStartupConfig::GetInstance() - ->IsTracingStartupForDuration()); - - startup_trace_file_ = GetStartupTraceFileName(); - - startup_trace_timer_.Start( - FROM_HERE, - base::TimeDelta::FromSeconds( - tracing::TraceStartupConfig::GetInstance()->GetStartupDuration()), - this, &BrowserMainLoop::EndStartupTracing); -} - -void BrowserMainLoop::EndStartupTracing() { - // Do nothing if startup tracing is already stopped. - if (!tracing::TraceStartupConfig::GetInstance()->IsEnabled()) - return; - - TracingController::GetInstance()->StopTracing( - TracingController::CreateFileEndpoint( - startup_trace_file_, - base::Bind(OnStoppedStartupTracing, startup_trace_file_))); -} - void BrowserMainLoop::InitializeAudio() { DCHECK(!audio_manager_);
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h index febdcd0..8016e6b2 100644 --- a/content/browser/browser_main_loop.h +++ b/content/browser/browser_main_loop.h
@@ -12,7 +12,6 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/task/task_scheduler/task_scheduler.h" -#include "base/timer/timer.h" #include "build/build_config.h" #include "content/browser/browser_process_sub_thread.h" #include "content/public/browser/browser_main_runner.h" @@ -33,7 +32,6 @@ namespace base { class CommandLine; -class FilePath; class HighResolutionTimerManager; class MemoryPressureMonitor; class PowerMonitor; @@ -196,12 +194,6 @@ } midi::MidiService* midi_service() const { return midi_service_.get(); } - base::FilePath GetStartupTraceFileName() const; - - const base::FilePath& startup_trace_file() const { - return startup_trace_file_; - } - // Returns the task runner for tasks that that are critical to producing a new // CompositorFrame on resize. On Mac this will be the task runner provided by // WindowResizeHelperMac, on other platforms it will just be the thread task @@ -233,8 +225,6 @@ void GetCompositingModeReporter( viz::mojom::CompositingModeReporterRequest request); - void StopStartupTracingTimer(); - #if defined(OS_MACOSX) && !defined(OS_IOS) media::DeviceMonitorMac* device_monitor_mac() const { return device_monitor_mac_.get(); @@ -265,8 +255,6 @@ void MainMessageLoopRun(); void InitializeMojo(); - void InitStartupTracingForDuration(); - void EndStartupTracing(); void InitializeAudio(); @@ -289,7 +277,6 @@ // PostCreateThreads() // BrowserThreadsStarted() // InitializeMojo() - // InitStartupTracingForDuration() // PreMainMessageLoopRun() // Members initialized on construction --------------------------------------- @@ -329,12 +316,6 @@ std::unique_ptr<ScreenOrientationDelegate> screen_orientation_delegate_; #endif - // Members initialized in |InitStartupTracingForDuration()| ------------------ - base::FilePath startup_trace_file_; - - // This timer initiates trace file saving. - base::OneShotTimer startup_trace_timer_; - // Members initialized in |Init()| ------------------------------------------- // Destroy |parts_| before |main_message_loop_| (required) and before other // classes constructed in content (but after |main_thread_|).
diff --git a/content/browser/browser_main_runner_impl.cc b/content/browser/browser_main_runner_impl.cc index 5e6c0fff..8c349a5 100644 --- a/content/browser/browser_main_runner_impl.cc +++ b/content/browser/browser_main_runner_impl.cc
@@ -25,6 +25,7 @@ #include "content/browser/browser_main_loop.h" #include "content/browser/browser_shutdown_profile_dumper.h" #include "content/browser/notification_service_impl.h" +#include "content/browser/tracing/tracing_controller_impl.h" #include "content/common/content_switches_internal.h" #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" @@ -181,26 +182,9 @@ main_loop_->PreShutdown(); - // If startup tracing has not been finished yet, replace it's dumper - // with special version, which would save trace file on exit (i.e. - // startup tracing becomes a version of shutdown tracing). - // There are two cases: - // 1. Startup duration is not reached. - // 2. Or if the trace should be saved to file for --trace-config-file flag. - std::unique_ptr<BrowserShutdownProfileDumper> startup_profiler; - if (tracing::TraceStartupConfig::GetInstance() - ->IsTracingStartupForDuration()) { - main_loop_->StopStartupTracingTimer(); - if (main_loop_->startup_trace_file() != - base::FilePath().AppendASCII("none")) { - startup_profiler.reset( - new BrowserShutdownProfileDumper(main_loop_->startup_trace_file())); - } - } else if (tracing::TraceStartupConfig::GetInstance() - ->ShouldTraceToResultFile()) { - base::FilePath result_file = main_loop_->GetStartupTraceFileName(); - startup_profiler.reset(new BrowserShutdownProfileDumper(result_file)); - } + // Finalize the startup tracing session if it is still active. + std::unique_ptr<BrowserShutdownProfileDumper> startup_profiler = + TracingControllerImpl::GetInstance()->FinalizeStartupTracingIfNeeded(); // The shutdown tracing got enabled in AttemptUserExit earlier, but someone // needs to write the result to disc. For that a dumper needs to get created
diff --git a/content/browser/devtools/protocol/tracing_handler.cc b/content/browser/devtools/protocol/tracing_handler.cc index 6b4d0e6..1e1ecbe 100644 --- a/content/browser/devtools/protocol/tracing_handler.cc +++ b/content/browser/devtools/protocol/tracing_handler.cc
@@ -24,6 +24,7 @@ #include "base/trace_event/memory_dump_manager.h" #include "base/trace_event/trace_event_impl.h" #include "base/trace_event/tracing_agent.h" +#include "build/build_config.h" #include "components/tracing/common/trace_startup_config.h" #include "content/browser/devtools/devtools_agent_host_impl.h" #include "content/browser/devtools/devtools_frame_trace_recorder.h" @@ -41,7 +42,10 @@ #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h" +#include "services/tracing/public/cpp/perfetto/perfetto_config.h" +#include "services/tracing/public/cpp/tracing_features.h" #include "services/tracing/public/mojom/constants.mojom.h" +#include "services/tracing/public/mojom/perfetto_service.mojom.h" #ifdef OS_ANDROID #include "content/browser/renderer_host/compositor_impl_android.h" @@ -122,7 +126,7 @@ } private: - ~DevToolsTraceEndpointProxy() override {} + ~DevToolsTraceEndpointProxy() override = default; base::WeakPtr<TracingHandler> tracing_handler_; }; @@ -160,7 +164,7 @@ } private: - ~DevToolsStreamEndpoint() override {} + ~DevToolsStreamEndpoint() override = default; scoped_refptr<DevToolsStreamFile> stream_; base::WeakPtr<TracingHandler> tracing_handler_; @@ -208,8 +212,253 @@ } } +// We currently don't support concurrent tracing sessions, but are planning to. +// For the time being, we're using this flag as a workaround to prevent devtools +// users from accidentally starting two concurrent sessions. +// TODO(eseckler): Remove once we add support for concurrent sessions to the +// perfetto backend. +static bool g_any_agent_tracing = false; + } // namespace +class TracingHandler::TracingSession { + public: + TracingSession() = default; + virtual ~TracingSession() = default; + + virtual void EnableTracing( + const base::trace_event::TraceConfig& chrome_config, + base::OnceClosure on_recording_enabled_callback) = 0; + virtual void AdoptStartupTracingSession() = 0; + virtual void ChangeTraceConfig( + const base::trace_event::TraceConfig& chrome_config) = 0; + virtual void DisableTracing( + bool use_proto_format, + const std::string& agent_label, + const scoped_refptr<TracingController::TraceDataEndpoint>& endpoint) = 0; + virtual void GetBufferUsage( + base::OnceCallback<void(float percent_full, + size_t approximate_event_count)> + on_buffer_usage_callback) = 0; + + private: + DISALLOW_COPY_AND_ASSIGN(TracingSession); +}; + +class TracingHandler::LegacyTracingSession + : public TracingHandler::TracingSession { + public: + void EnableTracing(const base::trace_event::TraceConfig& chrome_config, + base::OnceClosure on_recording_enabled_callback) override { + DCHECK(!TracingController::GetInstance()->IsTracing()); + TracingController::GetInstance()->StartTracing( + chrome_config, std::move(on_recording_enabled_callback)); + } + + void AdoptStartupTracingSession() override { + // Nothing to do for legacy tracing here (tracing is already active). + DCHECK(TracingController::GetInstance()->IsTracing()); + } + + void ChangeTraceConfig( + const base::trace_event::TraceConfig& chrome_config) override { + TracingController::GetInstance()->StartTracing( + chrome_config, TracingController::StartTracingDoneCallback()); + } + + void DisableTracing(bool use_proto_format, + const std::string& agent_label, + const scoped_refptr<TracingController::TraceDataEndpoint>& + endpoint) override { + DCHECK(!use_proto_format); + TracingController::GetInstance()->StopTracing(endpoint, agent_label); + } + + void GetBufferUsage(base::OnceCallback<void(float percent_full, + size_t approximate_event_count)> + on_buffer_usage_callback) override { + TracingController::GetInstance()->GetTraceBufferUsage( + std::move(on_buffer_usage_callback)); + } +}; + +class TracingHandler::PerfettoTracingSession + : public TracingHandler::TracingSession, + public tracing::mojom::TracingSession, + public mojo::DataPipeDrainer::Client { + public: + ~PerfettoTracingSession() override { +#if DCHECK_IS_ON() + DCHECK(!tracing_active_); +#endif + } + + // TracingHandler::TracingSession implementation: + void EnableTracing(const base::trace_event::TraceConfig& chrome_config, + base::OnceClosure on_recording_enabled_callback) override { +#if DCHECK_IS_ON() + DCHECK(!tracing_active_); + tracing_active_ = true; +#endif + ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( + tracing::mojom::kServiceName, &consumer_host_); + + perfetto::TraceConfig perfetto_config = + CreatePerfettoConfiguration(chrome_config); + + tracing::mojom::TracingSessionPtr tracing_session; + binding_.Bind(mojo::MakeRequest(&tracing_session)); + binding_.set_connection_error_handler( + base::BindOnce(&PerfettoTracingSession::OnTracingSessionEnded, + base::Unretained(this))); + + on_recording_enabled_callback_ = std::move(on_recording_enabled_callback); + consumer_host_->EnableTracing(std::move(tracing_session), + std::move(perfetto_config)); + } + + void AdoptStartupTracingSession() override { + // Start a perfetto tracing session, which will claim startup tracing data. + DCHECK(!TracingController::GetInstance()->IsTracing()); + EnableTracing(tracing::TraceStartupConfig::GetInstance()->GetTraceConfig(), + base::OnceClosure()); + } + + void ChangeTraceConfig( + const base::trace_event::TraceConfig& chrome_config) override { + auto perfetto_config = CreatePerfettoConfiguration(chrome_config); + consumer_host_->ChangeTraceConfig(perfetto_config); + } + + void DisableTracing(bool use_proto_format, + const std::string& agent_label, + const scoped_refptr<TracingController::TraceDataEndpoint>& + endpoint) override { + use_proto_format_ = use_proto_format; + agent_label_ = agent_label; + endpoint_ = endpoint; +#if DCHECK_IS_ON() + tracing_active_ = false; +#endif + + if (!use_proto_format_) { + mojo::DataPipe data_pipe; + drainer_ = std::make_unique<mojo::DataPipeDrainer>( + this, std::move(data_pipe.consumer_handle)); + consumer_host_->DisableTracingAndEmitJson( + agent_label_, std::move(data_pipe.producer_handle), + base::BindOnce(&PerfettoTracingSession::OnReadBuffersComplete, + base::Unretained(this))); + } else { + // The host will close the TracingSession connection, calling + // OnTracingSessionEnded(), once tracing was disabled. + consumer_host_->DisableTracing(); + } + } + + void GetBufferUsage(base::OnceCallback<void(float percent_full, + size_t approximate_event_count)> + on_buffer_usage_callback) override { + DCHECK(on_buffer_usage_callback); + consumer_host_->RequestBufferUsage(base::BindOnce( + &PerfettoTracingSession::OnBufferUsage, base::Unretained(this), + std::move(on_buffer_usage_callback))); + } + + void OnBufferUsage(base::OnceCallback<void(float percent_full, + size_t approximate_event_count)> + on_buffer_usage_callback, + bool success, + float percent_full) { + if (!success) { + std::move(on_buffer_usage_callback).Run(0.0f, 0); + return; + } + std::move(on_buffer_usage_callback).Run(percent_full, 0); + } + + // tracing::mojom::TracingSession implementation: + void OnTracingEnabled() override { + if (on_recording_enabled_callback_) { + std::move(on_recording_enabled_callback_).Run(); + } + } + + private: + perfetto::TraceConfig CreatePerfettoConfiguration( + const base::trace_event::TraceConfig& chrome_config) { +#if DCHECK_IS_ON() + base::trace_event::TraceConfig processfilter_stripped_config(chrome_config); + processfilter_stripped_config.SetProcessFilterConfig( + base::trace_event::TraceConfig::ProcessFilterConfig()); + + // Ensure that the process filter is the only thing that gets changed + // in a configuration during a tracing session. + DCHECK((last_config_for_perfetto_.ToString() == + base::trace_event::TraceConfig().ToString()) || + (last_config_for_perfetto_.ToString() == + processfilter_stripped_config.ToString())); + last_config_for_perfetto_ = std::move(processfilter_stripped_config); +#endif + + return tracing::GetDefaultPerfettoConfig(chrome_config); + } + + void OnTracingSessionEnded() { + // If we're converting to JSON, we will receive the data via + // ConsumerHost::DisableTracingAndEmitJson(). + if (!use_proto_format_) + return; + + DCHECK(agent_label_.empty()); + mojo::DataPipe data_pipe; + drainer_ = std::make_unique<mojo::DataPipeDrainer>( + this, std::move(data_pipe.consumer_handle)); + consumer_host_->ReadBuffers( + std::move(data_pipe.producer_handle), + base::BindOnce(&PerfettoTracingSession::OnReadBuffersComplete, + base::Unretained(this))); + } + + // mojo::DataPipeDrainer::Client implementation: + void OnDataAvailable(const void* data, size_t num_bytes) override { + auto data_string = std::make_unique<std::string>( + reinterpret_cast<const char*>(data), num_bytes); + endpoint_->ReceiveTraceChunk(std::move(data_string)); + } + + void OnDataComplete() override { + data_complete_ = true; + MaybeTraceComplete(); + } + + void OnReadBuffersComplete() { + read_buffers_complete_ = true; + MaybeTraceComplete(); + } + + void MaybeTraceComplete() { + if (read_buffers_complete_ && data_complete_) + endpoint_->ReceiveTraceFinalContents(nullptr); + } + + mojo::Binding<tracing::mojom::TracingSession> binding_{this}; + tracing::mojom::ConsumerHostPtr consumer_host_; + + base::OnceClosure on_recording_enabled_callback_; + bool use_proto_format_; + std::string agent_label_; + scoped_refptr<TracingController::TraceDataEndpoint> endpoint_; + std::unique_ptr<mojo::DataPipeDrainer> drainer_; + bool data_complete_ = false; + bool read_buffers_complete_ = false; + +#if DCHECK_IS_ON() + bool tracing_active_ = false; + base::trace_event::TraceConfig last_config_for_perfetto_; +#endif +}; + TracingHandler::TracingHandler(FrameTreeNode* frame_tree_node_, DevToolsIOContext* io_context, bool use_binary_protocol) @@ -233,6 +482,20 @@ std::make_unique<DevToolsVideoConsumer>(base::BindRepeating( &TracingHandler::OnFrameFromVideoConsumer, base::Unretained(this))); } + + auto* startup_config = tracing::TraceStartupConfig::GetInstance(); + // Check if we should adopt the startup tracing session. Only the first + // session connected to the browser endpoint can own it. + if (frame_tree_node_ != nullptr || + !startup_config->AttemptAdoptBySessionOwner( + tracing::TraceStartupConfig::SessionOwner::kDevToolsTracingHandler)) { + return; + } + + DCHECK(tracing::TracingUsesPerfettoBackend()); + session_ = std::make_unique<PerfettoTracingSession>(); + session_->AdoptStartupTracingSession(); + g_any_agent_tracing = true; } TracingHandler::~TracingHandler() = default; @@ -257,7 +520,7 @@ } Response TracingHandler::Disable() { - if (did_initiate_recording_) + if (session_) StopTracing(nullptr, ""); return Response::OK(); } @@ -297,6 +560,7 @@ DCHECK(!trace_data_buffer_state_.in_string); DCHECK(!trace_data_buffer_state_.slashed); + session_.reset(); frontend_->TracingComplete(); } @@ -359,16 +623,20 @@ } void TracingHandler::OnTraceToStreamComplete(const std::string& stream_handle) { + session_.reset(); + std::string stream_format = (proto_format_ ? Tracing::StreamFormatEnum::Proto + : Tracing::StreamFormatEnum::Json); std::string stream_compression = (gzip_compression_ ? Tracing::StreamCompressionEnum::Gzip : Tracing::StreamCompressionEnum::None); - frontend_->TracingComplete(stream_handle, stream_compression); + frontend_->TracingComplete(stream_handle, stream_format, stream_compression); } void TracingHandler::Start(Maybe<std::string> categories, Maybe<std::string> options, Maybe<double> buffer_usage_reporting_interval, Maybe<std::string> transfer_mode, + Maybe<std::string> transfer_format, Maybe<std::string> transfer_compression, Maybe<Tracing::TraceConfig> config, std::unique_ptr<StartCallback> callback) { @@ -376,13 +644,29 @@ Tracing::Start::TransferModeEnum::ReturnAsStream; bool gzip_compression = transfer_compression.fromMaybe("") == Tracing::StreamCompressionEnum::Gzip; + bool proto_format = + transfer_format.fromMaybe("") == Tracing::StreamFormatEnum::Proto; + + if (proto_format && !tracing::TracingUsesPerfettoBackend()) { + callback->sendFailure(Response::Error( + "Proto format is only supported with the perfetto backend.")); + return; + } + + if (proto_format && !return_as_stream) { + callback->sendFailure(Response::Error( + "Proto format is only supported when using stream transfer mode.")); + return; + } + if (IsTracing()) { if (!did_initiate_recording_ && IsStartupTracingActive()) { // If tracing is already running because it was initiated by startup - // tracing, honor the transfer mode update, as that's the only way + // tracing, honor the transfer mode/format update, as that's the only way // for the client to communicate it. return_as_stream_ = return_as_stream; gzip_compression_ = gzip_compression; + proto_format_ = proto_format; } callback->sendFailure(Response::Error("Tracing is already started")); return; @@ -398,6 +682,7 @@ did_initiate_recording_ = true; return_as_stream_ = return_as_stream; gzip_compression_ = gzip_compression; + proto_format_ = proto_format; buffer_usage_reporting_interval_ = buffer_usage_reporting_interval.fromMaybe(0); @@ -439,10 +724,16 @@ SetupProcessFilter(gpu_pid, nullptr); - TracingController::GetInstance()->StartTracing( + if (tracing::TracingUsesPerfettoBackend()) { + session_ = std::make_unique<PerfettoTracingSession>(); + } else { + session_ = std::make_unique<LegacyTracingSession>(); + } + session_->EnableTracing( trace_config_, base::BindOnce(&TracingHandler::OnRecordingEnabled, weak_factory_.GetWeakPtr(), std::move(callback))); + g_any_agent_tracing = true; } void TracingHandler::SetupProcessFilter( @@ -492,15 +783,21 @@ trace_config_.SetProcessFilterConfig( base::trace_event::TraceConfig::ProcessFilterConfig( included_process_ids)); - TracingController::GetInstance()->StartTracing( - trace_config_, TracingController::StartTracingDoneCallback()); + session_->ChangeTraceConfig(trace_config_); } Response TracingHandler::End() { // Startup tracing triggered by --trace-config-file is a special case, where // tracing is started automatically upon browser startup and can be stopped // via DevTools. - if (!did_initiate_recording_ && !IsStartupTracingActive()) + // TODO(eseckler): Remove this when we remove the legacy tracing backend. + if (!tracing::TracingUsesPerfettoBackend() && IsStartupTracingActive()) { + DCHECK(!session_ && !did_initiate_recording_); + session_ = std::make_unique<LegacyTracingSession>(); + session_->AdoptStartupTracingSession(); + } + + if (!session_) return Response::Error("Tracing is not started"); scoped_refptr<TracingController::TraceDataEndpoint> endpoint; @@ -526,6 +823,7 @@ void TracingHandler::GetCategories( std::unique_ptr<GetCategoriesCallback> callback) { + // TODO(eseckler): Support this via the perfetto service too. TracingController::GetInstance()->GetCategories( base::BindOnce(&TracingHandler::OnCategoriesReceived, weak_factory_.GetWeakPtr(), std::move(callback))); @@ -638,24 +936,29 @@ buffer_usage_poll_timer_.reset(new base::RepeatingTimer()); buffer_usage_poll_timer_->Start( FROM_HERE, interval, - base::Bind(base::IgnoreResult(&TracingController::GetTraceBufferUsage), - base::Unretained(TracingController::GetInstance()), - base::Bind(&TracingHandler::OnBufferUsage, - weak_factory_.GetWeakPtr()))); + base::BindRepeating(&TracingHandler::UpdateBufferUsage, + weak_factory_.GetWeakPtr())); +} + +void TracingHandler::UpdateBufferUsage() { + session_->GetBufferUsage(base::BindOnce(&TracingHandler::OnBufferUsage, + weak_factory_.GetWeakPtr())); } void TracingHandler::StopTracing( const scoped_refptr<TracingController::TraceDataEndpoint>& endpoint, const std::string& agent_label) { + DCHECK(session_); buffer_usage_poll_timer_.reset(); - TracingController::GetInstance()->StopTracing(endpoint, agent_label); + session_->DisableTracing(proto_format_, agent_label, endpoint); did_initiate_recording_ = false; + g_any_agent_tracing = false; if (video_consumer_) video_consumer_->StopCapture(); } bool TracingHandler::IsTracing() const { - return TracingController::GetInstance()->IsTracing(); + return TracingController::GetInstance()->IsTracing() || g_any_agent_tracing; } void TracingHandler::EmitFrameTree() { @@ -693,8 +996,7 @@ SetupProcessFilter(base::kNullProcessId, navigation_handle->GetRenderFrameHost()); - TracingController::GetInstance()->StartTracing( - trace_config_, TracingController::StartTracingDoneCallback()); + session_->ChangeTraceConfig(trace_config_); } void TracingHandler::FrameDeleted(RenderFrameHostImpl* frame_host) {
diff --git a/content/browser/devtools/protocol/tracing_handler.h b/content/browser/devtools/protocol/tracing_handler.h index 5c05b31..2584945 100644 --- a/content/browser/devtools/protocol/tracing_handler.h +++ b/content/browser/devtools/protocol/tracing_handler.h
@@ -67,6 +67,7 @@ Maybe<std::string> options, Maybe<double> buffer_usage_reporting_interval, Maybe<std::string> transfer_mode, + Maybe<std::string> transfer_format, Maybe<std::string> transfer_compression, Maybe<Tracing::TraceConfig> config, std::unique_ptr<StartCallback> callback) override; @@ -83,6 +84,10 @@ private: friend class TracingHandlerTest; + class TracingSession; + class LegacyTracingSession; + class PerfettoTracingSession; + struct TraceDataBufferState { public: std::string data; @@ -108,6 +113,7 @@ const std::string& trace_fragment); void SetupTimer(double usage_reporting_interval); + void UpdateBufferUsage(); void StopTracing( const scoped_refptr<TracingController::TraceDataEndpoint>& endpoint, const std::string& agent_label); @@ -133,11 +139,13 @@ bool did_initiate_recording_; bool return_as_stream_; bool gzip_compression_; + bool proto_format_; double buffer_usage_reporting_interval_; TraceDataBufferState trace_data_buffer_state_; std::unique_ptr<DevToolsVideoConsumer> video_consumer_; int number_of_screenshots_from_video_consumer_ = 0; base::trace_event::TraceConfig trace_config_; + std::unique_ptr<TracingSession> session_; base::WeakPtrFactory<TracingHandler> weak_factory_; FRIEND_TEST_ALL_PREFIXES(TracingHandlerTest,
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index 271666a9..29eaa3b 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -7060,6 +7060,84 @@ EvalJs(web_contents, "self.origin")); } +// This test simulates a same-document navigation, being restarted as a +// cross-document one. It starts a network loader, but fails and an error page +// is committed instead. The RenderFrameHost selected initially for the initial +// navigation is not suitable for the error page. It needs to be reset when +// restarting the navigation. See https://crbug.com/936962. +IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTestNoServer, + NavigationRestartedAsCrossDocumentFailToLoad) { + net::test_server::ControllableHttpResponse response_success( + embedded_test_server(), "/title1.html"); + net::test_server::ControllableHttpResponse response_error( + embedded_test_server(), "/title1.html"); + ASSERT_TRUE(embedded_test_server()->Start()); + + WebContentsImpl* web_contents = + static_cast<WebContentsImpl*>(shell()->web_contents()); + FrameTreeNode* root = web_contents->GetFrameTree()->root(); + + // 1. Navigate to a simple page with no-cache, no-store. + GURL start_url(embedded_test_server()->GetURL("a.com", "/title1.html")); + { + UrlCommitObserver history_commit_observer(root, start_url); + shell()->LoadURL(start_url); + response_success.WaitForRequest(); + response_success.Send( + "HTTP/1.1 200 OK\r\n" + "Content-Type: text/html; charset=utf-8\r\n" + "Cache-Control: no-cache, no-store\r\n" + "\r\n" + "The server speaks HTTP!"); + response_success.Done(); + history_commit_observer.Wait(); + EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex()); + } + + // 2. Perform a same-document navigation forward. + { + GURL same_document_url( + embedded_test_server()->GetURL("a.com", "/title1.html#foo")); + EXPECT_TRUE(NavigateToURL(shell(), same_document_url)); + EXPECT_EQ(1, web_contents->GetController().GetLastCommittedEntryIndex()); + } + + // 3. Create a HistoryNavigationBeforeCommitInjector, which will perform a + // same-document back navigation just before a cross-origin, same process + // navigation commits. This triggers a race condition and forces the + // same-document navigation to restart as a cross-document one. + TestNavigationManager error_page(shell()->web_contents(), start_url); + { + GURL cross_origin_url( + embedded_test_server()->GetURL("suborigin.a.com", "/title2.html")); + HistoryNavigationBeforeCommitInjector trigger(web_contents, + cross_origin_url); + + // Navigate cross-origin, waiting for the commit to occur. + UrlCommitObserver cross_origin_commit_observer(root, cross_origin_url); + shell()->LoadURL(cross_origin_url); + cross_origin_commit_observer.Wait(); + EXPECT_EQ(cross_origin_url, web_contents->GetLastCommittedURL()); + EXPECT_EQ(2, web_contents->GetController().GetLastCommittedEntryIndex()); + EXPECT_TRUE(trigger.did_trigger_history_navigation()); + } + + // 4. The restarted navigation is now loading its content from the network, + // and the server produces invalid content. An error page is displayed. + { + response_error.WaitForRequest(); + response_error.Send("The server doesn't support HTTP anymore"); + response_error.Done(); + error_page.WaitForNavigationFinished(); + EXPECT_FALSE(error_page.was_successful()); + WaitForLoadStop(shell()->web_contents()); + EXPECT_EQ(0, web_contents->GetController().GetLastCommittedEntryIndex()); + EXPECT_EQ( + PAGE_TYPE_ERROR, + web_contents->GetController().GetLastCommittedEntry()->GetPageType()); + } +} + // Test that verifies that Referer and Origin http headers are correctly sent // to the final destination of a cross-site POST with a few redirects thrown in. // This test is somewhat related to https://crbug.com/635400.
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index dedfb1d..ad205d1 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -656,6 +656,8 @@ void NavigationRequest::BeginNavigation() { DCHECK(!loader_); + DCHECK(!render_frame_host_); + // TODO(https://crbug.com/936962): Remove this when the bug is fixed. if (loader_) { FrameMsg_Navigate_Type::Value navigation_type = @@ -846,6 +848,11 @@ DCHECK(!loader_); navigation_handle_.reset(); + // Reset the previously selected RenderFrameHost. This is expected to be null + // at the beginning of a new navigation. See https://crbug.com/936962. + DCHECK(render_frame_host_); + render_frame_host_ = nullptr; + // Convert the navigation type to the appropriate cross-document one. if (common_params_.navigation_type == FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT) { @@ -1373,8 +1380,9 @@ // Sanity check that we haven't changed the RenderFrameHost picked for the // error page in OnRequestFailedInternal when running the WillFailRequest // checks. - // TODO(https://crbug.com/636952): Replace this by a CHECK when the bug is + // TODO(https://crbug.com/936962): Replace this by a CHECK when the bug is // fixed. + DCHECK(!render_frame_host_ || render_frame_host_ == render_frame_host); if (render_frame_host_ && render_frame_host_ != render_frame_host) base::debug::DumpWithoutCrashing(); render_frame_host_ = render_frame_host;
diff --git a/content/browser/renderer_host/compositor_impl_android.h b/content/browser/renderer_host/compositor_impl_android.h index b313fad8..1d581930 100644 --- a/content/browser/renderer_host/compositor_impl_android.h +++ b/content/browser/renderer_host/compositor_impl_android.h
@@ -111,6 +111,7 @@ // LayerTreeHostClient implementation. void WillBeginMainFrame() override {} void DidBeginMainFrame() override {} + void WillUpdateLayers() override {} void DidUpdateLayers() override; void BeginMainFrame(const viz::BeginFrameArgs& args) override {} void BeginMainFrameNotExpectedSoon() override {}
diff --git a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc index 35fdee9..041c6d2 100644 --- a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc +++ b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.cc
@@ -384,11 +384,10 @@ } // Post a task to catch timeouts should one of the // tasks will eventually not reply. + timeout_callback_.Reset(base::BindRepeating( + &DWriteFontLookupTableBuilder::OnTimeout, base::Unretained(this))); base::SequencedTaskRunnerHandle::Get()->PostDelayedTask( - FROM_HERE, - base::BindOnce(&DWriteFontLookupTableBuilder::OnTimeout, - base::Unretained(this)), - kFontIndexingTimeout); + FROM_HERE, timeout_callback_.callback(), kFontIndexingTimeout); } // static @@ -470,7 +469,7 @@ [&extracted_names, &hr, &font](DWRITE_INFORMATIONAL_STRING_ID font_info_string_id) { // Now get names, and make them point to the added font. - IDWriteLocalizedStrings* font_id_keyed_names; + Microsoft::WRL::ComPtr<IDWriteLocalizedStrings> font_id_keyed_names; BOOL has_id_keyed_names; { base::ScopedBlockingCall scoped_blocking_call( @@ -481,7 +480,7 @@ return; } - ExtractCaseFoldedLocalizedStrings(font_id_keyed_names, + ExtractCaseFoldedLocalizedStrings(font_id_keyed_names.Get(), &extracted_names); }; @@ -550,20 +549,22 @@ DCHECK(!font_table_built_.IsSignaled()); ScopedAutoSignal auto_signal(&font_table_built_); - bool timed_out = false; - if (base::TimeTicks::Now() - start_time_ > kFontIndexingTimeout) { - font_unique_name_table_->clear_fonts(); - font_unique_name_table_->clear_name_map(); - timed_out = true; - } - UMA_HISTOGRAM_BOOLEAN("DirectWrite.Fonts.Proxy.TableBuildTimedOut", - timed_out); + timeout_callback_.Cancel(); // Make sure that whatever happens in the remainder of this function the // FontUniqueNameTable object gets released by moving it to a local variable. std::unique_ptr<blink::FontUniqueNameTable> font_unique_name_table( std::move(font_unique_name_table_)); + bool timed_out = false; + if (base::TimeTicks::Now() - start_time_ > kFontIndexingTimeout) { + font_unique_name_table->clear_fonts(); + font_unique_name_table->clear_name_map(); + timed_out = true; + } + UMA_HISTOGRAM_BOOLEAN("DirectWrite.Fonts.Proxy.TableBuildTimedOut", + timed_out); + unsigned num_font_files = font_unique_name_table->fonts_size(); // Sort names for using binary search on this proto in FontTableMatcher.
diff --git a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.h b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.h index 09e02e7..0f59849 100644 --- a/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.h +++ b/content/browser/renderer_host/dwrite_font_lookup_table_builder_win.h
@@ -12,6 +12,7 @@ #include <string> #include <vector> +#include "base/cancelable_callback.h" #include "base/files/file_path.h" #include "base/macros.h" #include "base/memory/read_only_shared_memory_region.h" @@ -164,6 +165,7 @@ bool caching_enabled_ = true; base::Optional<base::WaitableEvent> hang_event_for_testing_; + base::CancelableCallback<void()> timeout_callback_; DISALLOW_COPY_AND_ASSIGN(DWriteFontLookupTableBuilder); };
diff --git a/content/browser/renderer_host/input/passthrough_touch_event_queue.cc b/content/browser/renderer_host/input/passthrough_touch_event_queue.cc index 625f3d1..170efa1 100644 --- a/content/browser/renderer_host/input/passthrough_touch_event_queue.cc +++ b/content/browser/renderer_host/input/passthrough_touch_event_queue.cc
@@ -305,28 +305,36 @@ PassthroughTouchEventQueue::PreFilterResult PassthroughTouchEventQueue::FilterBeforeForwarding(const WebTouchEvent& event) { PreFilterResult result = FilterBeforeForwardingImpl(event); - if (result == PreFilterResult::kFilteredTimeout) - return PreFilterResult::kFilteredTimeout; + if (result == PreFilterResult::kFilteredTimeout || + result == PreFilterResult::kFilteredNoNonstationaryPointers) + return result; // Override non-timeout filter results based on the Finch trial that bypasses // the filter. We do this here so that the event still has the opportunity to // update any internal state that's necessary to handle future events // (i.e. future touch moves might be dropped, even if this touch start isn't // due to a filter override). - if (skip_touch_filter_) { - if (events_to_always_forward_ == - features::kSkipBrowserTouchFilterTypeParamValueAll) { - return PreFilterResult::kUnfiltered; - } else if (events_to_always_forward_ == - features::kSkipBrowserTouchFilterTypeParamValueDiscrete && - event.GetType() != WebInputEvent::kTouchMove) { - return PreFilterResult::kUnfiltered; - } - } + if (!ShouldFilterForEvent(event)) + return PreFilterResult::kUnfiltered; return result; } +bool PassthroughTouchEventQueue::ShouldFilterForEvent( + const blink::WebTouchEvent& event) { + // Always run all filtering if the SkipBrowserTouchFilter is disabled. + if (!skip_touch_filter_) + return true; + // If the experiment is enabled and all events are forwarded, always skip + // filtering. + if (events_to_always_forward_ == + features::kSkipBrowserTouchFilterTypeParamValueAll) + return false; + // If the experiment is enabled and only discrete events are forwarded, + // always run filtering for touchmove events only. + return event.GetType() == WebInputEvent::kTouchMove; +} + PassthroughTouchEventQueue::PreFilterResult PassthroughTouchEventQueue::FilterBeforeForwardingImpl( const WebTouchEvent& event) { @@ -348,23 +356,32 @@ drop_remaining_touches_in_sequence_ = false; if (!has_handlers_) { drop_remaining_touches_in_sequence_ = true; - return PreFilterResult::kFilteredNoPageHandlers; + // If the SkipBrowserTouchFilter experiment is running, drop through to + // the loop that filters events with no nonstationary pointers below. + if (ShouldFilterForEvent(event)) + return PreFilterResult::kFilteredNoPageHandlers; } } if (drop_remaining_touches_in_sequence_ && - event.GetType() != WebInputEvent::kTouchCancel) + event.GetType() != WebInputEvent::kTouchCancel && + // If the SkipBrowserTouchFilter experiment is running, drop through to + // the loop that filters events with no nonstationary pointers below. + ShouldFilterForEvent(event)) return PreFilterResult::kFilteredNoPageHandlers; if (event.GetType() == WebInputEvent::kTouchStart) { - return (has_handlers_ || maybe_has_handler_for_current_sequence_) - ? PreFilterResult::kUnfiltered - : PreFilterResult::kFilteredNoPageHandlers; + if (has_handlers_ || maybe_has_handler_for_current_sequence_) + return PreFilterResult::kUnfiltered; + // If the SkipBrowserTouchFilter experiment is running, drop through to + // the loop that filters events with no nonstationary pointers below. + else if (ShouldFilterForEvent(event)) + return PreFilterResult::kFilteredNoPageHandlers; } // If none of the touch points active in the current sequence have handlers, // don't forward the touch event. - if (!maybe_has_handler_for_current_sequence_) + if (!maybe_has_handler_for_current_sequence_ && ShouldFilterForEvent(event)) return PreFilterResult::kFilteredNoHandlerForSequence; // Only forward a touch if it has a non-stationary pointer that is active
diff --git a/content/browser/renderer_host/input/passthrough_touch_event_queue.h b/content/browser/renderer_host/input/passthrough_touch_event_queue.h index 5f448b9..8fd4679 100644 --- a/content/browser/renderer_host/input/passthrough_touch_event_queue.h +++ b/content/browser/renderer_host/input/passthrough_touch_event_queue.h
@@ -192,6 +192,7 @@ // has no touch handler. PreFilterResult FilterBeforeForwarding(const blink::WebTouchEvent& event); PreFilterResult FilterBeforeForwardingImpl(const blink::WebTouchEvent& event); + bool ShouldFilterForEvent(const blink::WebTouchEvent& event); void AckTouchEventToClient(const TouchEventWithLatencyInfo& acked_event, InputEventAckSource ack_source,
diff --git a/content/browser/service_worker/service_worker_cache_writer.cc b/content/browser/service_worker/service_worker_cache_writer.cc index 586196a..8e7e9f7 100644 --- a/content/browser/service_worker/service_worker_cache_writer.cc +++ b/content/browser/service_worker/service_worker_cache_writer.cc
@@ -300,6 +300,11 @@ return !compare_reader_ && copy_reader_; } +int64_t ServiceWorkerCacheWriter::WriterResourceId() const { + DCHECK(writer_); + return writer_->response_id(); +} + int ServiceWorkerCacheWriter::DoStart(int result) { bytes_written_ = 0; if (compare_reader_) { @@ -440,8 +445,7 @@ DCHECK_GE(result, 0); DCHECK(writer_); state_ = STATE_WRITE_HEADERS_FOR_COPY_DONE; - return WriteInfoHelper( - writer_, IsCopying() ? headers_to_read_.get() : headers_to_write_.get()); + return WriteInfo(IsCopying() ? headers_to_read_ : headers_to_write_); } int ServiceWorkerCacheWriter::DoWriteHeadersForCopyDone(int result) { @@ -489,7 +493,7 @@ int ServiceWorkerCacheWriter::DoWriteDataForCopy(int result) { state_ = STATE_WRITE_DATA_FOR_COPY_DONE; DCHECK_GT(result, 0); - return WriteDataHelper(writer_, data_to_copy_.get(), result); + return WriteData(data_to_copy_, result); } int ServiceWorkerCacheWriter::DoWriteDataForCopyDone(int result) { @@ -507,7 +511,7 @@ DCHECK_GE(result, 0); DCHECK(writer_); state_ = STATE_WRITE_HEADERS_FOR_PASSTHROUGH_DONE; - return WriteInfoHelper(writer_, headers_to_write_.get()); + return WriteInfo(headers_to_write_); } int ServiceWorkerCacheWriter::DoWriteHeadersForPassthroughDone(int result) { @@ -519,7 +523,7 @@ DCHECK_GE(result, 0); state_ = STATE_WRITE_DATA_FOR_PASSTHROUGH_DONE; if (len_to_write_ > 0) - result = WriteDataHelper(writer_, data_to_write_.get(), len_to_write_); + result = WriteData(data_to_write_, len_to_write_); return result; } @@ -576,37 +580,83 @@ return adaptor->result(); } -int ServiceWorkerCacheWriter::WriteInfoHelper( - const std::unique_ptr<ServiceWorkerResponseWriter>& writer, - HttpResponseInfoIOBuffer* buf) { +int ServiceWorkerCacheWriter::WriteInfoToResponseWriter( + scoped_refptr<HttpResponseInfoIOBuffer> response_info) { did_replace_ = true; net::CompletionOnceCallback run_callback = base::BindOnce( &ServiceWorkerCacheWriter::AsyncDoLoop, weak_factory_.GetWeakPtr()); scoped_refptr<AsyncOnlyCompletionCallbackAdaptor> adaptor( new AsyncOnlyCompletionCallbackAdaptor(std::move(run_callback))); - writer->WriteInfo( - buf, base::BindOnce(&AsyncOnlyCompletionCallbackAdaptor::WrappedCallback, - adaptor)); - adaptor->set_async(true); - return adaptor->result(); -} - -int ServiceWorkerCacheWriter::WriteDataHelper( - const std::unique_ptr<ServiceWorkerResponseWriter>& writer, - net::IOBuffer* buf, - int buf_len) { - net::CompletionOnceCallback run_callback = base::BindOnce( - &ServiceWorkerCacheWriter::AsyncDoLoop, weak_factory_.GetWeakPtr()); - scoped_refptr<AsyncOnlyCompletionCallbackAdaptor> adaptor( - new AsyncOnlyCompletionCallbackAdaptor(std::move(run_callback))); - writer->WriteData( - buf, buf_len, + writer_->WriteInfo( + response_info.get(), base::BindOnce(&AsyncOnlyCompletionCallbackAdaptor::WrappedCallback, adaptor)); adaptor->set_async(true); return adaptor->result(); } +int ServiceWorkerCacheWriter::WriteInfo( + scoped_refptr<HttpResponseInfoIOBuffer> response_info) { + if (write_observer_) + write_observer_->WillWriteInfo(response_info); + + return WriteInfoToResponseWriter(std::move(response_info)); +} + +int ServiceWorkerCacheWriter::WriteDataToResponseWriter( + scoped_refptr<net::IOBuffer> data, + int length) { + net::CompletionOnceCallback run_callback = base::BindOnce( + &ServiceWorkerCacheWriter::AsyncDoLoop, weak_factory_.GetWeakPtr()); + scoped_refptr<AsyncOnlyCompletionCallbackAdaptor> adaptor( + new AsyncOnlyCompletionCallbackAdaptor(std::move(run_callback))); + writer_->WriteData( + data.get(), length, + base::BindOnce(&AsyncOnlyCompletionCallbackAdaptor::WrappedCallback, + adaptor)); + adaptor->set_async(true); + return adaptor->result(); +} + +int ServiceWorkerCacheWriter::WriteData(scoped_refptr<net::IOBuffer> data, + int length) { + if (!write_observer_) + return WriteDataToResponseWriter(std::move(data), length); + + auto complete_callback = + base::BindOnce(&ServiceWorkerCacheWriter::OnWillWriteDataCompleted, + weak_factory_.GetWeakPtr(), data, length); + + int result = write_observer_->WillWriteData(data, length, + std::move(complete_callback)); + + if (result == net::OK) + return WriteDataToResponseWriter(std::move(data), length); + + if (result < 0 && result != net::ERR_IO_PENDING) + state_ = STATE_DONE; + + return result; +} + +// AsyncDoLoop() may need to be called to continue the state machine. +void ServiceWorkerCacheWriter::OnWillWriteDataCompleted( + scoped_refptr<net::IOBuffer> data, + int length, + net::Error error) { + DCHECK_NE(error, net::ERR_IO_PENDING); + io_pending_ = false; + if (error != net::OK) { + state_ = STATE_DONE; + AsyncDoLoop(error); + return; + } + + int result = WriteDataToResponseWriter(std::move(data), length); + if (result != net::ERR_IO_PENDING) + AsyncDoLoop(result); +} + void ServiceWorkerCacheWriter::AsyncDoLoop(int result) { result = DoLoop(result); // If the result is ERR_IO_PENDING, the pending callback will be run by a
diff --git a/content/browser/service_worker/service_worker_cache_writer.h b/content/browser/service_worker/service_worker_cache_writer.h index ee455028..77cab3f 100644 --- a/content/browser/service_worker/service_worker_cache_writer.h +++ b/content/browser/service_worker/service_worker_cache_writer.h
@@ -39,6 +39,27 @@ public: using OnWriteCompleteCallback = base::OnceCallback<void(net::Error)>; + // This class defines the interfaces of observer that observes write + // operations. The observer is notified when response info or data + // will be written to storage. + class WriteObserver { + public: + // Called before response info is written to storage. + virtual void WillWriteInfo( + scoped_refptr<HttpResponseInfoIOBuffer> response_info) = 0; + + // Called before response data is written to storage. + // Return value is used by cache writer to decide what to do next. A net + // error code should be returned (e.g. net::OK, net::ERR_IO_PENDING). If it + // returns net::ERR_IO_PENDING, the cache writer waits until the callback + // is called asynchronously. Otherwise the callback should not be called. + // The parameter of the callback specifies result of the operation. + virtual int WillWriteData( + scoped_refptr<net::IOBuffer> data, + int length, + base::OnceCallback<void(net::Error)> callback) = 0; + }; + // Create a cache writer instance that copies a script already in storage. The // script is read by |copy_reader|. static std::unique_ptr<ServiceWorkerCacheWriter> CreateForCopy( @@ -109,6 +130,13 @@ // Returns true when the cache writer is created by CreateForCopy(). bool IsCopying() const; + // Returns the resource ID being written to storage. + int64_t WriterResourceId() const; + + void set_write_observer(WriteObserver* write_observer) { + write_observer_ = write_observer; + } + private: // States for the state machine. // @@ -216,13 +244,22 @@ int ReadDataHelper(const std::unique_ptr<ServiceWorkerResponseReader>& reader, net::IOBuffer* buf, int buf_len); - int WriteInfoHelper( - const std::unique_ptr<ServiceWorkerResponseWriter>& writer, - HttpResponseInfoIOBuffer* buf); - int WriteDataHelper( - const std::unique_ptr<ServiceWorkerResponseWriter>& writer, - net::IOBuffer* buf, - int buf_len); + // If no write observer is set through set_write_observer(), + // WriteInfo() operates the same as WriteInfoToResponseWriter() and + // WriteData() operates the same as WriteDataToResponseWriter(). + // If observer is set, the argument |response_info| or |data| is first sent + // to observer then WriteInfoToResponseWriter() or + // WriteDataToResponseWriter() is called. + int WriteInfo(scoped_refptr<HttpResponseInfoIOBuffer> response_info); + int WriteData(scoped_refptr<net::IOBuffer> data, int length); + int WriteInfoToResponseWriter( + scoped_refptr<HttpResponseInfoIOBuffer> response_info); + int WriteDataToResponseWriter(scoped_refptr<net::IOBuffer> data, int length); + + // Called when |write_observer_| finishes its WillWriteData() operation. + void OnWillWriteDataCompleted(scoped_refptr<net::IOBuffer> data, + int length, + net::Error error); // Callback used by the above helpers for their IO operations. This is only // run when those IO operations complete asynchronously, in which case it @@ -272,6 +309,8 @@ // cache writer pauses immediately. const bool pause_when_not_identical_; + WriteObserver* write_observer_ = nullptr; + std::unique_ptr<ServiceWorkerResponseReader> compare_reader_; std::unique_ptr<ServiceWorkerResponseReader> copy_reader_; std::unique_ptr<ServiceWorkerResponseWriter> writer_;
diff --git a/content/browser/service_worker/service_worker_cache_writer_unittest.cc b/content/browser/service_worker/service_worker_cache_writer_unittest.cc index 93b41aa..df86394 100644 --- a/content/browser/service_worker/service_worker_cache_writer_unittest.cc +++ b/content/browser/service_worker/service_worker_cache_writer_unittest.cc
@@ -21,6 +21,47 @@ namespace content { namespace { +// A test implementation of ServiceWorkerCacheWriter::WriteObserver. +// This observer captures the response info or data sent to the observer +// for further checking. +class MockServiceWorkerCacheWriterObserver + : public ServiceWorkerCacheWriter::WriteObserver { + public: + MockServiceWorkerCacheWriterObserver() : data_length_(0), result_(net::OK) {} + ~MockServiceWorkerCacheWriterObserver() {} + + void WillWriteInfo( + scoped_refptr<HttpResponseInfoIOBuffer> response_info) override { + response_info_ = std::move(response_info); + } + + int WillWriteData(scoped_refptr<net::IOBuffer> data, + int length, + base::OnceCallback<void(net::Error)> callback) override { + data_ = std::move(data); + data_length_ = length; + callback_ = std::move(callback); + return result_; + } + + // Call the |callback_| using |error| as input. + void Complete(net::Error error) { + if (callback_) + std::move(callback_).Run(error); + } + + // Set the return value of WillWriteData(). + void set_result(net::Error result) { result_ = result; } + + scoped_refptr<HttpResponseInfoIOBuffer> response_info_; + scoped_refptr<net::IOBuffer> data_; + size_t data_length_; + base::OnceCallback<void(net::Error)> callback_; + net::Error result_; + + DISALLOW_COPY_AND_ASSIGN(MockServiceWorkerCacheWriterObserver); +}; + class ServiceWorkerCacheWriterTest : public ::testing::Test { public: // Cache writer is created differently depending on diffrerent usage. @@ -1060,5 +1101,198 @@ EXPECT_TRUE(writer->AllExpectedWritesDone()); } +// The observer and the response writer all run synchronously. +TEST_F(ServiceWorkerCacheWriterTest, ObserverSyncResponseWriterSync) { + const size_t kHeaderSize = 16; + const std::string data = "abcdef"; + size_t response_size = data.size(); + + MockServiceWorkerResponseWriter* writer = ExpectWriter(); + writer->ExpectWriteInfoOk(kHeaderSize, false); + writer->ExpectWriteDataOk(data.size(), false); + + Initialize(CacheWriterUsage::kForWriteBack, + false /* pause_when_not_identical */); + MockServiceWorkerCacheWriterObserver observer; + cache_writer_->set_write_observer(&observer); + + net::Error error = WriteHeaders(kHeaderSize); + EXPECT_TRUE(observer.response_info_); + EXPECT_EQ(net::OK, error); + + error = WriteData(data); + EXPECT_EQ(net::OK, error); + EXPECT_EQ(observer.data_length_, response_size); + EXPECT_TRUE(observer.data_); + + cache_writer_->set_write_observer(nullptr); + + EXPECT_TRUE(writer->AllExpectedWritesDone()); + EXPECT_EQ(response_size, cache_writer_->bytes_written()); +} + +// The observer runs asynchronously and the response writer runs synchronously. +TEST_F(ServiceWorkerCacheWriterTest, ObserverAsyncResponseWriterSync) { + const size_t kHeaderSize = 16; + const std::string data = "abcdef"; + size_t response_size = data.size(); + + MockServiceWorkerResponseWriter* writer = ExpectWriter(); + writer->ExpectWriteInfoOk(kHeaderSize, false); + writer->ExpectWriteDataOk(data.size(), false); + + Initialize(CacheWriterUsage::kForWriteBack, + false /* pause_when_not_identical */); + MockServiceWorkerCacheWriterObserver observer; + cache_writer_->set_write_observer(&observer); + observer.set_result(net::ERR_IO_PENDING); + + net::Error error = WriteHeaders(kHeaderSize); + EXPECT_EQ(net::OK, error); + EXPECT_TRUE(observer.response_info_); + + error = WriteData(data); + EXPECT_EQ(net::ERR_IO_PENDING, error); + observer.Complete(net::OK); + EXPECT_EQ(observer.data_length_, response_size); + EXPECT_TRUE(observer.data_); + EXPECT_TRUE(write_complete_); + EXPECT_EQ(last_error_, net::OK); + + cache_writer_->set_write_observer(nullptr); + + EXPECT_TRUE(writer->AllExpectedWritesDone()); + EXPECT_EQ(response_size, cache_writer_->bytes_written()); +} + +// The observer runs synchronously and the response writer runs asynchronously. +TEST_F(ServiceWorkerCacheWriterTest, ObserverSyncResponseWriterAsync) { + const size_t kHeaderSize = 16; + const std::string data = "abcdef"; + size_t response_size = data.size(); + + MockServiceWorkerResponseWriter* writer = ExpectWriter(); + writer->ExpectWriteInfoOk(kHeaderSize, true); + writer->ExpectWriteDataOk(data.size(), true); + + Initialize(CacheWriterUsage::kForWriteBack, + false /* pause_when_not_identical */); + MockServiceWorkerCacheWriterObserver observer; + cache_writer_->set_write_observer(&observer); + + net::Error error = WriteHeaders(kHeaderSize); + EXPECT_EQ(net::ERR_IO_PENDING, error); + EXPECT_TRUE(observer.response_info_); + writer->CompletePendingWrite(); + EXPECT_TRUE(write_complete_); + EXPECT_EQ(last_error_, net::OK); + + error = WriteData(data); + EXPECT_EQ(net::ERR_IO_PENDING, error); + EXPECT_EQ(observer.data_length_, response_size); + EXPECT_TRUE(observer.data_); + writer->CompletePendingWrite(); + EXPECT_TRUE(write_complete_); + EXPECT_EQ(last_error_, net::OK); + + cache_writer_->set_write_observer(nullptr); + + EXPECT_TRUE(writer->AllExpectedWritesDone()); + EXPECT_EQ(response_size, cache_writer_->bytes_written()); +} + +// The observer and response writer all run asynchronously. +TEST_F(ServiceWorkerCacheWriterTest, ObserverAsyncResponseWriterAsync) { + const size_t kHeaderSize = 16; + const std::string data = "abcdef"; + size_t response_size = data.size(); + + MockServiceWorkerResponseWriter* writer = ExpectWriter(); + writer->ExpectWriteInfoOk(kHeaderSize, true); + writer->ExpectWriteDataOk(data.size(), true); + + Initialize(CacheWriterUsage::kForWriteBack, + false /* pause_when_not_identical */); + MockServiceWorkerCacheWriterObserver observer; + cache_writer_->set_write_observer(&observer); + observer.set_result(net::ERR_IO_PENDING); + + net::Error error = WriteHeaders(kHeaderSize); + EXPECT_EQ(net::ERR_IO_PENDING, error); + EXPECT_TRUE(observer.response_info_); + writer->CompletePendingWrite(); + EXPECT_TRUE(write_complete_); + EXPECT_EQ(last_error_, net::OK); + + error = WriteData(data); + EXPECT_EQ(net::ERR_IO_PENDING, error); + observer.Complete(net::OK); + EXPECT_EQ(observer.data_length_, response_size); + EXPECT_TRUE(observer.data_); + writer->CompletePendingWrite(); + EXPECT_TRUE(write_complete_); + EXPECT_EQ(last_error_, net::OK); + + cache_writer_->set_write_observer(nullptr); + + EXPECT_TRUE(writer->AllExpectedWritesDone()); + EXPECT_EQ(response_size, cache_writer_->bytes_written()); +} + +// Observer's OnWillWriteData() runs synchronously but fails. +TEST_F(ServiceWorkerCacheWriterTest, ObserverSyncFail) { + const size_t kHeaderSize = 16; + const std::string data = "abcdef"; + + MockServiceWorkerResponseWriter* writer = ExpectWriter(); + writer->ExpectWriteInfoOk(kHeaderSize, false); + writer->ExpectWriteDataOk(data.size(), false); + + Initialize(CacheWriterUsage::kForWriteBack, + false /* pause_when_not_identical */); + MockServiceWorkerCacheWriterObserver observer; + cache_writer_->set_write_observer(&observer); + + net::Error error = WriteHeaders(kHeaderSize); + EXPECT_TRUE(observer.response_info_); + EXPECT_EQ(net::OK, error); + + observer.set_result(net::ERR_FAILED); + error = WriteData(data); + EXPECT_EQ(net::ERR_FAILED, error); + EXPECT_EQ(0U, cache_writer_->bytes_written()); + + cache_writer_->set_write_observer(nullptr); +} + +// Observer's OnWillWriteData() runs asynchronously but fails. +TEST_F(ServiceWorkerCacheWriterTest, ObserverAsyncFail) { + const size_t kHeaderSize = 16; + const std::string data = "abcdef"; + + MockServiceWorkerResponseWriter* writer = ExpectWriter(); + writer->ExpectWriteInfoOk(kHeaderSize, false); + writer->ExpectWriteDataOk(data.size(), false); + + Initialize(CacheWriterUsage::kForWriteBack, + false /* pause_when_not_identical */); + MockServiceWorkerCacheWriterObserver observer; + cache_writer_->set_write_observer(&observer); + observer.set_result(net::ERR_IO_PENDING); + + net::Error error = WriteHeaders(kHeaderSize); + EXPECT_EQ(net::OK, error); + EXPECT_TRUE(observer.response_info_); + + error = WriteData(data); + EXPECT_EQ(net::ERR_IO_PENDING, error); + observer.Complete(net::ERR_FAILED); + EXPECT_TRUE(write_complete_); + EXPECT_EQ(last_error_, net::ERR_FAILED); + EXPECT_EQ(0U, cache_writer_->bytes_written()); + + cache_writer_->set_write_observer(nullptr); +} + } // namespace } // namespace content
diff --git a/content/browser/speech/speech_recognizer_impl.cc b/content/browser/speech/speech_recognizer_impl.cc index e915ff1..1801ff9 100644 --- a/content/browser/speech/speech_recognizer_impl.cc +++ b/content/browser/speech/speech_recognizer_impl.cc
@@ -109,12 +109,6 @@ } // namespace -const int SpeechRecognizerImpl::kAudioSampleRate = 16000; -const ChannelLayout SpeechRecognizerImpl::kChannelLayout = - media::CHANNEL_LAYOUT_MONO; -const int SpeechRecognizerImpl::kNumBitsPerAudioSample = 16; -const int SpeechRecognizerImpl::kNoSpeechTimeoutMs = 8000; -const int SpeechRecognizerImpl::kEndpointerEstimationTimeMs = 300; media::AudioSystem* SpeechRecognizerImpl::audio_system_for_tests_ = nullptr; media::AudioCapturerSource* SpeechRecognizerImpl::audio_capturer_source_for_tests_ = nullptr;
diff --git a/content/browser/speech/speech_recognizer_impl.h b/content/browser/speech/speech_recognizer_impl.h index 5636b18c..b802895 100644 --- a/content/browser/speech/speech_recognizer_impl.h +++ b/content/browser/speech/speech_recognizer_impl.h
@@ -35,11 +35,12 @@ public media::AudioCapturerSource::CaptureCallback, public SpeechRecognitionEngine::Delegate { public: - static const int kAudioSampleRate; - static const media::ChannelLayout kChannelLayout; - static const int kNumBitsPerAudioSample; - static const int kNoSpeechTimeoutMs; - static const int kEndpointerEstimationTimeMs; + static constexpr int kAudioSampleRate = 16000; + static constexpr media::ChannelLayout kChannelLayout = + media::CHANNEL_LAYOUT_MONO; + static constexpr int kNumBitsPerAudioSample = 16; + static constexpr int kNoSpeechTimeoutMs = 8000; + static constexpr int kEndpointerEstimationTimeMs = 300; static void SetAudioEnvironmentForTesting( media::AudioSystem* audio_system,
diff --git a/content/browser/speech/speech_recognizer_impl_unittest.cc b/content/browser/speech/speech_recognizer_impl_unittest.cc index 240146c3..89a1ca0d 100644 --- a/content/browser/speech/speech_recognizer_impl_unittest.cc +++ b/content/browser/speech/speech_recognizer_impl_unittest.cc
@@ -116,8 +116,8 @@ const int channels = ChannelLayoutToChannelCount(SpeechRecognizerImpl::kChannelLayout); - bytes_per_sample_ = SpeechRecognizerImpl::kNumBitsPerAudioSample / 8; - const int frames = audio_packet_length_bytes / channels / bytes_per_sample_; + int bytes_per_sample = SpeechRecognizerImpl::kNumBitsPerAudioSample / 8; + const int frames = audio_packet_length_bytes / channels / bytes_per_sample; audio_bus_ = media::AudioBus::Create(channels, frames); audio_bus_->Zero(); } @@ -226,9 +226,11 @@ } void CopyPacketToAudioBus() { + static_assert(SpeechRecognizerImpl::kNumBitsPerAudioSample == 16, + "FromInterleaved expects 2 bytes."); // Copy the created signal into an audio bus in a deinterleaved format. - audio_bus_->FromInterleaved( - &audio_packet_[0], audio_bus_->frames(), bytes_per_sample_); + audio_bus_->FromInterleaved<media::SignedInt16SampleTypeTraits>( + reinterpret_cast<int16_t*>(audio_packet_.data()), audio_bus_->frames()); } void FillPacketWithTestWaveform() { @@ -289,7 +291,6 @@ blink::mojom::SpeechRecognitionErrorCode error_; std::vector<uint8_t> audio_packet_; std::unique_ptr<media::AudioBus> audio_bus_; - int bytes_per_sample_; float volume_; float noise_volume_; };
diff --git a/content/browser/tracing/startup_tracing_browsertest.cc b/content/browser/tracing/startup_tracing_browsertest.cc index cba2622..2bda794 100644 --- a/content/browser/tracing/startup_tracing_browsertest.cc +++ b/content/browser/tracing/startup_tracing_browsertest.cc
@@ -74,8 +74,9 @@ std::string trace; base::ScopedAllowBlockingForTesting allow_blocking; ASSERT_TRUE(base::ReadFileToString(temp_file_path_, &trace)); - EXPECT_TRUE(trace.find("BrowserMainLoop::InitStartupTracingForDuration") != - std::string::npos); + EXPECT_TRUE( + trace.find("TracingControllerImpl::InitStartupTracingForDuration") != + std::string::npos); } } // namespace content
diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc index 9c739f7..2b0e315 100644 --- a/content/browser/tracing/tracing_controller_impl.cc +++ b/content/browser/tracing/tracing_controller_impl.cc
@@ -21,6 +21,9 @@ #include "base/values.h" #include "build/build_config.h" #include "components/tracing/common/trace_startup_config.h" +#include "components/tracing/common/trace_to_console.h" +#include "components/tracing/common/tracing_switches.h" +#include "content/browser/browser_shutdown_profile_dumper.h" #include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/tracing/file_tracing_provider_impl.h" #include "content/browser/tracing/perfetto_file_tracer.h" @@ -57,6 +60,7 @@ #if defined(OS_ANDROID) #include "base/debug/elf_reader.h" +#include "content/browser/android/tracing_controller_android.h" // Symbol with virtual address of the start of ELF header of the current binary. extern char __ehdr_start; @@ -137,6 +141,11 @@ } #endif +void OnStoppedStartupTracing(const base::FilePath& trace_file) { + VLOG(0) << "Completed startup tracing to " << trace_file.value(); + tracing::TraceStartupConfig::GetInstance()->OnTraceToResultFileFinished(); +} + } // namespace TracingController* TracingController::GetInstance() { @@ -382,6 +391,83 @@ return true; } +void TracingControllerImpl::StartStartupTracingIfNeeded() { + auto* trace_startup_config = tracing::TraceStartupConfig::GetInstance(); + if (trace_startup_config->AttemptAdoptBySessionOwner( + tracing::TraceStartupConfig::SessionOwner::kTracingController)) { + StartTracing(trace_startup_config->GetTraceConfig(), + StartTracingDoneCallback()); + } else if (base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kTraceToConsole)) { + StartTracing(tracing::GetConfigForTraceToConsole(), + StartTracingDoneCallback()); + } + + if (trace_startup_config->IsTracingStartupForDuration()) { + TRACE_EVENT0("startup", + "TracingControllerImpl::InitStartupTracingForDuration"); + InitStartupTracingForDuration(); + } +} + +base::FilePath TracingControllerImpl::GetStartupTraceFileName() const { + base::FilePath trace_file; + + trace_file = tracing::TraceStartupConfig::GetInstance()->GetResultFile(); + if (trace_file.empty()) { +#if defined(OS_ANDROID) + TracingControllerAndroid::GenerateTracingFilePath(&trace_file); +#else + // Default to saving the startup trace into the current dir. + trace_file = base::FilePath().AppendASCII("chrometrace.log"); +#endif + } + + return trace_file; +} + +void TracingControllerImpl::InitStartupTracingForDuration() { + DCHECK(tracing::TraceStartupConfig::GetInstance() + ->IsTracingStartupForDuration()); + + startup_trace_file_ = GetStartupTraceFileName(); + + startup_trace_timer_.Start( + FROM_HERE, + base::TimeDelta::FromSeconds( + tracing::TraceStartupConfig::GetInstance()->GetStartupDuration()), + this, &TracingControllerImpl::EndStartupTracing); +} + +void TracingControllerImpl::EndStartupTracing() { + // Do nothing if startup tracing is already stopped. + if (!tracing::TraceStartupConfig::GetInstance()->IsEnabled()) + return; + + StopTracing(CreateFileEndpoint( + startup_trace_file_, + base::BindRepeating(OnStoppedStartupTracing, startup_trace_file_))); +} + +std::unique_ptr<BrowserShutdownProfileDumper> +TracingControllerImpl::FinalizeStartupTracingIfNeeded() { + // There are two cases: + // 1. Startup duration is not reached. + // 2. Or if the trace should be saved to file for --trace-config-file flag. + if (startup_trace_timer_.IsRunning()) { + startup_trace_timer_.Stop(); + if (startup_trace_file_ != base::FilePath().AppendASCII("none")) { + return std::make_unique<BrowserShutdownProfileDumper>( + startup_trace_file_); + } + } else if (tracing::TraceStartupConfig::GetInstance() + ->ShouldTraceToResultFile()) { + return std::make_unique<BrowserShutdownProfileDumper>( + GetStartupTraceFileName()); + } + return nullptr; +} + bool TracingControllerImpl::StopTracing( const scoped_refptr<TraceDataEndpoint>& trace_data_endpoint) { return StopTracing(std::move(trace_data_endpoint), "");
diff --git a/content/browser/tracing/tracing_controller_impl.h b/content/browser/tracing/tracing_controller_impl.h index 832446a..acbad2f 100644 --- a/content/browser/tracing/tracing_controller_impl.h +++ b/content/browser/tracing/tracing_controller_impl.h
@@ -12,6 +12,7 @@ #include "base/callback_forward.h" #include "base/memory/ref_counted.h" +#include "base/timer/timer.h" #include "content/common/content_export.h" #include "content/public/browser/tracing_controller.h" #include "mojo/public/cpp/system/data_pipe_drainer.h" @@ -71,6 +72,21 @@ CONTENT_EXPORT void SetTracingDelegateForTesting( std::unique_ptr<TracingDelegate> delegate); + // If command line flags specify startup tracing options, adopts the startup + // tracing session and relays it to all tracing agents. Note that the local + // TraceLog has already been enabled at this point by + // tracing::EnableStartupTracingIfNeeded(), before threads were available. + // Requires browser threads to have started and a started main message loop. + void StartStartupTracingIfNeeded(); + + // Should be called before browser main loop shutdown. If startup tracing is + // tracing to a file and is still active, this stops the duration timer if it + // exists and returns a BrowserShutdownProfileDumper that will finalize the + // trace file upon its destruction (i.e. startup tracing becomes a version of + // shutdown tracing). + std::unique_ptr<BrowserShutdownProfileDumper> + FinalizeStartupTracingIfNeeded(); + private: friend std::default_delete<TracingControllerImpl>; @@ -88,6 +104,10 @@ void CompleteFlush(); + void InitStartupTracingForDuration(); + void EndStartupTracing(); + base::FilePath GetStartupTraceFileName() const; + std::unique_ptr<PerfettoFileTracer> perfetto_file_tracer_; tracing::mojom::CoordinatorPtr coordinator_; std::vector<std::unique_ptr<tracing::BaseAgent>> agents_; @@ -100,6 +120,10 @@ bool is_data_complete_ = false; bool is_metadata_available_ = false; + base::FilePath startup_trace_file_; + // This timer initiates trace file saving. + base::OneShotTimer startup_trace_timer_; + DISALLOW_COPY_AND_ASSIGN(TracingControllerImpl); };
diff --git a/content/browser/webrtc/webrtc_depth_capture_browsertest.cc b/content/browser/webrtc/webrtc_depth_capture_browsertest.cc index cecf03e..a82d8fc6 100644 --- a/content/browser/webrtc/webrtc_depth_capture_browsertest.cc +++ b/content/browser/webrtc/webrtc_depth_capture_browsertest.cc
@@ -42,7 +42,7 @@ namespace content { -template <int device_count> +template <int device_count, bool enable_video_kind> class WebRtcDepthCaptureBrowserTest : public WebRtcContentBrowserTestBase { public: WebRtcDepthCaptureBrowserTest() { @@ -62,15 +62,26 @@ command_line->AppendSwitchASCII( fake_device_switch, base::StringPrintf("device-count=%d", device_count)); + if (enable_video_kind) { + command_line->AppendSwitchASCII("--enable-blink-features", + "MediaCaptureDepthVideoKind"); + } WebRtcContentBrowserTestBase::SetUpCommandLine(command_line); } }; +// Command lines must be configured in SetUpCommandLine, before the test is +// multi-threaded, so any variations must be embedded in the test fixture. + // Test using two video capture devices - a color and a 16-bit depth device. -using WebRtcTwoDeviceDepthCaptureBrowserTest = WebRtcDepthCaptureBrowserTest<2>; +using WebRtcTwoDeviceDepthCaptureBrowserTest = + WebRtcDepthCaptureBrowserTest<2, false>; +using WebRtcTwoDeviceDepthCaptureVideoKindBrowserTest = + WebRtcDepthCaptureBrowserTest<2, true>; // Test using only a color device. -using WebRtcOneDeviceDepthCaptureBrowserTest = WebRtcDepthCaptureBrowserTest<1>; +using WebRtcOneDeviceDepthCaptureVideoKindBrowserTest = + WebRtcDepthCaptureBrowserTest<1, true>; IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureBrowserTest, GetDepthStreamAndCallCreateImageBitmap) { @@ -84,12 +95,8 @@ "%s({video: true});", kGetDepthStreamAndCallCreateImageBitmap)); } -IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureBrowserTest, +IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureVideoKindBrowserTest, GetStreamsByVideoKind) { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - command_line->AppendSwitchASCII("--enable-blink-features", - "MediaCaptureDepthVideoKind"); - ASSERT_TRUE(embedded_test_server()->Start()); GURL url( @@ -100,12 +107,8 @@ base::StringPrintf("%s({video: true});", kGetStreamsByVideoKind)); } -IN_PROC_BROWSER_TEST_F(WebRtcOneDeviceDepthCaptureBrowserTest, +IN_PROC_BROWSER_TEST_F(WebRtcOneDeviceDepthCaptureVideoKindBrowserTest, GetStreamsByVideoKindNoDepth) { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - command_line->AppendSwitchASCII("--enable-blink-features", - "MediaCaptureDepthVideoKind"); - ASSERT_TRUE(embedded_test_server()->Start()); GURL url(
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java index 1cdecd7..3d70dd2 100644 --- a/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java +++ b/content/public/android/javatests/src/org/chromium/content/browser/ContentViewScrollingTest.java
@@ -103,6 +103,22 @@ }); } + private void waitForScrollToPosition(final int x, final int y) { + CriteriaHelper.pollInstrumentationThread(new Criteria() { + @Override + public boolean isSatisfied() { + // Scrolling and flinging don't result in exact coordinates. + final int threshold = 5; + + boolean xCorrect = (mCoordinates.getScrollXPixInt() < x + threshold + && mCoordinates.getScrollXPixInt() > x - threshold); + boolean yCorrect = (mCoordinates.getScrollYPixInt() < y + threshold + && mCoordinates.getScrollYPixInt() > y - threshold); + return xCorrect && yCorrect; + } + }); + } + private void waitForViewportInitialization() { CriteriaHelper.pollInstrumentationThread(new Criteria() { @Override @@ -205,6 +221,40 @@ @Test @SmallTest + @Feature({"Main"}) + @RetryOnFailure + public void testFlingDistance() throws Throwable { + // Scaling the initial velocity by the device scale factor ensures that + // it's of sufficient magnitude for all displays densities. + float deviceScaleFactor = InstrumentationRegistry.getInstrumentation() + .getTargetContext() + .getResources() + .getDisplayMetrics() + .density; + int velocity = (int) (1000 * deviceScaleFactor); + // Expected total fling distance calculated by FlingCurve with initial + // velocity 1000. + int expected_dist = (int) (180 * deviceScaleFactor); + + // Vertical fling to lower-left. + fling(0, -velocity); + waitForScrollToPosition(0, expected_dist); + + // Horizontal fling to lower-right. + fling(-velocity, 0); + waitForScrollToPosition(expected_dist, expected_dist); + + // Vertical fling to upper-right. + fling(0, velocity); + waitForScrollToPosition(expected_dist, 0); + + // Horizontal fling to top-left. + fling(velocity, 0); + waitForScrollToPosition(0, 0); + } + + @Test + @SmallTest @RerunWithUpdatedContainerView @Feature({"Main"}) @RetryOnFailure
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 95986126..6ae57ecbd 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -289,6 +289,12 @@ const base::Feature kNetworkServiceInProcess{"NetworkServiceInProcess", base::FEATURE_DISABLED_BY_DEFAULT}; +// Turns on / off the new accessibility selection code which uses a more +// predictable algorithm for mapping between positions in the DOM and the +// accessibility trees. +const base::Feature kNewAccessibilitySelection{ + "NewAccessibilitySelection", base::FEATURE_DISABLED_BY_DEFAULT}; + // Kill switch for Web Notification content images. const base::Feature kNotificationContentImage{"NotificationContentImage", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index a6e3e8f..8f4fbab 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -70,6 +70,7 @@ CONTENT_EXPORT extern const base::Feature kMojoVideoCaptureSecondary; CONTENT_EXPORT extern const base::Feature kNetworkQualityEstimatorWebHoldback; CONTENT_EXPORT extern const base::Feature kNetworkServiceInProcess; +CONTENT_EXPORT extern const base::Feature kNewAccessibilitySelection; CONTENT_EXPORT extern const base::Feature kNotificationContentImage; CONTENT_EXPORT extern const base::Feature kNotificationTriggers; CONTENT_EXPORT extern const base::Feature kOriginPolicy;
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn index abab699..05a78cc 100644 --- a/content/renderer/BUILD.gn +++ b/content/renderer/BUILD.gn
@@ -187,8 +187,6 @@ "loader/tracked_child_url_loader_factory_bundle.h", "loader/url_loader_client_impl.cc", "loader/url_loader_client_impl.h", - "loader/url_response_body_consumer.cc", - "loader/url_response_body_consumer.h", "loader/web_data_consumer_handle_impl.cc", "loader/web_data_consumer_handle_impl.h", "loader/web_url_loader_impl.cc",
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc index 1f1eeb0..159c1b68 100644 --- a/content/renderer/accessibility/blink_ax_tree_source.cc +++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -375,8 +375,13 @@ WebAXObject anchor_object, focus_object; int anchor_offset, focus_offset; ax::mojom::TextAffinity anchor_affinity, focus_affinity; - root().SelectionDeprecated(anchor_object, anchor_offset, anchor_affinity, - focus_object, focus_offset, focus_affinity); + if (base::FeatureList::IsEnabled(features::kNewAccessibilitySelection)) { + root().Selection(anchor_object, anchor_offset, anchor_affinity, + focus_object, focus_offset, focus_affinity); + } else { + root().SelectionDeprecated(anchor_object, anchor_offset, anchor_affinity, + focus_object, focus_offset, focus_affinity); + } if (!anchor_object.IsNull() && !focus_object.IsNull() && anchor_offset >= 0 && focus_offset >= 0) { int32_t anchor_id = anchor_object.AxID(); @@ -994,11 +999,19 @@ dst->AddBoolAttribute(ax::mojom::BoolAttribute::kEditableRoot, true); if (src.IsControl() && !src.IsRichlyEditable()) { - // Only for simple input controls -- rich editable areas use AXTreeData - dst->AddIntAttribute(ax::mojom::IntAttribute::kTextSelStart, - src.SelectionStartDeprecated()); - dst->AddIntAttribute(ax::mojom::IntAttribute::kTextSelEnd, - src.SelectionEndDeprecated()); + // Only for simple input controls -- rich editable areas use AXTreeData. + if (base::FeatureList::IsEnabled( + features::kNewAccessibilitySelection)) { + dst->AddIntAttribute(ax::mojom::IntAttribute::kTextSelStart, + src.SelectionStart()); + dst->AddIntAttribute(ax::mojom::IntAttribute::kTextSelEnd, + src.SelectionEnd()); + } else { + dst->AddIntAttribute(ax::mojom::IntAttribute::kTextSelStart, + src.SelectionStartDeprecated()); + dst->AddIntAttribute(ax::mojom::IntAttribute::kTextSelEnd, + src.SelectionEndDeprecated()); + } } }
diff --git a/content/renderer/accessibility/render_accessibility_impl.cc b/content/renderer/accessibility/render_accessibility_impl.cc index b21c58b5..908e345 100644 --- a/content/renderer/accessibility/render_accessibility_impl.cc +++ b/content/renderer/accessibility/render_accessibility_impl.cc
@@ -704,8 +704,13 @@ WebPoint(data.target_point.x(), data.target_point.y())); break; case ax::mojom::Action::kSetSelection: - anchor.SetSelectionDeprecated(anchor, data.anchor_offset, focus, - data.focus_offset); + if (base::FeatureList::IsEnabled(features::kNewAccessibilitySelection)) { + anchor.SetSelection(anchor, data.anchor_offset, focus, + data.focus_offset); + } else { + anchor.SetSelectionDeprecated(anchor, data.anchor_offset, focus, + data.focus_offset); + } HandleAXEvent(root, ax::mojom::Event::kLayoutComplete); break; case ax::mojom::Action::kSetSequentialFocusNavigationStartingPoint:
diff --git a/content/renderer/child_frame_compositing_helper.cc b/content/renderer/child_frame_compositing_helper.cc index 9c016e3..fda424e7 100644 --- a/content/renderer/child_frame_compositing_helper.cc +++ b/content/renderer/child_frame_compositing_helper.cc
@@ -78,10 +78,8 @@ void ChildFrameCompositingHelper::UpdateVisibility(bool visible) { cc::Layer* layer = child_frame_compositor_->GetLayer(); - if (layer) { + if (layer) layer->SetIsDrawable(visible); - layer->SetHitTestable(visible); - } } gfx::Rect ChildFrameCompositingHelper::PaintableRegion() {
diff --git a/content/renderer/compositor/layer_tree_view.cc b/content/renderer/compositor/layer_tree_view.cc index bbcd3f8..98e9d3db 100644 --- a/content/renderer/compositor/layer_tree_view.cc +++ b/content/renderer/compositor/layer_tree_view.cc
@@ -451,7 +451,12 @@ delegate_->DidBeginMainFrame(); } +void LayerTreeView::WillUpdateLayers() { + delegate_->BeginUpdateLayers(); +} + void LayerTreeView::DidUpdateLayers() { + delegate_->EndUpdateLayers(); // Dump property trees and layers if run with: // --vmodule=layer_tree_view=3 VLOG(3) << "After updating layers:\n" @@ -545,7 +550,9 @@ weak_factory_.GetWeakPtr())); } -void LayerTreeView::WillCommit() {} +void LayerTreeView::WillCommit() { + delegate_->WillCommitCompositorFrame(); +} void LayerTreeView::DidCommit() { delegate_->DidCommitCompositorFrame();
diff --git a/content/renderer/compositor/layer_tree_view.h b/content/renderer/compositor/layer_tree_view.h index 5a73dbe..5853ec0d 100644 --- a/content/renderer/compositor/layer_tree_view.h +++ b/content/renderer/compositor/layer_tree_view.h
@@ -164,6 +164,7 @@ // cc::LayerTreeHostClient implementation. void WillBeginMainFrame() override; void DidBeginMainFrame() override; + void WillUpdateLayers() override; void DidUpdateLayers() override; void BeginMainFrame(const viz::BeginFrameArgs& args) override; void BeginMainFrameNotExpectedSoon() override;
diff --git a/content/renderer/compositor/layer_tree_view_delegate.h b/content/renderer/compositor/layer_tree_view_delegate.h index 3ca936a..7142a69 100644 --- a/content/renderer/compositor/layer_tree_view_delegate.h +++ b/content/renderer/compositor/layer_tree_view_delegate.h
@@ -62,6 +62,9 @@ // Notifies that the draw commands for a committed frame have been issued. virtual void DidCommitAndDrawCompositorFrame() = 0; + // Notifies that a compositor frame commit operation is about to start. + virtual void WillCommitCompositorFrame() = 0; + // Notifies about a compositor frame commit operation having finished. virtual void DidCommitCompositorFrame() = 0; @@ -79,6 +82,11 @@ virtual void RecordStartOfFrameMetrics() = 0; virtual void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) = 0; + // Notification of the beginning and end of LayerTreeHost::UpdateLayers, for + // metrics collection. + virtual void BeginUpdateLayers() = 0; + virtual void EndUpdateLayers() = 0; + // Requests a visual frame-based update to the state of the delegate if there // is an update available. virtual void UpdateVisualState() = 0;
diff --git a/content/renderer/loader/navigation_body_loader.cc b/content/renderer/loader/navigation_body_loader.cc index ace7ff9..13fbd54 100644 --- a/content/renderer/loader/navigation_body_loader.cc +++ b/content/renderer/loader/navigation_body_loader.cc
@@ -8,7 +8,6 @@ #include "base/macros.h" #include "content/renderer/loader/code_cache_loader_impl.h" #include "content/renderer/loader/resource_load_stats.h" -#include "content/renderer/loader/url_response_body_consumer.h" #include "content/renderer/loader/web_url_loader_impl.h" #include "services/network/public/cpp/url_loader_completion_status.h" #include "third_party/blink/public/web/web_navigation_params.h" @@ -16,6 +15,9 @@ namespace content { // static +constexpr uint32_t NavigationBodyLoader::kMaxNumConsumedBytesInTask; + +// static void NavigationBodyLoader::FillNavigationParamsResponseAndBodyLoader( const CommonNavigationParams& common_params, const CommitNavigationParams& commit_params, @@ -252,11 +254,9 @@ NotifyCompletionIfAppropriate(); return; } - DCHECK_LE(num_bytes_consumed, - URLResponseBodyConsumer::kMaxNumConsumedBytesInTask); - available = std::min(available, - URLResponseBodyConsumer::kMaxNumConsumedBytesInTask - - num_bytes_consumed); + DCHECK_LE(num_bytes_consumed, kMaxNumConsumedBytesInTask); + available = + std::min(available, kMaxNumConsumedBytesInTask - num_bytes_consumed); if (available == 0) { // We've already consumed many bytes in this task. Defer the remaining // to the next task.
diff --git a/content/renderer/loader/navigation_body_loader.h b/content/renderer/loader/navigation_body_loader.h index ac871a5..a9af6ead 100644 --- a/content/renderer/loader/navigation_body_loader.h +++ b/content/renderer/loader/navigation_body_loader.h
@@ -83,6 +83,13 @@ // NotifyCompletionIfAppropriate // notify client about completion + // The maximal number of bytes consumed in a task. When there are more bytes + // in the data pipe, they will be consumed in following tasks. Setting a too + // small number will generate ton of tasks but setting a too large number will + // lead to thread janks. Also, some clients cannot handle too large chunks + // (512k for example). + static constexpr uint32_t kMaxNumConsumedBytesInTask = 64 * 1024; + NavigationBodyLoader( const network::ResourceResponseHead& head, network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
diff --git a/content/renderer/loader/url_response_body_consumer.cc b/content/renderer/loader/url_response_body_consumer.cc deleted file mode 100644 index 9a99b40..0000000 --- a/content/renderer/loader/url_response_body_consumer.cc +++ /dev/null
@@ -1,166 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/renderer/loader/url_response_body_consumer.h" - -#include "base/auto_reset.h" -#include "base/bind.h" -#include "base/macros.h" -#include "content/public/renderer/request_peer.h" -#include "content/renderer/loader/resource_dispatcher.h" -#include "services/network/public/cpp/url_loader_completion_status.h" - -namespace content { - -constexpr uint32_t URLResponseBodyConsumer::kMaxNumConsumedBytesInTask; - -class URLResponseBodyConsumer::ReceivedData final - : public RequestPeer::ReceivedData { - public: - ReceivedData(const char* payload, - int length, - scoped_refptr<URLResponseBodyConsumer> consumer) - : payload_(payload), length_(length), consumer_(consumer) {} - - ~ReceivedData() override { consumer_->Reclaim(length_); } - - const char* payload() override { return payload_; } - int length() override { return length_; } - - private: - const char* const payload_; - const uint32_t length_; - - scoped_refptr<URLResponseBodyConsumer> consumer_; - - DISALLOW_COPY_AND_ASSIGN(ReceivedData); -}; - -URLResponseBodyConsumer::URLResponseBodyConsumer( - int request_id, - ResourceDispatcher* resource_dispatcher, - mojo::ScopedDataPipeConsumerHandle handle, - scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : request_id_(request_id), - resource_dispatcher_(resource_dispatcher), - handle_(std::move(handle)), - handle_watcher_(FROM_HERE, - mojo::SimpleWatcher::ArmingPolicy::MANUAL, - task_runner), - task_runner_(task_runner), - has_seen_end_of_data_(!handle_.is_valid()) { - handle_watcher_.Watch( - handle_.get(), MOJO_HANDLE_SIGNAL_READABLE, - base::Bind(&URLResponseBodyConsumer::OnReadable, base::Unretained(this))); -} - -URLResponseBodyConsumer::~URLResponseBodyConsumer() {} - -void URLResponseBodyConsumer::OnComplete( - const network::URLLoaderCompletionStatus& status) { - if (has_been_cancelled_) - return; - has_received_completion_ = true; - status_ = status; - NotifyCompletionIfAppropriate(); -} - -void URLResponseBodyConsumer::Cancel() { - has_been_cancelled_ = true; - handle_watcher_.Cancel(); -} - -void URLResponseBodyConsumer::SetDefersLoading() { - is_deferred_ = true; -} - -void URLResponseBodyConsumer::UnsetDefersLoading() { - is_deferred_ = false; - OnReadable(MOJO_RESULT_OK); -} - -void URLResponseBodyConsumer::ArmOrNotify() { - if (has_been_cancelled_) - return; - handle_watcher_.ArmOrNotify(); -} - -void URLResponseBodyConsumer::Reclaim(uint32_t size) { - MojoResult result = handle_->EndReadData(size); - DCHECK_EQ(MOJO_RESULT_OK, result); - - if (is_in_on_readable_) - return; - - handle_watcher_.ArmOrNotify(); -} - -void URLResponseBodyConsumer::OnReadable(MojoResult unused) { - if (has_been_cancelled_ || has_seen_end_of_data_ || is_deferred_) - return; - - DCHECK(!is_in_on_readable_); - uint32_t num_bytes_consumed = 0; - - // Protect |this| as RequestPeer::OnReceivedData may call deref. - scoped_refptr<URLResponseBodyConsumer> protect(this); - base::AutoReset<bool> is_in_on_readable(&is_in_on_readable_, true); - - while (!has_been_cancelled_ && !is_deferred_) { - const void* buffer = nullptr; - uint32_t available = 0; - MojoResult result = - handle_->BeginReadData(&buffer, &available, MOJO_READ_DATA_FLAG_NONE); - if (result == MOJO_RESULT_SHOULD_WAIT) { - handle_watcher_.ArmOrNotify(); - return; - } - if (result == MOJO_RESULT_BUSY) - return; - if (result == MOJO_RESULT_FAILED_PRECONDITION) { - has_seen_end_of_data_ = true; - NotifyCompletionIfAppropriate(); - return; - } - if (result != MOJO_RESULT_OK) { - status_.error_code = net::ERR_FAILED; - has_seen_end_of_data_ = true; - has_received_completion_ = true; - NotifyCompletionIfAppropriate(); - return; - } - DCHECK_LE(num_bytes_consumed, kMaxNumConsumedBytesInTask); - available = - std::min(available, kMaxNumConsumedBytesInTask - num_bytes_consumed); - if (available == 0) { - // We've already consumed many bytes in this task. Defer the remaining - // to the next task. - result = handle_->EndReadData(0); - DCHECK_EQ(result, MOJO_RESULT_OK); - handle_watcher_.ArmOrNotify(); - return; - } - num_bytes_consumed += available; - ResourceDispatcher::PendingRequestInfo* request_info = - resource_dispatcher_->GetPendingRequestInfo(request_id_); - DCHECK(request_info); - - request_info->peer->OnReceivedData(std::make_unique<ReceivedData>( - static_cast<const char*>(buffer), available, this)); - } -} - -void URLResponseBodyConsumer::NotifyCompletionIfAppropriate() { - if (has_been_cancelled_) - return; - if (!has_received_completion_ || !has_seen_end_of_data_) - return; - // Cancel this instance in order not to notify twice. - Cancel(); - - resource_dispatcher_->OnRequestComplete(request_id_, status_); - // |this| may be deleted. -} - -} // namespace content
diff --git a/content/renderer/loader/url_response_body_consumer.h b/content/renderer/loader/url_response_body_consumer.h deleted file mode 100644 index 3b6061b3..0000000 --- a/content/renderer/loader/url_response_body_consumer.h +++ /dev/null
@@ -1,96 +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 CONTENT_RENDERER_LOADER_URL_RESPONSE_BODY_CONSUMER_H_ -#define CONTENT_RENDERER_LOADER_URL_RESPONSE_BODY_CONSUMER_H_ - -#include <stddef.h> -#include <stdint.h> - -#include <utility> -#include <vector> - -#include "base/macros.h" -#include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" -#include "base/single_thread_task_runner.h" -#include "content/common/content_export.h" -#include "mojo/public/cpp/system/data_pipe.h" -#include "mojo/public/cpp/system/simple_watcher.h" -#include "services/network/public/mojom/url_loader.mojom.h" - -namespace network { -struct URLLoaderCompletionStatus; -} // namespace network - -namespace content { - -class ResourceDispatcher; - -// This class pulls data from a data pipe and dispatches it to the -// ResourceDispatcher. This class is used only for mojo-enabled requests. -class CONTENT_EXPORT URLResponseBodyConsumer final - : public base::RefCounted<URLResponseBodyConsumer>, - public base::SupportsWeakPtr<URLResponseBodyConsumer> { - public: - URLResponseBodyConsumer( - int request_id, - ResourceDispatcher* resource_dispatcher, - mojo::ScopedDataPipeConsumerHandle handle, - scoped_refptr<base::SingleThreadTaskRunner> task_runner); - - // Sets the completion status. The completion status is dispatched to the - // ResourceDispatcher when the both following conditions hold: - // 1) This function has been called and the completion status is set, and - // 2) All data is read from the handle. - void OnComplete(const network::URLLoaderCompletionStatus& status); - - // Cancels watching the handle and dispatches an error to the - // ResourceDispatcher. This function does nothing if the reading is already - // cancelled or done. - void Cancel(); - - void SetDefersLoading(); - void UnsetDefersLoading(); - - // Reads data and dispatches messages synchronously. - void OnReadable(MojoResult unused); - - void ArmOrNotify(); - - // The maximal number of bytes consumed in a task. When there are more bytes - // in the data pipe, they will be consumed in following tasks. Setting a too - // small number will generate ton of tasks but setting a too large number will - // lead to thread janks. Also, some clients cannot handle too large chunks - // (512k for example). - static constexpr uint32_t kMaxNumConsumedBytesInTask = 64 * 1024; - - private: - friend class base::RefCounted<URLResponseBodyConsumer>; - ~URLResponseBodyConsumer(); - - class ReceivedData; - void Reclaim(uint32_t size); - - void NotifyCompletionIfAppropriate(); - - const int request_id_; - ResourceDispatcher* resource_dispatcher_; - mojo::ScopedDataPipeConsumerHandle handle_; - mojo::SimpleWatcher handle_watcher_; - network::URLLoaderCompletionStatus status_; - scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - - bool has_received_completion_ = false; - bool has_been_cancelled_ = false; - bool has_seen_end_of_data_; - bool is_deferred_ = false; - bool is_in_on_readable_ = false; - - DISALLOW_COPY_AND_ASSIGN(URLResponseBodyConsumer); -}; - -} // namespace content - -#endif // CONTENT_RENDERER_LOADER_URL_RESPONSE_BODY_CONSUMER_H_
diff --git a/content/renderer/loader/url_response_body_consumer_unittest.cc b/content/renderer/loader/url_response_body_consumer_unittest.cc deleted file mode 100644 index 5a63af0..0000000 --- a/content/renderer/loader/url_response_body_consumer_unittest.cc +++ /dev/null
@@ -1,336 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/renderer/loader/url_response_body_consumer.h" - -#include "base/bind.h" -#include "base/callback_forward.h" -#include "base/macros.h" -#include "base/run_loop.h" -#include "base/single_thread_task_runner.h" -#include "base/test/scoped_task_environment.h" -#include "content/public/renderer/request_peer.h" -#include "content/renderer/loader/navigation_response_override_parameters.h" -#include "content/renderer/loader/request_extra_data.h" -#include "content/renderer/loader/resource_dispatcher.h" -#include "net/base/request_priority.h" -#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" -#include "services/network/public/cpp/resource_request.h" -#include "services/network/public/cpp/url_loader_completion_status.h" -#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" -#include "services/network/public/mojom/request_context_frame_type.mojom.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/platform/scheduler/test/renderer_scheduler_test_support.h" -#include "url/gurl.h" -#include "url/origin.h" - -namespace content { - -namespace { - -class TestRequestPeer : public RequestPeer { - public: - struct Context; - TestRequestPeer(Context* context, - scoped_refptr<base::SingleThreadTaskRunner> task_runner) - : context_(context), task_runner_(std::move(task_runner)) {} - - void OnUploadProgress(uint64_t position, uint64_t size) override { - ADD_FAILURE() << "OnUploadProgress should not be called."; - } - - bool OnReceivedRedirect(const net::RedirectInfo& redirect_info, - const network::ResourceResponseInfo& info) override { - ADD_FAILURE() << "OnReceivedRedirect should not be called."; - return false; - } - - void OnReceivedResponse(const network::ResourceResponseInfo& info) override { - ADD_FAILURE() << "OnReceivedResponse should not be called."; - } - - void OnStartLoadingResponseBody( - mojo::ScopedDataPipeConsumerHandle body) override { - ADD_FAILURE() << "OnStartLoadingResponseBody should not be called."; - } - - void OnReceivedData(std::unique_ptr<ReceivedData> data) override { - EXPECT_FALSE(context_->complete); - context_->data.append(data->payload(), data->length()); - if (context_->release_data_asynchronously) - task_runner_->DeleteSoon(FROM_HERE, data.release()); - context_->run_loop_quit_closure.Run(); - } - - void OnTransferSizeUpdated(int transfer_size_diff) override {} - - void OnCompletedRequest( - const network::URLLoaderCompletionStatus& status) override { - EXPECT_FALSE(context_->complete); - context_->complete = true; - context_->error_code = status.error_code; - context_->run_loop_quit_closure.Run(); - } - scoped_refptr<base::TaskRunner> GetTaskRunner() override { - return blink::scheduler::GetSingleThreadTaskRunnerForTesting(); - } - - struct Context { - // Data received. If downloading to file, remains empty. - std::string data; - bool complete = false; - base::Closure run_loop_quit_closure; - int error_code = net::OK; - bool release_data_asynchronously = false; - }; - - private: - Context* context_; - scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - - DISALLOW_COPY_AND_ASSIGN(TestRequestPeer); -}; - -class URLResponseBodyConsumerTest : public ::testing::Test { - protected: - // A URLResponseBodyConsumer needs an associated PendingRequestInfo, and - // we need a URLLoaderFactory to create a PendingRequestInfo. We don't need - // a true URLLoaderFactory, so here we define a no-op (other than keeping - // clients to avoid connection error notifications) factory. - class NoopURLLoaderFactory final : public network::mojom::URLLoaderFactory { - public: - void CreateLoaderAndStart(network::mojom::URLLoaderRequest request, - int32_t routing_id, - int32_t request_id, - uint32_t options, - const network::ResourceRequest& url_request, - network::mojom::URLLoaderClientPtr client, - const net::MutableNetworkTrafficAnnotationTag& - traffic_annotation) override { - clients_.push_back(std::move(client)); - } - - void Clone(network::mojom::URLLoaderFactoryRequest request) override {} - - std::vector<network::mojom::URLLoaderClientPtr> clients_; - }; - - URLResponseBodyConsumerTest() : dispatcher_(new ResourceDispatcher()) {} - - ~URLResponseBodyConsumerTest() override { - dispatcher_.reset(); - base::RunLoop().RunUntilIdle(); - } - - std::unique_ptr<network::ResourceRequest> CreateResourceRequest() { - std::unique_ptr<network::ResourceRequest> request( - new network::ResourceRequest); - - request->method = "GET"; - request->url = GURL("http://www.example.com/"); - request->priority = net::LOW; - request->appcache_host_id = 0; - request->fetch_request_mode = network::mojom::FetchRequestMode::kNoCors; - request->fetch_frame_type = network::mojom::RequestContextFrameType::kNone; - - const RequestExtraData extra_data; - extra_data.CopyToResourceRequest(request.get()); - - return request; - } - - MojoCreateDataPipeOptions CreateDataPipeOptions() { - MojoCreateDataPipeOptions options; - options.struct_size = sizeof(MojoCreateDataPipeOptions); - options.flags = MOJO_CREATE_DATA_PIPE_FLAG_NONE; - options.element_num_bytes = 1; - options.capacity_num_bytes = 1024; - return options; - } - - // Returns the request id. - int SetUpRequestPeer(std::unique_ptr<network::ResourceRequest> request, - TestRequestPeer::Context* context) { - return dispatcher_->StartAsync( - std::move(request), 0, - blink::scheduler::GetSingleThreadTaskRunnerForTesting(), - TRAFFIC_ANNOTATION_FOR_TESTS, false, - false /* pass_response_pipe_to_peer */, - std::make_unique<TestRequestPeer>( - context, blink::scheduler::GetSingleThreadTaskRunnerForTesting()), - base::MakeRefCounted<network::WeakWrapperSharedURLLoaderFactory>( - &factory_), - std::vector<std::unique_ptr<URLLoaderThrottle>>(), - nullptr /* navigation_response_override_params */); - } - - void Run(TestRequestPeer::Context* context) { - base::RunLoop run_loop; - context->run_loop_quit_closure = run_loop.QuitClosure(); - run_loop.Run(); - } - - base::test::ScopedTaskEnvironment task_environment_; - NoopURLLoaderFactory factory_; - std::unique_ptr<ResourceDispatcher> dispatcher_; - static const MojoWriteDataFlags kNone = MOJO_WRITE_DATA_FLAG_NONE; -}; - -TEST_F(URLResponseBodyConsumerTest, ReceiveData) { - TestRequestPeer::Context context; - std::unique_ptr<network::ResourceRequest> request(CreateResourceRequest()); - int request_id = SetUpRequestPeer(std::move(request), &context); - mojo::DataPipe data_pipe(CreateDataPipeOptions()); - - scoped_refptr<URLResponseBodyConsumer> consumer(new URLResponseBodyConsumer( - request_id, dispatcher_.get(), std::move(data_pipe.consumer_handle), - blink::scheduler::GetSingleThreadTaskRunnerForTesting())); - consumer->ArmOrNotify(); - - mojo::ScopedDataPipeProducerHandle writer = - std::move(data_pipe.producer_handle); - std::string buffer = "hello"; - uint32_t size = buffer.size(); - MojoResult result = writer->WriteData(buffer.c_str(), &size, kNone); - ASSERT_EQ(MOJO_RESULT_OK, result); - ASSERT_EQ(buffer.size(), size); - - Run(&context); - - EXPECT_FALSE(context.complete); - EXPECT_EQ("hello", context.data); -} - -TEST_F(URLResponseBodyConsumerTest, OnCompleteThenClose) { - TestRequestPeer::Context context; - std::unique_ptr<network::ResourceRequest> request(CreateResourceRequest()); - int request_id = SetUpRequestPeer(std::move(request), &context); - mojo::DataPipe data_pipe(CreateDataPipeOptions()); - - scoped_refptr<URLResponseBodyConsumer> consumer(new URLResponseBodyConsumer( - request_id, dispatcher_.get(), std::move(data_pipe.consumer_handle), - blink::scheduler::GetSingleThreadTaskRunnerForTesting())); - consumer->ArmOrNotify(); - - consumer->OnComplete(network::URLLoaderCompletionStatus()); - mojo::ScopedDataPipeProducerHandle writer = - std::move(data_pipe.producer_handle); - std::string buffer = "hello"; - uint32_t size = buffer.size(); - MojoResult result = writer->WriteData(buffer.c_str(), &size, kNone); - ASSERT_EQ(MOJO_RESULT_OK, result); - ASSERT_EQ(buffer.size(), size); - - Run(&context); - - writer.reset(); - EXPECT_FALSE(context.complete); - EXPECT_EQ("hello", context.data); - - Run(&context); - - EXPECT_TRUE(context.complete); - EXPECT_EQ("hello", context.data); -} - -// Release the received data asynchronously. This leads to MOJO_RESULT_BUSY -// from the BeginReadDataRaw call in OnReadable. -TEST_F(URLResponseBodyConsumerTest, OnCompleteThenCloseWithAsyncRelease) { - TestRequestPeer::Context context; - context.release_data_asynchronously = true; - std::unique_ptr<network::ResourceRequest> request(CreateResourceRequest()); - int request_id = SetUpRequestPeer(std::move(request), &context); - mojo::DataPipe data_pipe(CreateDataPipeOptions()); - - scoped_refptr<URLResponseBodyConsumer> consumer(new URLResponseBodyConsumer( - request_id, dispatcher_.get(), std::move(data_pipe.consumer_handle), - blink::scheduler::GetSingleThreadTaskRunnerForTesting())); - consumer->ArmOrNotify(); - - consumer->OnComplete(network::URLLoaderCompletionStatus()); - mojo::ScopedDataPipeProducerHandle writer = - std::move(data_pipe.producer_handle); - std::string buffer = "hello"; - uint32_t size = buffer.size(); - MojoResult result = writer->WriteData(buffer.c_str(), &size, kNone); - ASSERT_EQ(MOJO_RESULT_OK, result); - ASSERT_EQ(buffer.size(), size); - - Run(&context); - - writer.reset(); - EXPECT_FALSE(context.complete); - EXPECT_EQ("hello", context.data); - - Run(&context); - - EXPECT_TRUE(context.complete); - EXPECT_EQ("hello", context.data); -} - -TEST_F(URLResponseBodyConsumerTest, CloseThenOnComplete) { - TestRequestPeer::Context context; - std::unique_ptr<network::ResourceRequest> request(CreateResourceRequest()); - int request_id = SetUpRequestPeer(std::move(request), &context); - mojo::DataPipe data_pipe(CreateDataPipeOptions()); - - scoped_refptr<URLResponseBodyConsumer> consumer(new URLResponseBodyConsumer( - request_id, dispatcher_.get(), std::move(data_pipe.consumer_handle), - blink::scheduler::GetSingleThreadTaskRunnerForTesting())); - consumer->ArmOrNotify(); - - network::URLLoaderCompletionStatus status; - status.error_code = net::ERR_FAILED; - data_pipe.producer_handle.reset(); - consumer->OnComplete(status); - - Run(&context); - - EXPECT_TRUE(context.complete); - EXPECT_EQ(net::ERR_FAILED, context.error_code); - EXPECT_EQ("", context.data); -} - -TEST_F(URLResponseBodyConsumerTest, TooBigChunkShouldBeSplit) { - constexpr auto kMaxNumConsumedBytesInTask = - URLResponseBodyConsumer::kMaxNumConsumedBytesInTask; - TestRequestPeer::Context context; - std::unique_ptr<network::ResourceRequest> request(CreateResourceRequest()); - int request_id = SetUpRequestPeer(std::move(request), &context); - auto options = CreateDataPipeOptions(); - options.capacity_num_bytes = 2 * kMaxNumConsumedBytesInTask; - mojo::DataPipe data_pipe(options); - - mojo::ScopedDataPipeProducerHandle writer = - std::move(data_pipe.producer_handle); - void* buffer = nullptr; - uint32_t size = 0; - MojoResult result = writer->BeginWriteData(&buffer, &size, kNone); - - ASSERT_EQ(MOJO_RESULT_OK, result); - ASSERT_EQ(options.capacity_num_bytes, size); - - memset(buffer, 'a', kMaxNumConsumedBytesInTask); - memset(static_cast<char*>(buffer) + kMaxNumConsumedBytesInTask, 'b', - kMaxNumConsumedBytesInTask); - - result = writer->EndWriteData(size); - ASSERT_EQ(MOJO_RESULT_OK, result); - - scoped_refptr<URLResponseBodyConsumer> consumer(new URLResponseBodyConsumer( - request_id, dispatcher_.get(), std::move(data_pipe.consumer_handle), - blink::scheduler::GetSingleThreadTaskRunnerForTesting())); - consumer->ArmOrNotify(); - - Run(&context); - EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'a'), context.data); - context.data.clear(); - - Run(&context); - EXPECT_EQ(std::string(kMaxNumConsumedBytesInTask, 'b'), context.data); -} - -} // namespace - -} // namespace content
diff --git a/content/renderer/loader/web_url_loader_impl.cc b/content/renderer/loader/web_url_loader_impl.cc index b77bc2e..9e4ad09 100644 --- a/content/renderer/loader/web_url_loader_impl.cc +++ b/content/renderer/loader/web_url_loader_impl.cc
@@ -40,7 +40,6 @@ #include "content/renderer/loader/resource_dispatcher.h" #include "content/renderer/loader/shared_memory_data_consumer_handle.h" #include "content/renderer/loader/sync_load_response.h" -#include "content/renderer/loader/url_response_body_consumer.h" #include "content/renderer/loader/web_url_request_util.h" #include "net/base/data_url.h" #include "net/base/filename_util.h" @@ -401,6 +400,13 @@ private: friend class base::RefCounted<Context>; + // The maximal number of bytes consumed in a task. When there are more bytes + // in the data pipe, they will be consumed in following tasks. Setting a too + // small number will generate ton of tasks but setting a too large number will + // lead to thread janks. Also, some clients cannot handle too large chunks + // (512k for example). + static constexpr uint32_t kMaxNumConsumedBytesInTask = 64 * 1024; + ~Context(); class ReceivedDataImpl : public ReceivedData { @@ -574,6 +580,9 @@ // WebURLLoaderImpl::Context -------------------------------------------------- +// static +constexpr uint32_t WebURLLoaderImpl::Context::kMaxNumConsumedBytesInTask; + WebURLLoaderImpl::Context::Context( WebURLLoaderImpl* loader, ResourceDispatcher* resource_dispatcher, @@ -981,10 +990,9 @@ } in_two_phase_read_ = true; DCHECK_EQ(MOJO_RESULT_OK, rv); - DCHECK_LE(read_bytes, URLResponseBodyConsumer::kMaxNumConsumedBytesInTask); - available_bytes = std::min( - available_bytes, - URLResponseBodyConsumer::kMaxNumConsumedBytesInTask - read_bytes); + DCHECK_LE(read_bytes, kMaxNumConsumedBytesInTask); + available_bytes = + std::min(available_bytes, kMaxNumConsumedBytesInTask - read_bytes); if (available_bytes == 0) { // We've already read kMaxNumConsumedBytesInTask bytes of the body in this // task. Defer the remaining to the next task.
diff --git a/content/renderer/media/media_factory.cc b/content/renderer/media/media_factory.cc index ee0af5a..9d9ac56a 100644 --- a/content/renderer/media/media_factory.cc +++ b/content/renderer/media/media_factory.cc
@@ -13,6 +13,7 @@ #include "base/metrics/field_trial_params.h" #include "base/task_runner_util.h" #include "base/threading/thread_task_runner_handle.h" +#include "build/build_config.h" #include "build/buildflag.h" #include "cc/trees/layer_tree_settings.h" #include "content/public/common/content_client.h" @@ -144,6 +145,11 @@ if (features::IsMultiProcessMash()) return blink::WebMediaPlayer::SurfaceLayerMode::kNever; +#if defined(OS_ANDROID) + if (base::FeatureList::IsEnabled(media::kDisableSurfaceLayerForVideo)) + return blink::WebMediaPlayer::SurfaceLayerMode::kNever; +#endif // OS_ANDROID + if (base::FeatureList::IsEnabled(media::kUseSurfaceLayerForVideo)) return blink::WebMediaPlayer::SurfaceLayerMode::kAlways;
diff --git a/content/renderer/media/stream/media_stream_audio_processor_unittest.cc b/content/renderer/media/stream/media_stream_audio_processor_unittest.cc index 662e3b1..d4bd6299 100644 --- a/content/renderer/media/stream/media_stream_audio_processor_unittest.cc +++ b/content/renderer/media/stream/media_stream_audio_processor_unittest.cc
@@ -111,7 +111,8 @@ expected_output_buffer_size * base::TimeDelta::FromSeconds(1) / expected_output_sample_rate; for (int i = 0; i < kNumberOfPacketsForTest; ++i) { - data_bus->FromInterleaved(data_ptr, data_bus->frames(), 2); + data_bus->FromInterleaved<media::SignedInt16SampleTypeTraits>( + data_ptr, data_bus->frames()); audio_processor->PushCaptureData(*data_bus, input_capture_delay); // |audio_processor| does nothing when the audio processing is off in
diff --git a/content/renderer/media/webrtc/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc/webrtc_audio_device_impl.cc index 32f808d7..82f7916 100644 --- a/content/renderer/media/webrtc/webrtc_audio_device_impl.cc +++ b/content/renderer/media/webrtc/webrtc_audio_device_impl.cc
@@ -75,16 +75,17 @@ // Get 10ms audio and copy result to temporary byte buffer. render_buffer_.resize(audio_bus->frames() * audio_bus->channels()); - const int bytes_per_sample = sizeof(render_buffer_[0]); - static const int kBitsPerByte = 8; + constexpr int kBytesPerSample = 2; + static_assert(sizeof(render_buffer_[0]) == kBytesPerSample, + "kBytesPerSample and FromInterleaved expect 2 bytes."); int64_t elapsed_time_ms = -1; int64_t ntp_time_ms = -1; int16_t* audio_data = render_buffer_.data(); TRACE_EVENT_BEGIN0("audio", "VoE::PullRenderData"); audio_transport_callback_->PullRenderData( - bytes_per_sample * kBitsPerByte, sample_rate, audio_bus->channels(), - frames_per_10_ms, audio_data, &elapsed_time_ms, &ntp_time_ms); + kBytesPerSample * 8, sample_rate, audio_bus->channels(), frames_per_10_ms, + audio_data, &elapsed_time_ms, &ntp_time_ms); TRACE_EVENT_END2("audio", "VoE::PullRenderData", "elapsed_time_ms", elapsed_time_ms, "ntp_time_ms", ntp_time_ms); if (elapsed_time_ms >= 0) @@ -92,7 +93,8 @@ // De-interleave each channel and convert to 32-bit floating-point // with nominal range -1.0 -> +1.0 to match the callback format. - audio_bus->FromInterleaved(audio_data, audio_bus->frames(), bytes_per_sample); + audio_bus->FromInterleaved<media::SignedInt16SampleTypeTraits>( + audio_data, audio_bus->frames()); // Pass the render data to the playout sinks. base::AutoLock auto_lock(lock_);
diff --git a/content/renderer/media/webrtc/webrtc_audio_sink.cc b/content/renderer/media/webrtc/webrtc_audio_sink.cc index c880b1d2..45bc0a6 100644 --- a/content/renderer/media/webrtc/webrtc_audio_sink.cc +++ b/content/renderer/media/webrtc/webrtc_audio_sink.cc
@@ -87,9 +87,10 @@ // TODO(henrika): Remove this conversion once the interface in libjingle // supports float vectors. - audio_bus.ToInterleaved(audio_bus.frames(), - sizeof(interleaved_data_[0]), - interleaved_data_.get()); + static_assert(sizeof(interleaved_data_[0]) == 2, + "ToInterleaved expects 2 bytes."); + audio_bus.ToInterleaved<media::SignedInt16SampleTypeTraits>( + audio_bus.frames(), interleaved_data_.get()); adapter_->DeliverPCMToWebRtcSinks(interleaved_data_.get(), params_.sample_rate(), audio_bus.channels(),
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 506e027..ba98cf96 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -1194,9 +1194,16 @@ Send(new WidgetHostMsg_DidCommitAndDrawCompositorFrame(routing_id_)); } +void RenderWidget::WillCommitCompositorFrame() { + if (GetWebWidget()) + GetWebWidget()->BeginCommitCompositorFrame(); +} + void RenderWidget::DidCommitCompositorFrame() { if (delegate()) delegate()->DidCommitCompositorFrameForWidget(); + if (GetWebWidget()) + GetWebWidget()->EndCommitCompositorFrame(); } void RenderWidget::DidCompletePageScaleAnimation() { @@ -1314,17 +1321,23 @@ } void RenderWidget::RecordStartOfFrameMetrics() { - if (!GetWebWidget()) - return; - - GetWebWidget()->RecordStartOfFrameMetrics(); + if (GetWebWidget()) + GetWebWidget()->RecordStartOfFrameMetrics(); } void RenderWidget::RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) { - if (!GetWebWidget()) - return; + if (GetWebWidget()) + GetWebWidget()->RecordEndOfFrameMetrics(frame_begin_time); +} - GetWebWidget()->RecordEndOfFrameMetrics(frame_begin_time); +void RenderWidget::BeginUpdateLayers() { + if (GetWebWidget()) + GetWebWidget()->BeginUpdateLayers(); +} + +void RenderWidget::EndUpdateLayers() { + if (GetWebWidget()) + GetWebWidget()->BeginUpdateLayers(); } void RenderWidget::WillBeginCompositorFrame() {
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index dad344a..98957193 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -341,10 +341,13 @@ void RequestNewLayerTreeFrameSink( LayerTreeFrameSinkCallback callback) override; void DidCommitAndDrawCompositorFrame() override; + void WillCommitCompositorFrame() override; void DidCommitCompositorFrame() override; void DidCompletePageScaleAnimation() override; void RecordStartOfFrameMetrics() override; void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) override; + void BeginUpdateLayers() override; + void EndUpdateLayers() override; void UpdateVisualState() override; void WillBeginCompositorFrame() override;
diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc index ebcba1e..d24067e 100644 --- a/content/renderer/render_widget_fullscreen_pepper.cc +++ b/content/renderer/render_widget_fullscreen_pepper.cc
@@ -345,7 +345,6 @@ } UpdateLayerBounds(); layer_->SetIsDrawable(true); - layer_->SetHitTestable(true); layer_tree_view()->SetNonBlinkManagedRootLayer(layer_); }
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc index f508156..6074365 100644 --- a/content/renderer/service_worker/embedded_worker_instance_client_impl.cc +++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.cc
@@ -38,7 +38,6 @@ } void EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed() { - DCHECK(worker_); TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::WorkerContextDestroyed"); delete this; @@ -47,11 +46,13 @@ void EmbeddedWorkerInstanceClientImpl::StartWorker( blink::mojom::EmbeddedWorkerStartParamsPtr params) { DCHECK(ChildThreadImpl::current()); - DCHECK(!worker_); + DCHECK(!service_worker_context_client_); TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StartWorker"); auto start_timing = blink::mojom::EmbeddedWorkerStartTiming::New(); start_timing->start_worker_received_time = base::TimeTicks::Now(); + auto start_data = BuildStartData(*params); + DCHECK(!params->provider_info->cache_storage || base::FeatureList::IsEnabled( blink::features::kEagerCacheStorageSetupForServiceWorkers)); @@ -59,11 +60,8 @@ std::move(params->provider_info->cache_storage); service_manager::mojom::InterfaceProviderPtrInfo interface_provider = std::move(params->provider_info->interface_provider); - blink::PrivacyPreferences privacy_preferences( - params->renderer_preferences->enable_do_not_track, - params->renderer_preferences->enable_referrers); - auto client = std::make_unique<ServiceWorkerContextClient>( + service_worker_context_client_ = std::make_unique<ServiceWorkerContextClient>( params->service_worker_version_id, params->scope, params->script_url, !params->installed_scripts_info.is_null(), std::move(params->renderer_preferences), @@ -82,69 +80,7 @@ UMA_HISTOGRAM_ENUMERATION( "ServiceWorker.EmbeddedWorkerInstanceClient.StartWorker", metric, StartWorkerHistogramEnum::NUM_TYPES); - worker_ = StartWorkerContext( - std::move(params), std::move(client), std::move(cache_storage), - std::move(interface_provider), std::move(privacy_preferences)); -} -void EmbeddedWorkerInstanceClientImpl::StopWorker() { - // StopWorker must be called after StartWorker is called. - DCHECK(worker_); - - TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker"); - worker_->TerminateWorkerContext(); - // We continue in WorkerContextDestroyed() after the worker thread is stopped. -} - -void EmbeddedWorkerInstanceClientImpl::ResumeAfterDownload() { - DCHECK(worker_); - worker_->ResumeAfterDownload(); -} - -void EmbeddedWorkerInstanceClientImpl::AddMessageToConsole( - blink::mojom::ConsoleMessageLevel level, - const std::string& message) { - DCHECK(worker_); - worker_->AddMessageToConsole( - blink::WebConsoleMessage(level, blink::WebString::FromUTF8(message))); -} - -void EmbeddedWorkerInstanceClientImpl::BindDevToolsAgent( - blink::mojom::DevToolsAgentHostAssociatedPtrInfo host, - blink::mojom::DevToolsAgentAssociatedRequest request) { - DCHECK(worker_); - worker_->BindDevToolsAgent(host.PassHandle(), request.PassHandle()); -} - -EmbeddedWorkerInstanceClientImpl::EmbeddedWorkerInstanceClientImpl( - blink::mojom::EmbeddedWorkerInstanceClientRequest request) - : binding_(this, std::move(request)) { - binding_.set_connection_error_handler(base::BindOnce( - &EmbeddedWorkerInstanceClientImpl::OnError, base::Unretained(this))); -} - -EmbeddedWorkerInstanceClientImpl::~EmbeddedWorkerInstanceClientImpl() {} - -void EmbeddedWorkerInstanceClientImpl::OnError() { - // The connection to the browser process broke. - if (worker_) { - // The worker is running, so tell it to stop. We continue in - // WorkerContextDestroyed(). - StopWorker(); - return; - } - - // Nothing left to do. - delete this; -} - -std::unique_ptr<blink::WebEmbeddedWorker> -EmbeddedWorkerInstanceClientImpl::StartWorkerContext( - blink::mojom::EmbeddedWorkerStartParamsPtr params, - std::unique_ptr<ServiceWorkerContextClient> context_client, - blink::mojom::CacheStoragePtrInfo cache_storage, - service_manager::mojom::InterfaceProviderPtrInfo interface_provider, - blink::PrivacyPreferences privacy_preferences) { std::unique_ptr<blink::WebServiceWorkerInstalledScriptsManagerParams> installed_scripts_manager_params; // |installed_scripts_info| is null if scripts should be served by net layer, @@ -164,29 +100,84 @@ } auto worker = blink::WebEmbeddedWorker::Create( - std::move(context_client), std::move(installed_scripts_manager_params), + service_worker_context_client_.get(), + std::move(installed_scripts_manager_params), params->content_settings_proxy.PassHandle(), cache_storage.PassHandle(), interface_provider.PassHandle()); + service_worker_context_client_->StartWorkerContext(std::move(worker), + start_data); +} +void EmbeddedWorkerInstanceClientImpl::StopWorker() { + TRACE_EVENT0("ServiceWorker", "EmbeddedWorkerInstanceClientImpl::StopWorker"); + // StopWorker must be called after StartWorker is called. + service_worker_context_client_->worker().TerminateWorkerContext(); + // We continue in WorkerContextDestroyed() after the worker thread is stopped. +} + +void EmbeddedWorkerInstanceClientImpl::ResumeAfterDownload() { + service_worker_context_client_->worker().ResumeAfterDownload(); +} + +void EmbeddedWorkerInstanceClientImpl::AddMessageToConsole( + blink::mojom::ConsoleMessageLevel level, + const std::string& message) { + service_worker_context_client_->worker().AddMessageToConsole( + blink::WebConsoleMessage(level, blink::WebString::FromUTF8(message))); +} + +void EmbeddedWorkerInstanceClientImpl::BindDevToolsAgent( + blink::mojom::DevToolsAgentHostAssociatedPtrInfo host, + blink::mojom::DevToolsAgentAssociatedRequest request) { + service_worker_context_client_->worker().BindDevToolsAgent( + host.PassHandle(), request.PassHandle()); +} + +EmbeddedWorkerInstanceClientImpl::EmbeddedWorkerInstanceClientImpl( + blink::mojom::EmbeddedWorkerInstanceClientRequest request) + : binding_(this, std::move(request)) { + binding_.set_connection_error_handler(base::BindOnce( + &EmbeddedWorkerInstanceClientImpl::OnError, base::Unretained(this))); +} + +EmbeddedWorkerInstanceClientImpl::~EmbeddedWorkerInstanceClientImpl() {} + +void EmbeddedWorkerInstanceClientImpl::OnError() { + // The connection to the browser process broke. + if (service_worker_context_client_) { + // The worker is running, so tell it to stop. We continue in + // WorkerContextDestroyed(). + StopWorker(); + return; + } + + // Nothing left to do. + delete this; +} + +blink::WebEmbeddedWorkerStartData +EmbeddedWorkerInstanceClientImpl::BuildStartData( + const blink::mojom::EmbeddedWorkerStartParams& params) { blink::WebEmbeddedWorkerStartData start_data; - start_data.script_url = params->script_url; - start_data.user_agent = blink::WebString::FromUTF8(params->user_agent); - start_data.script_type = params->script_type; + start_data.script_url = params.script_url; + start_data.user_agent = blink::WebString::FromUTF8(params.user_agent); + start_data.script_type = params.script_type; start_data.wait_for_debugger_mode = - params->wait_for_debugger + params.wait_for_debugger ? blink::WebEmbeddedWorkerStartData::kWaitForDebugger : blink::WebEmbeddedWorkerStartData::kDontWaitForDebugger; - start_data.devtools_worker_token = params->devtools_worker_token; + start_data.devtools_worker_token = params.devtools_worker_token; start_data.v8_cache_options = - static_cast<blink::WebSettings::V8CacheOptions>(params->v8_cache_options); + static_cast<blink::WebSettings::V8CacheOptions>(params.v8_cache_options); start_data.pause_after_download_mode = - params->pause_after_download + params.pause_after_download ? blink::WebEmbeddedWorkerStartData::kPauseAfterDownload : blink::WebEmbeddedWorkerStartData::kDontPauseAfterDownload; - start_data.privacy_preferences = std::move(privacy_preferences); + start_data.privacy_preferences = blink::PrivacyPreferences( + params.renderer_preferences->enable_do_not_track, + params.renderer_preferences->enable_referrers); - worker->StartWorkerContext(start_data); - return worker; + return start_data; } } // namespace content
diff --git a/content/renderer/service_worker/embedded_worker_instance_client_impl.h b/content/renderer/service_worker/embedded_worker_instance_client_impl.h index 6e2fe8a..d1e0984f 100644 --- a/content/renderer/service_worker/embedded_worker_instance_client_impl.h +++ b/content/renderer/service_worker/embedded_worker_instance_client_impl.h
@@ -14,12 +14,7 @@ #include "third_party/blink/public/mojom/service_worker/embedded_worker.mojom.h" #include "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom.h" #include "third_party/blink/public/mojom/worker/worker_content_settings_proxy.mojom.h" - -namespace blink { - -class WebEmbeddedWorker; - -} // namespace blink +#include "third_party/blink/public/web/web_embedded_worker_start_data.h" namespace content { @@ -76,17 +71,13 @@ // Handler of connection error bound to |binding_|. void OnError(); - std::unique_ptr<blink::WebEmbeddedWorker> StartWorkerContext( - blink::mojom::EmbeddedWorkerStartParamsPtr params, - std::unique_ptr<ServiceWorkerContextClient> context_client, - blink::mojom::CacheStoragePtrInfo cache_storage, - service_manager::mojom::InterfaceProviderPtrInfo interface_provider, - blink::PrivacyPreferences privacy_preferences); + blink::WebEmbeddedWorkerStartData BuildStartData( + const blink::mojom::EmbeddedWorkerStartParams& params); mojo::Binding<blink::mojom::EmbeddedWorkerInstanceClient> binding_; - // nullptr means the worker is not running. - std::unique_ptr<blink::WebEmbeddedWorker> worker_; + // nullptr means worker is not running. + std::unique_ptr<ServiceWorkerContextClient> service_worker_context_client_; DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerInstanceClientImpl); };
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc index 1b9eb29..09aa42f 100644 --- a/content/renderer/service_worker/service_worker_context_client.cc +++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -348,6 +348,19 @@ DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); } +void ServiceWorkerContextClient::StartWorkerContext( + std::unique_ptr<blink::WebEmbeddedWorker> worker, + const blink::WebEmbeddedWorkerStartData& start_data) { + DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); + worker_ = std::move(worker); + worker_->StartWorkerContext(start_data); +} + +blink::WebEmbeddedWorker& ServiceWorkerContextClient::worker() { + DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); + return *worker_; +} + void ServiceWorkerContextClient::WorkerReadyForInspectionOnMainThread() { DCHECK(main_thread_task_runner_->RunsTasksInCurrentSequence()); (*instance_host_)->OnReadyForInspection();
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h index 5cd057d..c81cb28 100644 --- a/content/renderer/service_worker/service_worker_context_client.h +++ b/content/renderer/service_worker/service_worker_context_client.h
@@ -35,6 +35,7 @@ #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_error.h" #include "third_party/blink/public/web/modules/service_worker/web_service_worker_context_client.h" #include "third_party/blink/public/web/modules/service_worker/web_service_worker_context_proxy.h" +#include "third_party/blink/public/web/web_embedded_worker.h" #include "v8/include/v8.h" namespace base { @@ -94,6 +95,12 @@ // Called on the main thread. ~ServiceWorkerContextClient() override; + // Called on the main thread. + void StartWorkerContext(std::unique_ptr<blink::WebEmbeddedWorker> worker, + const blink::WebEmbeddedWorkerStartData& start_data); + // Called on the main thread. + blink::WebEmbeddedWorker& worker(); + // WebServiceWorkerContextClient overrides. void WorkerReadyForInspectionOnMainThread() override; void WorkerContextFailedToStartOnMainThread() override; @@ -425,6 +432,8 @@ network::mojom::URLLoaderFactoryPtr network_service_connection_error_handler_holder_; + std::unique_ptr<blink::WebEmbeddedWorker> worker_; + DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextClient); };
diff --git a/content/renderer/service_worker/service_worker_context_client_unittest.cc b/content/renderer/service_worker/service_worker_context_client_unittest.cc index d450a51c..cddf115 100644 --- a/content/renderer/service_worker/service_worker_context_client_unittest.cc +++ b/content/renderer/service_worker/service_worker_context_client_unittest.cc
@@ -72,9 +72,8 @@ // is called on EmbeddedWorkerInstanceClientImpl so it can self-destruct. class FakeWebEmbeddedWorker : public blink::WebEmbeddedWorker { public: - explicit FakeWebEmbeddedWorker( - std::unique_ptr<ServiceWorkerContextClient> context_client) - : context_client_(std::move(context_client)) {} + explicit FakeWebEmbeddedWorker(ServiceWorkerContextClient* context_client) + : context_client_(context_client) {} void StartWorkerContext(const blink::WebEmbeddedWorkerStartData&) override {} void TerminateWorkerContext() override { @@ -88,7 +87,7 @@ mojo::ScopedInterfaceEndpointHandle) override {} private: - std::unique_ptr<ServiceWorkerContextClient> context_client_; + ServiceWorkerContextClient* context_client_; }; class MockWebServiceWorkerContextProxy @@ -322,10 +321,15 @@ nullptr /* preference_watcher_request */, nullptr /* subresource_loaders */, blink::scheduler::GetSingleThreadTaskRunnerForTesting()); + auto* context_client_raw = context_client.get(); - embedded_worker_instance_client->worker_ = - std::make_unique<FakeWebEmbeddedWorker>(std::move(context_client)); + embedded_worker_instance_client->service_worker_context_client_ = + std::move(context_client); + context_client_raw->StartWorkerContext( + std::make_unique<FakeWebEmbeddedWorker>(context_client_raw), + blink::WebEmbeddedWorkerStartData()); + // TODO(falken): We should mock a worker thread task runner instead of // using GetSingleThreadTaskRunnerForTesting() again, since that's the // runner we used to mock the main thread when constructing the context
diff --git a/content/renderer/worker/dedicated_worker_host_factory_client.cc b/content/renderer/worker/dedicated_worker_host_factory_client.cc index 7b69cac..6cf5bb11 100644 --- a/content/renderer/worker/dedicated_worker_host_factory_client.cc +++ b/content/renderer/worker/dedicated_worker_host_factory_client.cc
@@ -22,13 +22,21 @@ blink::WebDedicatedWorker* worker, service_manager::InterfaceProvider* interface_provider) : worker_(worker), binding_(this) { - DCHECK(blink::features::IsPlzDedicatedWorkerEnabled()); DCHECK(interface_provider); interface_provider->GetInterface(mojo::MakeRequest(&factory_)); } DedicatedWorkerHostFactoryClient::~DedicatedWorkerHostFactoryClient() = default; +void DedicatedWorkerHostFactoryClient::CreateWorkerHostDeprecated( + const blink::WebSecurityOrigin& script_origin) { + DCHECK(!blink::features::IsPlzDedicatedWorkerEnabled()); + service_manager::mojom::InterfaceProviderPtr interface_provider_ptr; + factory_->CreateWorkerHost(script_origin, + mojo::MakeRequest(&interface_provider_ptr)); + OnWorkerHostCreated(std::move(interface_provider_ptr)); +} + void DedicatedWorkerHostFactoryClient::CreateWorkerHost( const blink::WebURL& script_url, const blink::WebSecurityOrigin& script_origin, @@ -63,7 +71,6 @@ void DedicatedWorkerHostFactoryClient::OnWorkerHostCreated( service_manager::mojom::InterfaceProviderPtr interface_provider) { - DCHECK(blink::features::IsPlzDedicatedWorkerEnabled()); worker_->OnWorkerHostCreated(interface_provider.PassInterface().PassHandle()); }
diff --git a/content/renderer/worker/dedicated_worker_host_factory_client.h b/content/renderer/worker/dedicated_worker_host_factory_client.h index a48897a..539e07c5 100644 --- a/content/renderer/worker/dedicated_worker_host_factory_client.h +++ b/content/renderer/worker/dedicated_worker_host_factory_client.h
@@ -24,7 +24,6 @@ class WebWorkerFetchContextImpl; struct NavigationResponseOverrideParameters; -// PlzDedicatedWorker: // DedicatedWorkerHostFactoryClient intermediates between // blink::(Web)DedicatedWorker and content::DedicatedWorkerHostFactory. This // is bound with the thread where the execution context creating this worker @@ -40,6 +39,8 @@ ~DedicatedWorkerHostFactoryClient() override; // Implements blink::WebDedicatedWorkerHostFactoryClient. + void CreateWorkerHostDeprecated( + const blink::WebSecurityOrigin& script_origin) override; void CreateWorkerHost(const blink::WebURL& script_url, const blink::WebSecurityOrigin& script_origin, mojo::ScopedMessagePipeHandle blob_url_token) override;
diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn index d1e5690..14ac609 100644 --- a/content/shell/android/BUILD.gn +++ b/content/shell/android/BUILD.gn
@@ -164,7 +164,6 @@ android_apk("content_shell_apk") { testonly = true - enable_multidex = true deps = [ ":content_shell_apk_java", ":content_shell_assets", @@ -223,6 +222,10 @@ ] apk_under_test = ":content_shell_apk" apk_name = "ContentShellTest" + + # Explicitly disabling multidex since there are build errors with this + # apk_under_test providing the same classes as the instrumentation_test_apk. + enable_multidex = false shared_libraries = [ ":libcontent_native_test" ] android_manifest = "javatests/AndroidManifest.xml" } @@ -252,7 +255,6 @@ android_apk(_linker_test_apk_target_name) { testonly = true - enable_multidex = true deps = [ ":content_shell_assets", ":content_shell_java",
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index f9712dd..f3e0b99 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -1180,7 +1180,6 @@ } if (is_android) { - enable_multidex = true if (is_component_build) { sources += [ "../browser/android/render_widget_host_connector.cc" ] } @@ -1350,10 +1349,6 @@ check_includes = false } - if (is_android) { - enable_multidex = true - } - defines = [] sources = [ "../browser/accessibility/browser_accessibility_mac_unittest.mm", @@ -1785,7 +1780,6 @@ "../renderer/loader/test_request_peer.cc", "../renderer/loader/test_request_peer.h", "../renderer/loader/url_loader_client_impl_unittest.cc", - "../renderer/loader/url_response_body_consumer_unittest.cc", "../renderer/loader/web_data_consumer_handle_impl_unittest.cc", "../renderer/loader/web_url_loader_impl_unittest.cc", "../renderer/low_memory_mode_controller_unittest.cc",
diff --git a/content/test/data/accessibility/aria/aria-alert-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-alert-expected-auralinux.txt new file mode 100644 index 0000000..ad13113 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-alert-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[alert] +++++[text] name='This test is for aria role="alert"' member-of
diff --git a/content/test/data/accessibility/aria/aria-application-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-application-expected-auralinux.txt new file mode 100644 index 0000000..4edfc3e --- /dev/null +++ b/content/test/data/accessibility/aria/aria-application-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[embedded component]
diff --git a/content/test/data/accessibility/aria/aria-article-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-article-expected-auralinux.txt new file mode 100644 index 0000000..cacef213 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-article-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[article] +++++[text] name='This is an ARIA article.'
diff --git a/content/test/data/accessibility/aria/aria-atomic-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-atomic-expected-auralinux.txt new file mode 100644 index 0000000..b33acc5 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-atomic-expected-auralinux.txt
@@ -0,0 +1,9 @@ +[document web] +++[log] atomic:false container-atomic:false live:polite +++++[text] name='This test is for aria-atomic="false"' atomic:false container-atomic:false +++[log] atomic:true container-atomic:true live:polite +++++[text] name='This test is for aria-atomic="true"' member-of atomic:false container-atomic:true +++[alert] atomic:true container-atomic:true live:assertive +++++[text] name='This test is for alert.' member-of atomic:false container-atomic:true +++[statusbar] atomic:true container-atomic:true live:polite +++++[text] name='This test is for status.' member-of atomic:false container-atomic:true
diff --git a/content/test/data/accessibility/aria/aria-atomic.html b/content/test/data/accessibility/aria/aria-atomic.html index 28851a1..19931cb 100644 --- a/content/test/data/accessibility/aria/aria-atomic.html +++ b/content/test/data/accessibility/aria/aria-atomic.html
@@ -5,6 +5,9 @@ @WIN-ALLOW:container-atomic:* @BLINK-ALLOW:liveAtomic=true @BLINK-ALLOW:containerLiveAtomic=true +@AURALINUX-ALLOW:atomic:* +@AURALINUX-ALLOW:container-atomic:* +@AURALINUX-ALLOW:live:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-autocomplete-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-autocomplete-expected-auralinux.txt new file mode 100644 index 0000000..cdaca49 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-autocomplete-expected-auralinux.txt
@@ -0,0 +1,7 @@ +[document web] +++[section] +++++[combo box] supports-autocompletion selectable-text autocomplete:inline haspopup:listbox +++++[combo box] supports-autocompletion selectable-text autocomplete:list haspopup:listbox +++++[combo box] supports-autocompletion selectable-text autocomplete:both haspopup:listbox +++++[combo box] selectable-text haspopup:listbox +++++[autocomplete] supports-autocompletion selectable-text autocomplete:inline
diff --git a/content/test/data/accessibility/aria/aria-autocomplete.html b/content/test/data/accessibility/aria/aria-autocomplete.html index 18fb81c..73c6939 100644 --- a/content/test/data/accessibility/aria/aria-autocomplete.html +++ b/content/test/data/accessibility/aria/aria-autocomplete.html
@@ -3,6 +3,9 @@ @WIN-ALLOW:autocomplete:* @WIN-ALLOW:haspopup* @BLINK-ALLOW:haspopup* +@AURALINUX-ALLOW:supports-autocompletion +@AURALINUX-ALLOW:autocomplete:* +@AURALINUX-ALLOW:haspopup:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-banner-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-banner-expected-auralinux.txt new file mode 100644 index 0000000..228a02f --- /dev/null +++ b/content/test/data/accessibility/aria/aria-banner-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[landmark] xml-roles:banner +++++[text] name='Chromium Browser'
diff --git a/content/test/data/accessibility/aria/aria-banner.html b/content/test/data/accessibility/aria/aria-banner.html index adeb658..c259224 100644 --- a/content/test/data/accessibility/aria/aria-banner.html +++ b/content/test/data/accessibility/aria/aria-banner.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:xml-roles:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-busy-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-busy-expected-auralinux.txt new file mode 100644 index 0000000..92d00ae --- /dev/null +++ b/content/test/data/accessibility/aria/aria-busy-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[log] name='Busy log' busy container-live:polite live:polite +++[log] name='Not-busy log' container-live:polite live:polite +++[section] name='plain div' busy
diff --git a/content/test/data/accessibility/aria/aria-busy.html b/content/test/data/accessibility/aria/aria-busy.html index 32417c9..b2a651e 100644 --- a/content/test/data/accessibility/aria/aria-busy.html +++ b/content/test/data/accessibility/aria/aria-busy.html
@@ -5,6 +5,8 @@ @WIN-ALLOW:BUSY* @BLINK-ALLOW:liveBusy* @BLINK-ALLOW:containerLiveBusy* +@AURALINUX-ALLOW:busy +@AURALINUX-ALLOW:*live* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-button-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-button-expected-auralinux.txt new file mode 100644 index 0000000..045c2af --- /dev/null +++ b/content/test/data/accessibility/aria/aria-button-expected-auralinux.txt
@@ -0,0 +1,9 @@ +[document web] +++[push button] name='Button1' xml-roles:button +++[toggle button] name='Button2' pressed checkable:true xml-roles:button +++[toggle button] name='Button3' checkable:true xml-roles:button +++[push button] name='Button4' haspopup:menu xml-roles:button +++[push button] name='Button5' xml-roles:button +++[push button] name='Complex button ' xml-roles:button +++++[text] name='Complex button ' +++++[entry] selectable-text
diff --git a/content/test/data/accessibility/aria/aria-button.html b/content/test/data/accessibility/aria/aria-button.html index 1070f48..7e19308 100644 --- a/content/test/data/accessibility/aria/aria-button.html +++ b/content/test/data/accessibility/aria/aria-button.html
@@ -7,6 +7,9 @@ @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:PRESSED @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:haspopup* +@AURALINUX-ALLOW:pressed +@AURALINUX-ALLOW:xml-roles:* @BLINK-ALLOW:haspopup* --> <!DOCTYPE html>
diff --git a/content/test/data/accessibility/aria/aria-cell-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-cell-expected-auralinux.txt new file mode 100644 index 0000000..88b140d4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-cell-expected-auralinux.txt
@@ -0,0 +1,12 @@ +[document web] +++[table] cols=2 headers=('Browser', 'Rendering Engine'); rows=2 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Browser' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Browser' +++++++[column header] name='Rendering Engine' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Rendering Engine' +++++[table row] selectable +++++++[table cell] name='Chrome' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Chrome' +++++++[table cell] name='Blink' selectable (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Blink'
diff --git a/content/test/data/accessibility/aria/aria-checkbox-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-checkbox-expected-auralinux.txt new file mode 100644 index 0000000..40ad16d --- /dev/null +++ b/content/test/data/accessibility/aria/aria-checkbox-expected-auralinux.txt
@@ -0,0 +1,9 @@ +[document web] +++[check box] name='CheckBox1' checked checkable:true xml-roles:checkbox +++[check box] name='CheckBox2' checkable:true xml-roles:checkbox +++[check box] name='CheckBox3' indeterminate checkable:true xml-roles:checkbox +++[check box] name='CheckBox4' checkable:true xml-roles:checkbox +++[check box] name='Complex checkbox' checkable:true xml-roles:checkbox +++++[text] name='Complex ' +++++[entry] selectable-text +++++[text] name=' checkbox'
diff --git a/content/test/data/accessibility/aria/aria-checkbox.html b/content/test/data/accessibility/aria/aria-checkbox.html index 0ec8ed7..9a2a40cb 100644 --- a/content/test/data/accessibility/aria/aria-checkbox.html +++ b/content/test/data/accessibility/aria/aria-checkbox.html
@@ -6,6 +6,12 @@ @WIN-ALLOW:IA2_STATE_* @WIN-ALLOW:MIXED* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:checked +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checkable:* +@AURALINUX-ALLOW:indeterminate +@AURALINUX-ALLOW:xml-roles:* + --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-checked-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-checked-expected-auralinux.txt new file mode 100644 index 0000000..570f29c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-checked-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[check box] checked checkable:true xml-roles:checkbox +++[check box] checkable:true xml-roles:checkbox +++[check box] indeterminate checkable:true xml-roles:checkbox
diff --git a/content/test/data/accessibility/aria/aria-checked.html b/content/test/data/accessibility/aria/aria-checked.html index 3a8fe3f..81eefb5 100644 --- a/content/test/data/accessibility/aria/aria-checked.html +++ b/content/test/data/accessibility/aria/aria-checked.html
@@ -2,6 +2,11 @@ @MAC-ALLOW:AXRole* @WIN-ALLOW:CHECKED* @WIN-ALLOW:MIXED* +@AURALINUX-ALLOW:checked +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checkable:* +@AURALINUX-ALLOW:indeterminate +@AURALINUX-ALLOW:xml-roles:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-col-attr-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-col-attr-expected-auralinux.txt new file mode 100644 index 0000000..ef09828 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-col-attr-expected-auralinux.txt
@@ -0,0 +1,18 @@ +[document web] +++[table] colcount:5 cols=4 headers=('cell 2', 'cell 4', 'cell 5'); rows=2 headers=(NONE); caption=false; spans=(cell at 0,3: 0x0) +++++[table row] selectable +++++++[column header] name='cell 2' selectable colindex:2 colspan:2 (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell 2' +++++++[column header] name='cell 4' selectable colindex:4 (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell 4' +++++++[column header] name='cell 5' selectable colindex:5 (row=0, col=2, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell 5' +++++[table row] selectable +++++++[table cell] name='cell 2' selectable colindex:2 (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='cell 2' +++++++[table cell] name='cell 3' selectable colindex:3 (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='cell 3' +++++++[table cell] name='cell 4' selectable colindex:4 (row=1, col=2, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='cell 4' +++++++[table cell] name='cell 5' selectable colindex:5 (row=1, col=3, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell 5'
diff --git a/content/test/data/accessibility/aria/aria-col-attr.html b/content/test/data/accessibility/aria/aria-col-attr.html index 39dc90c..8fd769b 100644 --- a/content/test/data/accessibility/aria/aria-col-attr.html +++ b/content/test/data/accessibility/aria/aria-col-attr.html
@@ -5,6 +5,9 @@ @MAC-ALLOW:AXARIAColumn* @BLINK-ALLOW:ariaColumn* @BLINK-ALLOW:ariaCellColumn* +@AURALINUX-ALLOW:colspan* +@AURALINUX-ALLOW:colcount* +@AURALINUX-ALLOW:colindex* --> <!-- For compatibility with earlier versions of Jaws, We do not expose aria-row/colcount and aria-row/colindex information if they match the
diff --git a/content/test/data/accessibility/aria/aria-columnheader-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-columnheader-expected-auralinux.txt new file mode 100644 index 0000000..2724dbc --- /dev/null +++ b/content/test/data/accessibility/aria/aria-columnheader-expected-auralinux.txt
@@ -0,0 +1,17 @@ +[document web] +++[table] cols=2 headers=('Browser', 'Rendering Engine'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Browser' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Browser' +++++++[column header] name='Rendering Engine' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Rendering Engine' +++++[table row] selectable +++++++[table cell] name='Chrome' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Chrome' +++++++[table cell] name='Blink' selectable (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Blink' +++++[table row] selectable +++++++[table cell] name='Safari' selectable (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Safari' +++++++[table cell] name='WebKit' selectable (row=2, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='WebKit'
diff --git a/content/test/data/accessibility/aria/aria-combobox-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-combobox-expected-auralinux.txt new file mode 100644 index 0000000..a4a85c0 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-combobox-expected-auralinux.txt
@@ -0,0 +1,7 @@ +[document web] +++[section] label-for +++++[text] name='State' +++[combo box] name='State' expandable expanded selectable-text labelled-by haspopup:listbox +++[list box] +++++[list item] name='Alabama' selectable +++++[list item] name='Alaska' selectable selected
diff --git a/content/test/data/accessibility/aria/aria-combobox.html b/content/test/data/accessibility/aria/aria-combobox.html index 21a66ad2..106fb1f 100644 --- a/content/test/data/accessibility/aria/aria-combobox.html +++ b/content/test/data/accessibility/aria/aria-combobox.html
@@ -9,6 +9,10 @@ @WIN-ALLOW:haspopup* @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:SELECT* +@AURALINUX-ALLOW:collapsed* +@AURALINUX-ALLOW:expand* +@AURALINUX-ALLOW:haspopup:* +@AURALINUX-ALLOW:select* @BLINK-ALLOW:haspopup* --> <html>
diff --git a/content/test/data/accessibility/aria/aria-complementary-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-complementary-expected-auralinux.txt new file mode 100644 index 0000000..664adf4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-complementary-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[landmark] xml-roles:complementary +++++[text] name='This is ARIA role complementary.'
diff --git a/content/test/data/accessibility/aria/aria-complementary.html b/content/test/data/accessibility/aria/aria-complementary.html index d4dd415..e43d917e 100644 --- a/content/test/data/accessibility/aria/aria-complementary.html +++ b/content/test/data/accessibility/aria/aria-complementary.html
@@ -3,6 +3,7 @@ @MAC-ALLOW:AXSubrole=* @MAC-ALLOW:AXRoleDescription=* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:xml-roles:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-contentinfo-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-contentinfo-expected-auralinux.txt new file mode 100644 index 0000000..d2cdac59a --- /dev/null +++ b/content/test/data/accessibility/aria/aria-contentinfo-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[landmark] xml-roles:contentinfo +++++[text] name='This is ARIA role contentinfo.'
diff --git a/content/test/data/accessibility/aria/aria-contentinfo.html b/content/test/data/accessibility/aria/aria-contentinfo.html index 843aa6e..637ddc3 100644 --- a/content/test/data/accessibility/aria/aria-contentinfo.html +++ b/content/test/data/accessibility/aria/aria-contentinfo.html
@@ -3,6 +3,7 @@ @MAC-ALLOW:AXSubrole=* @MAC-ALLOW:AXRoleDescription=* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:xml-roles:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-controls-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-controls-expected-auralinux.txt new file mode 100644 index 0000000..83953a5 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-controls-expected-auralinux.txt
@@ -0,0 +1,7 @@ +[document web] +++[menu bar] horizontal +++++[menu item] name='File' controller-for +++++[menu item] name='Edit' +++[menu] name='File' controlled-by +++++[menu item] name='New' +++++[menu item] name='Open'
diff --git a/content/test/data/accessibility/aria/aria-current-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-current-expected-auralinux.txt new file mode 100644 index 0000000..25bd797 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-current-expected-auralinux.txt
@@ -0,0 +1,24 @@ +[document web] +++[link] name='Section one' +++++[text] name='Section one' +++[text] name=' ' +++[link] name='Section two' +++++[text] name='Section two' +++[text] name=' ' +++[link] name='Section three' current:location +++++[text] name='Section three' +++[text] name='<newline>' +++[heading] name='Section one heading' +++++[text] name='Section one heading' +++[heading] name='Section two heading' +++++[text] name='Section two heading' +++[heading] name='Section three heading' +++++[text] name='Section three heading' +++[text] name='<newline>' +++[section] +++++[text] name='Span 1' +++++[text] name=' ' +++++[section] current:true +++++++[text] name='Span 2' +++++[text] name=' ' +++++[text] name='Span 3'
diff --git a/content/test/data/accessibility/aria/aria-current.html b/content/test/data/accessibility/aria/aria-current.html index e6106b63..691ff3e 100644 --- a/content/test/data/accessibility/aria/aria-current.html +++ b/content/test/data/accessibility/aria/aria-current.html
@@ -2,6 +2,7 @@ <!-- @WIN-ALLOW:current:* @BLINK-ALLOW:ariaCurrentState* +@AURALINUX-ALLOW:current:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-definition-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-definition-expected-auralinux.txt new file mode 100644 index 0000000..e884eaa --- /dev/null +++ b/content/test/data/accessibility/aria/aria-definition-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[description value] xml-roles:definition
diff --git a/content/test/data/accessibility/aria/aria-definition.html b/content/test/data/accessibility/aria/aria-definition.html index 124dd91..2de346e0 100644 --- a/content/test/data/accessibility/aria/aria-definition.html +++ b/content/test/data/accessibility/aria/aria-definition.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:xml-roles:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-describedby-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-describedby-expected-auralinux.txt new file mode 100644 index 0000000..0b16c07 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-describedby-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[entry] description='Your username should be your email id' selectable-text described-by +++[tool tip] description-for xml-roles:tooltip +++++[text] +++[entry] description='mmddyy' selectable-text
diff --git a/content/test/data/accessibility/aria/aria-describedby.html b/content/test/data/accessibility/aria/aria-describedby.html index d3e418b4..b76696e 100644 --- a/content/test/data/accessibility/aria/aria-describedby.html +++ b/content/test/data/accessibility/aria/aria-describedby.html
@@ -3,6 +3,8 @@ @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles:* @WIN-DENY:name* +@AURALINUX-ALLOW:xml-roles:* +@AURALINUX-DENY:name* @BLINK-ALLOW:descri* --> <!DOCTYPE html>
diff --git a/content/test/data/accessibility/aria/aria-dialog-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-dialog-expected-auralinux.txt new file mode 100644 index 0000000..410aa911 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-dialog-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[dialog] +++++[text] name='This is ARIA dialog.'
diff --git a/content/test/data/accessibility/aria/aria-directory-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-directory-expected-auralinux.txt new file mode 100644 index 0000000..a93c726 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-directory-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[list] xml-roles:directory
diff --git a/content/test/data/accessibility/aria/aria-directory.html b/content/test/data/accessibility/aria/aria-directory.html index 236f8e3..2260980 100644 --- a/content/test/data/accessibility/aria/aria-directory.html +++ b/content/test/data/accessibility/aria/aria-directory.html
@@ -3,6 +3,8 @@ @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles:* @WIN-DENY:name* +@AURALINUX-ALLOW:xml-roles:* +@AURALINUX-DENY:name* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-disabled-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-disabled-expected-auralinux.txt new file mode 100644 index 0000000..7eb8150 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-disabled-expected-auralinux.txt
@@ -0,0 +1,13 @@ +[document web] enabled sensitive +++[section] enabled sensitive +++++[entry] editable enabled sensitive selectable-text +++++[entry] editable selectable-text +++++[entry] editable enabled sensitive selectable-text +++[section] +++++[entry] editable selectable-text +++++[entry] editable selectable-text +++++[entry] editable enabled sensitive selectable-text +++[section] enabled sensitive +++++[entry] editable enabled sensitive selectable-text +++++[entry] editable selectable-text +++++[entry] editable enabled sensitive selectable-text
diff --git a/content/test/data/accessibility/aria/aria-disabled.html b/content/test/data/accessibility/aria/aria-disabled.html index bcced965..c6e2e34 100644 --- a/content/test/data/accessibility/aria/aria-disabled.html +++ b/content/test/data/accessibility/aria/aria-disabled.html
@@ -2,6 +2,9 @@ @MAC-ALLOW:AXEnabled* @WIN-ALLOW:UNAVAILABLE* @BLINK-ALLOW:disabled* +@AURALINUX-ALLOW:editable +@AURALINUX-ALLOW:enabled +@AURALINUX-ALLOW:sensitive --> <!DOCTYPE HTML> <html>
diff --git a/content/test/data/accessibility/aria/aria-dropeffect-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-dropeffect-expected-auralinux.txt new file mode 100644 index 0000000..708cdd1 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-dropeffect-expected-auralinux.txt
@@ -0,0 +1,23 @@ +[document web] +++[list] +++++[list item] dropeffect:copy +++++++[static] name='• ' +++++++[text] name='copy' +++++[list item] dropeffect:move +++++++[static] name='• ' +++++++[text] name='move' +++++[list item] dropeffect:link +++++++[static] name='• ' +++++++[text] name='link' +++++[list item] dropeffect:execute +++++++[static] name='• ' +++++++[text] name='execute' +++++[list item] dropeffect:popup +++++++[static] name='• ' +++++++[text] name='popup' +++++[list item] dropeffect:none +++++++[static] name='• ' +++++++[text] name='none(default)' +++++[list item] dropeffect:link|popup +++++++[static] name='• ' +++++++[text] name='link'
diff --git a/content/test/data/accessibility/aria/aria-dropeffect.html b/content/test/data/accessibility/aria/aria-dropeffect.html index 5b973f2..d030974 100644 --- a/content/test/data/accessibility/aria/aria-dropeffect.html +++ b/content/test/data/accessibility/aria/aria-dropeffect.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXDropEffects* @WIN-ALLOW:dropeffect* +@AURALINUX-ALLOW:dropeffect* --> <ul> <li aria-dropeffect="copy">copy</li>
diff --git a/content/test/data/accessibility/aria/aria-expanded-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-expanded-expected-auralinux.txt new file mode 100644 index 0000000..8646afae --- /dev/null +++ b/content/test/data/accessibility/aria/aria-expanded-expected-auralinux.txt
@@ -0,0 +1,9 @@ +[document web] +++[menu] +++++[menu item] name='New' haspopup:menu +++++[menu item] name='Open' expanded haspopup:menu +++++[menu item] name='Save' +++++[menu item] name='Quit' expanded +++[separator] horizontal current=0.000000 minimum=0.000000 maximum=0.000000 +++[separator] horizontal current=0.000000 minimum=0.000000 maximum=0.000000 +++[separator] horizontal current=0.000000 minimum=0.000000 maximum=0.000000
diff --git a/content/test/data/accessibility/aria/aria-expanded.html b/content/test/data/accessibility/aria/aria-expanded.html index d308c9d..3115f04 100644 --- a/content/test/data/accessibility/aria/aria-expanded.html +++ b/content/test/data/accessibility/aria/aria-expanded.html
@@ -5,6 +5,10 @@ @WIN-ALLOW:HASPOPUP* @WIN-ALLOW:haspopup* @BLINK-ALLOW:haspopup* +@AURALINUX-ALLOW:expanded* +@AURALINUX-ALLOW:collapsed* +@AURALINUX-ALLOW:haspopup:* +@AURALINUX-ALLOW:select* --> <ul role="menu" style="list-style-type: none"> <li role="menuitem" aria-haspopup="true" aria-expanded="false">New</li>
diff --git a/content/test/data/accessibility/aria/aria-feed-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-feed-expected-auralinux.txt new file mode 100644 index 0000000..993cd45b --- /dev/null +++ b/content/test/data/accessibility/aria/aria-feed-expected-auralinux.txt
@@ -0,0 +1,6 @@ +[document web] +++[panel] xml-roles:feed +++++[article] xml-roles:article +++++++[text] name='First' +++++[article] xml-roles:article +++++++[text] name='Second'
diff --git a/content/test/data/accessibility/aria/aria-feed.html b/content/test/data/accessibility/aria/aria-feed.html index 90beb17..973cf9f7 100644 --- a/content/test/data/accessibility/aria/aria-feed.html +++ b/content/test/data/accessibility/aria/aria-feed.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXRole* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-figure-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-figure-expected-auralinux.txt new file mode 100644 index 0000000..620fe7b --- /dev/null +++ b/content/test/data/accessibility/aria/aria-figure-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[panel] xml-roles:figure +++++[text] name='Figure'
diff --git a/content/test/data/accessibility/aria/aria-figure.html b/content/test/data/accessibility/aria/aria-figure.html index 196aba9..7268322a 100644 --- a/content/test/data/accessibility/aria/aria-figure.html +++ b/content/test/data/accessibility/aria/aria-figure.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXRole* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-form-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-form-expected-auralinux.txt new file mode 100644 index 0000000..74d0170 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-form-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[form] xml-roles:form
diff --git a/content/test/data/accessibility/aria/aria-form.html b/content/test/data/accessibility/aria/aria-form.html index 9b94e184..35f39aa 100644 --- a/content/test/data/accessibility/aria/aria-form.html +++ b/content/test/data/accessibility/aria/aria-form.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-grabbed-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-grabbed-expected-auralinux.txt new file mode 100644 index 0000000..64ce5bf --- /dev/null +++ b/content/test/data/accessibility/aria/aria-grabbed-expected-auralinux.txt
@@ -0,0 +1,14 @@ +[document web] +++[list] +++++[list item] grabbed:true +++++++[static] name='• ' +++++++[text] name='grabbed-true ' +++++++[image] name='blue' +++++[list item] grabbed:false +++++++[static] name='• ' +++++++[text] name='grabbed-false ' +++++++[image] name='blue' +++++[list item] +++++++[static] name='• ' +++++++[text] name='grabbed-undefined ' +++++++[image] name='blue'
diff --git a/content/test/data/accessibility/aria/aria-grabbed.html b/content/test/data/accessibility/aria/aria-grabbed.html index 83edf23c..40861c7 100644 --- a/content/test/data/accessibility/aria/aria-grabbed.html +++ b/content/test/data/accessibility/aria/aria-grabbed.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXGrabbed* @WIN-ALLOW:grabbed* +@AURALINUX-ALLOW:grabbed* --> <ul> <li aria-grabbed="true">grabbed-true
diff --git a/content/test/data/accessibility/aria/aria-grid-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-grid-expected-auralinux.txt new file mode 100644 index 0000000..ba72a89 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-grid-expected-auralinux.txt
@@ -0,0 +1,12 @@ +[document web] +++[table] xml-roles:grid cols=2 headers=('Browser', 'Rendering Engine'); rows=2 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable xml-roles:row +++++++[column header] name='Browser' selectable colindex:1 rowindex:1 xml-roles:columnheader (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Browser' +++++++[column header] name='Rendering Engine' selectable colindex:2 rowindex:1 xml-roles:columnheader (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Rendering Engine' +++++[table row] selectable xml-roles:row +++++++[table cell] name='Chrome' selectable colindex:1 rowindex:2 xml-roles:gridcell (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Chrome' +++++++[table cell] name='Blink' selectable colindex:2 rowindex:2 xml-roles:gridcell (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Blink'
diff --git a/content/test/data/accessibility/aria/aria-grid.html b/content/test/data/accessibility/aria/aria-grid.html index 519ee29..7be7d6e 100644 --- a/content/test/data/accessibility/aria/aria-grid.html +++ b/content/test/data/accessibility/aria/aria-grid.html
@@ -2,6 +2,10 @@ @MAC-ALLOW:AXRole* @WIN-ALLOW:*SELECTABLE @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-ALLOW:col* +@AURALINUX-ALLOW:row* +@AURALINUX-ALLOW:select* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-gridcell-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-gridcell-expected-auralinux.txt new file mode 100644 index 0000000..df09bb2 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-gridcell-expected-auralinux.txt
@@ -0,0 +1,12 @@ +[document web] +++[table] multiselectable xml-roles:grid cols=2 headers=('Browser', 'Rendering Engine'); rows=2 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable xml-roles:row +++++++[column header] name='Browser' selectable colindex:1 rowindex:1 xml-roles:columnheader (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Browser' +++++++[column header] name='Rendering Engine' selectable colindex:2 rowindex:1 xml-roles:columnheader (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Rendering Engine' +++++[table row] selectable xml-roles:row +++++++[table cell] name='Chrome' selectable colindex:1 rowindex:2 xml-roles:gridcell (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Chrome' +++++++[table cell] name='Blink' selectable colindex:2 rowindex:2 xml-roles:gridcell (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Blink'
diff --git a/content/test/data/accessibility/aria/aria-gridcell.html b/content/test/data/accessibility/aria/aria-gridcell.html index 258d8dc..5baca59 100644 --- a/content/test/data/accessibility/aria/aria-gridcell.html +++ b/content/test/data/accessibility/aria/aria-gridcell.html
@@ -2,6 +2,10 @@ @MAC-ALLOW:AXRole* @WIN-ALLOW:*SELECTABLE @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-ALLOW:col* +@AURALINUX-ALLOW:row* +@AURALINUX-ALLOW:select* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-group-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-group-expected-auralinux.txt new file mode 100644 index 0000000..fcef1bb --- /dev/null +++ b/content/test/data/accessibility/aria/aria-group-expected-auralinux.txt
@@ -0,0 +1,6 @@ +[document web] +++[panel] xml-roles:group +++++[link] name='Group Link1' xml-roles:link +++++++[text] name='Group Link1' +++++[link] name='Group Link2' xml-roles:link +++++++[text] name='Group Link2'
diff --git a/content/test/data/accessibility/aria/aria-group.html b/content/test/data/accessibility/aria/aria-group.html index f70f4a5..475f5cd 100644 --- a/content/test/data/accessibility/aria/aria-group.html +++ b/content/test/data/accessibility/aria/aria-group.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXRole* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-haspopup-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-haspopup-expected-auralinux.txt new file mode 100644 index 0000000..1521dd0 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-haspopup-expected-auralinux.txt
@@ -0,0 +1,10 @@ +[document web] +++[combo box] haspopup:menu +++[combo box] +++[combo box] haspopup:menu +++[combo box] haspopup:listbox +++[combo box] haspopup:grid +++[combo box] haspopup:dialog +++[combo box] haspopup:menu +++[combo box] haspopup:listbox +++[combo box] haspopup:listbox
diff --git a/content/test/data/accessibility/aria/aria-haspopup.html b/content/test/data/accessibility/aria/aria-haspopup.html index b959f52..81cdc86 100644 --- a/content/test/data/accessibility/aria/aria-haspopup.html +++ b/content/test/data/accessibility/aria/aria-haspopup.html
@@ -7,6 +7,10 @@ @WIN-ALLOW:HASPOPUP* @WIN-ALLOW:haspopup* @BLINK-ALLOW:haspopup* +@AURALINUX-ALLOW:collapsed* +@AURALINUX-ALLOW:expanded* +@AURALINUX-ALLOW:haspopup:* +@AURALINUX-ALLOW:select* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-heading-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-heading-expected-auralinux.txt new file mode 100644 index 0000000..08ba4d4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-heading-expected-auralinux.txt
@@ -0,0 +1,16 @@ +[document web] +++[heading] name='ARIA Heading 1' level:1 xml-roles:heading +++++[text] name='ARIA Heading 1' +++[heading] name='ARIA Heading 2' level:2 xml-roles:heading +++++[text] name='ARIA Heading 2' +++[heading] name='ARIA Heading 3' level:3 xml-roles:heading +++++[text] name='ARIA Heading 3' +++[heading] name='ARIA Heading 4' level:4 xml-roles:heading +++++[text] name='ARIA Heading 4' +++[heading] name='ARIA Heading 5' level:5 xml-roles:heading +++++[text] name='ARIA Heading 5' +++[heading] name='ARIA Heading 6' level:6 xml-roles:heading +++++[text] name='ARIA Heading 6' +++[section] +++++[heading] name='Heading' level:2 xml-roles:heading +++++++[text] name='Heading'
diff --git a/content/test/data/accessibility/aria/aria-heading.html b/content/test/data/accessibility/aria/aria-heading.html index 59178a8..c003591 100644 --- a/content/test/data/accessibility/aria/aria-heading.html +++ b/content/test/data/accessibility/aria/aria-heading.html
@@ -1,6 +1,8 @@ <!-- @WIN-ALLOW:level:* @WIN-ALLOW:xml-roles:heading +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-ALLOW:level:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-hidden-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-hidden-expected-auralinux.txt new file mode 100644 index 0000000..81ab41d4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-hidden-expected-auralinux.txt
@@ -0,0 +1,7 @@ +[document web] +++[section] +++++[text] name='blockDisplay' +++[section] +++++[text] name='blockDisplay Hiddenfalse' +++[section] +++[section] name='blockDisplay Hiddentruefocusable' hidden:true
diff --git a/content/test/data/accessibility/aria/aria-hidden.html b/content/test/data/accessibility/aria/aria-hidden.html index b8498aa..7b6ba88 100644 --- a/content/test/data/accessibility/aria/aria-hidden.html +++ b/content/test/data/accessibility/aria/aria-hidden.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXValue* @WIN-ALLOW:hidden* +@AURALINUX-ALLOW:hidden* --> <html> <head>
diff --git a/content/test/data/accessibility/aria/aria-illegal-val-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-illegal-val-expected-auralinux.txt new file mode 100644 index 0000000..062a09d --- /dev/null +++ b/content/test/data/accessibility/aria/aria-illegal-val-expected-auralinux.txt
@@ -0,0 +1,24 @@ +[document web] +++[log] name='Atomic illegal' atomic:true live:polite relevant:additions text +++[autocomplete] name='Autocomplete illegal' selectable-text autocomplete:x-illegal +++[log] name='Busy illegal' busy atomic:false busy:true live:polite relevant:additions text +++[tree item] name='Checked illegal' checked selectable checkable:true +++[section] name='Current illegal' current:true +++[section] name='Disabled illegal' +++[section] name='Dropeffect illegal' dropeffect:X-ILLEGAL +++[tree item] name='Expanded illegal' expanded selectable +++[section] name='Grabbed illegal' grabbed:X-ILLEGAL +++[push button] name='Haspopup illegal' haspopup:menu +++[section] name='Invalid illegal' invalid-entry +++[log] name='Live illegal' atomic:false live:X-ILLEGAL relevant:additions text +++[dialog] name='Modal illegal' modal +++[entry] name='Multiline illegal' selectable-text +++[table] name='Multiselectable illegal' multiselectable cols=0 headers=(NONE); rows=0 headers=(NONE); caption=false; spans=(all: 1x1) +++[slider] name='Orientation illegal' horizontal current=50.000000 minimum=0.000000 maximum=100.000000 +++[toggle button] name='Pressed illegal' pressed checkable:true +++[entry] name='Readonly illegal' selectable-text +++[log] name='Relevant illegal' atomic:false live:polite relevant:X-ILLEGAL +++[entry] name='Required illegal' required selectable-text +++[tree] multiselectable +++++[tree item] name='Selected illegal' selectable selected +++[column header] name='Sort illegal' selectable sort:other (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0)
diff --git a/content/test/data/accessibility/aria/aria-illegal-val.html b/content/test/data/accessibility/aria/aria-illegal-val.html index 724306e..f2902f6 100644 --- a/content/test/data/accessibility/aria/aria-illegal-val.html +++ b/content/test/data/accessibility/aria/aria-illegal-val.html
@@ -38,6 +38,30 @@ @BLINK-ALLOW:select* @BLINK-ALLOW:sort* @BLINK-ALLOW:vertical* +@AURALINUX-ALLOW:atomic* +@AURALINUX-ALLOW:autocomplete* +@AURALINUX-ALLOW:busy* +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checked* +@AURALINUX-ALLOW:current* +@AURALINUX-ALLOW:disabled* +@AURALINUX-ALLOW:dropeffect* +@AURALINUX-ALLOW:expanded* +@AURALINUX-ALLOW:grabbed* +@AURALINUX-ALLOW:haspopup* +@AURALINUX-ALLOW:hidden* +@AURALINUX-ALLOW:invalid* +@AURALINUX-ALLOW:live* +@AURALINUX-ALLOW:modal* +@AURALINUX-ALLOW:multiline* +@AURALINUX-ALLOW:multiselectable* +@AURALINUX-ALLOW:orientation* +@AURALINUX-ALLOW:pressed* +@AURALINUX-ALLOW:readonly* +@AURALINUX-ALLOW:relevant* +@AURALINUX-ALLOW:required* +@AURALINUX-ALLOW:selected* +@AURALINUX-ALLOW:sort* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-img-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-img-expected-auralinux.txt new file mode 100644 index 0000000..a0de7e1 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-img-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[image]
diff --git a/content/test/data/accessibility/aria/aria-invalid-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-invalid-expected-auralinux.txt new file mode 100644 index 0000000..ccbe786 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-invalid-expected-auralinux.txt
@@ -0,0 +1,23 @@ +[document web] +++[section] invalid-entry +++++[text] name='invalid=true' +++[entry] selectable-text +++++[text] name='An ' +++++[section] invalid-entry +++++++[text] name='eror' +++++[text] name=' via invalid=spelling' +++[entry] selectable-text +++++[text] name='An ' +++++[section] invalid-entry +++++++[text] name='errors' +++++[text] name=' via invalid=grammar' +++[section] +++++[text] name='invalid=false' +++[section] +++++[text] name='invalid=<empty>' +++[section] +++++[text] name='invalid=<default>' +++[section] invalid-entry +++++[text] name='invalid=unknown' +++[form] +++++[entry] invalid-entry selectable-text
diff --git a/content/test/data/accessibility/aria/aria-invalid.html b/content/test/data/accessibility/aria/aria-invalid.html index 7f695d5a..dfaf72d 100644 --- a/content/test/data/accessibility/aria/aria-invalid.html +++ b/content/test/data/accessibility/aria/aria-invalid.html
@@ -8,6 +8,7 @@ @WIN-ALLOW:IA2_STATE_INVALID_ENTRY @WIN-ALLOW:invalid* @WIN-DENY:name='' +@AURALINUX-ALLOW:invalid* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-keyshortcuts-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-keyshortcuts-expected-auralinux.txt new file mode 100644 index 0000000..5e44a72 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-keyshortcuts-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[section] +++++[push button] name='Cut' keyshortcuts:Ctrl+X +++++[push button] name='Copy' keyshortcuts:Ctrl+C +++++[push button] name='Paste' keyshortcuts:Ctrl+V
diff --git a/content/test/data/accessibility/aria/aria-keyshortcuts.html b/content/test/data/accessibility/aria/aria-keyshortcuts.html index 0773157..ad40673 100644 --- a/content/test/data/accessibility/aria/aria-keyshortcuts.html +++ b/content/test/data/accessibility/aria/aria-keyshortcuts.html
@@ -2,6 +2,7 @@ <!-- @WIN-ALLOW:keyboard_shortcut @BLINK-ALLOW:keyShortcuts* +@AURALINUX-ALLOW:keyshortcuts* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-label-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-label-expected-auralinux.txt new file mode 100644 index 0000000..6d942e3 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-label-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[check box] name='aria label' checkable:true
diff --git a/content/test/data/accessibility/aria/aria-label.html b/content/test/data/accessibility/aria/aria-label.html index 582d0e65..8b21525 100644 --- a/content/test/data/accessibility/aria/aria-label.html +++ b/content/test/data/accessibility/aria/aria-label.html
@@ -4,6 +4,8 @@ @WIN-ALLOW:IA2_STATE_CHECKABLE @WIN-ALLOW:xml-roles* @WIN-ALLOW:checkable* +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checkable:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-level-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-level-expected-auralinux.txt new file mode 100644 index 0000000..413a33c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-level-expected-auralinux.txt
@@ -0,0 +1,30 @@ +[document web] +++[heading] name='Level 2' level:2 +++++[text] name='Level 2' +++[heading] name='Level 9' level:9 +++++[text] name='Level 9' +++[heading] name='Level 1' level:1 +++++[text] name='Level 1' +++[heading] name='Level 3' level:3 +++++[text] name='Level 3' +++[heading] name='Level 3' level:3 +++++[text] name='Level 3' +++[heading] name='Level 4' level:4 +++++[text] name='Level 4' +++[heading] name='Level 5' level:5 +++++[text] name='Level 5' +++[tree] +++++[tree item] name='Tree item at level 1' expandable expanded selectable level:1 +++++++[text] name='Tree item at level 1' +++++++[panel] +++++++++[tree item] name='Tree item at level 2' selectable level:2 +++++++++++[text] name='Tree item at level 2' +++++[tree item] name='Tree item at level 3' selectable level:3 +++++++[text] name='Tree item at level 3' +++[tree table] +++++[table row] selectable level:1 +++++++[table cell] name='Cell at level 1' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Cell at level 1' +++++[table row] selectable level:2 +++++++[table cell] name='Cell at level 2' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Cell at level 2'
diff --git a/content/test/data/accessibility/aria/aria-level.html b/content/test/data/accessibility/aria/aria-level.html index 89bacc20..c2d8e9b 100644 --- a/content/test/data/accessibility/aria/aria-level.html +++ b/content/test/data/accessibility/aria/aria-level.html
@@ -5,6 +5,8 @@ @WIN-ALLOW:level:* @WIN-ALLOW:EXPANDED @WIN-DENY:name='' +@AURALINUX-ALLOW:level:* +@AURALINUX-ALLOW:expand* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-link-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-link-expected-auralinux.txt new file mode 100644 index 0000000..4f67019 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-link-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[link] name='ARIA Link' +++++[text] name='ARIA Link'
diff --git a/content/test/data/accessibility/aria/aria-list-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-list-expected-auralinux.txt new file mode 100644 index 0000000..040163ec --- /dev/null +++ b/content/test/data/accessibility/aria/aria-list-expected-auralinux.txt
@@ -0,0 +1,8 @@ +[document web] +++[list] +++++[list item] name='1' +++++++[text] name='Item 1' +++++[list item] name='2' +++++++[text] name='Item 2' +++++[list item] name='3' +++++++[text] name='Item 3'
diff --git a/content/test/data/accessibility/aria/aria-listbox-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-listbox-expected-auralinux.txt new file mode 100644 index 0000000..9c15471 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-listbox-expected-auralinux.txt
@@ -0,0 +1,7 @@ +[document web] +++[list box] +++++[list item] name='Item 1' selectable +++++[list item] name='Item 2' selectable +++++[separator] horizontal current=0.000000 minimum=0.000000 maximum=0.000000 +++++[list item] name='Second group item 1' selectable +++++[list item] name='Second group item 2' selectable
diff --git a/content/test/data/accessibility/aria/aria-listitem-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-listitem-expected-auralinux.txt new file mode 100644 index 0000000..d43b6549 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-listitem-expected-auralinux.txt
@@ -0,0 +1,6 @@ +[document web] +++[list] +++++[list item] name='1' +++++++[text] name='Item 1' +++++[list item] name='2' +++++++[text] name='Item 2'
diff --git a/content/test/data/accessibility/aria/aria-live-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-live-expected-auralinux.txt new file mode 100644 index 0000000..79631eec --- /dev/null +++ b/content/test/data/accessibility/aria/aria-live-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[marquee] container-atomic:false container-busy:false container-live:off container-relevant:additions text live:off +++[marquee] container-atomic:false container-busy:false container-live:polite container-relevant:additions text live:polite +++[marquee] container-atomic:false container-busy:false container-live:assertive container-relevant:additions text live:assertive +++[alert] container-atomic:true container-busy:false container-live:assertive container-relevant:additions text live:assertive
diff --git a/content/test/data/accessibility/aria/aria-live.html b/content/test/data/accessibility/aria/aria-live.html index a212c2d3..dddb9843 100644 --- a/content/test/data/accessibility/aria/aria-live.html +++ b/content/test/data/accessibility/aria/aria-live.html
@@ -8,6 +8,9 @@ @BLINK-ALLOW:busy* @BLINK-ALLOW:live* @BLINK-ALLOW:container* +@AURALINUX-ALLOW:busy* +@AURALINUX-ALLOW:container* +@AURALINUX-ALLOW:live* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-log-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-log-expected-auralinux.txt new file mode 100644 index 0000000..3a75587a --- /dev/null +++ b/content/test/data/accessibility/aria/aria-log-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[log] xml-roles:log
diff --git a/content/test/data/accessibility/aria/aria-log.html b/content/test/data/accessibility/aria/aria-log.html index e669b03..3f459bf 100644 --- a/content/test/data/accessibility/aria/aria-log.html +++ b/content/test/data/accessibility/aria/aria-log.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXSubrole=* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:xml-roles:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-main-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-main-expected-auralinux.txt new file mode 100644 index 0000000..fa692337 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-main-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[landmark] xml-roles:main
diff --git a/content/test/data/accessibility/aria/aria-main.html b/content/test/data/accessibility/aria/aria-main.html index 883e5af..209a0f6 100644 --- a/content/test/data/accessibility/aria/aria-main.html +++ b/content/test/data/accessibility/aria/aria-main.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:xml-roles:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-marquee-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-marquee-expected-auralinux.txt new file mode 100644 index 0000000..553dd336 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-marquee-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[marquee] container-atomic:false container-busy:false container-live:off container-relevant:additions text live:off xml-roles:marquee +++[marquee] container-atomic:false container-busy:false container-live:polite container-relevant:additions text live:polite xml-roles:marquee +++[marquee] container-atomic:false container-busy:false container-live:assertive container-relevant:additions text live:assertive xml-roles:marquee
diff --git a/content/test/data/accessibility/aria/aria-marquee.html b/content/test/data/accessibility/aria/aria-marquee.html index 96e1a8d9..e1d15850 100644 --- a/content/test/data/accessibility/aria/aria-marquee.html +++ b/content/test/data/accessibility/aria/aria-marquee.html
@@ -8,6 +8,10 @@ @WIN-ALLOW:BUSY* @BLINK-ALLOW:live* @BLINK-ALLOW:container* +@AURALINUX-ALLOW:busy* +@AURALINUX-ALLOW:container* +@AURALINUX-ALLOW:live* +@AURALINUX-ALLOW:xml-roles:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-math-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-math-expected-auralinux.txt new file mode 100644 index 0000000..30fa4be1 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-math-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[math]
diff --git a/content/test/data/accessibility/aria/aria-menu-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-menu-expected-auralinux.txt new file mode 100644 index 0000000..21143d6 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-menu-expected-auralinux.txt
@@ -0,0 +1,10 @@ +[document web] +++[menu bar] horizontal +++++[menu item] name='File' controller-for +++++[menu item] name='Edit' +++++[menu item] name='View' +++[menu] name='File' controlled-by +++++[menu item] name='New' +++++[menu item] name='Open' +++++[menu item] name='Save' +++++[menu item] name='Quit'
diff --git a/content/test/data/accessibility/aria/aria-menubar-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-menubar-expected-auralinux.txt new file mode 100644 index 0000000..11090b9 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-menubar-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[menu bar] horizontal +++++[menu item] name='File' +++++[menu item] name='Edit' +++++[menu item] name='View'
diff --git a/content/test/data/accessibility/aria/aria-menuitem-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-menuitem-expected-auralinux.txt new file mode 100644 index 0000000..273df846 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-menuitem-expected-auralinux.txt
@@ -0,0 +1,8 @@ +[document web] +++[menu] +++++[menu item] name='File' +++++[menu item] name='Edit' +++++[menu item] name='Complex menuitem' +++++++[text] name='Complex ' +++++++[entry] selectable-text +++++++[text] name=' menuitem'
diff --git a/content/test/data/accessibility/aria/aria-menuitemcheckbox-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-menuitemcheckbox-expected-auralinux.txt new file mode 100644 index 0000000..0f5b72f --- /dev/null +++ b/content/test/data/accessibility/aria/aria-menuitemcheckbox-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[menu] +++++[check menu item] name='Menu item 1' checkable:true +++++[check menu item] name='Menu item 2' checked checkable:true +++++[check menu item] name='Menu item 3' indeterminate checkable:true
diff --git a/content/test/data/accessibility/aria/aria-menuitemcheckbox.html b/content/test/data/accessibility/aria/aria-menuitemcheckbox.html index a0bb4322..354c1ca 100644 --- a/content/test/data/accessibility/aria/aria-menuitemcheckbox.html +++ b/content/test/data/accessibility/aria/aria-menuitemcheckbox.html
@@ -6,6 +6,10 @@ @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:MIXED* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:checkable:* +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checked +@AURALINUX-ALLOW:indeterminate --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-menuitemradio-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-menuitemradio-expected-auralinux.txt new file mode 100644 index 0000000..6494fcf --- /dev/null +++ b/content/test/data/accessibility/aria/aria-menuitemradio-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[menu] +++++[radio menu item] name='Menu item 1' checkable:true +++++[radio menu item] name='Menu item 2' checked checkable:true +++++[radio menu item] name='Menu item 3' indeterminate checkable:true
diff --git a/content/test/data/accessibility/aria/aria-menuitemradio.html b/content/test/data/accessibility/aria/aria-menuitemradio.html index 963f52ec..47f1d4f 100644 --- a/content/test/data/accessibility/aria/aria-menuitemradio.html +++ b/content/test/data/accessibility/aria/aria-menuitemradio.html
@@ -6,6 +6,10 @@ @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:MIXED* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:checkable:* +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checked +@AURALINUX-ALLOW:indeterminate --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-modal-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-modal-expected-auralinux.txt new file mode 100644 index 0000000..c33fe0a --- /dev/null +++ b/content/test/data/accessibility/aria/aria-modal-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[dialog] +++++[text] name='Nonmodal' +++[dialog] modal +++++[text] name='Modal'
diff --git a/content/test/data/accessibility/aria/aria-modal.html b/content/test/data/accessibility/aria/aria-modal.html index 47f45da27..8e057813 100644 --- a/content/test/data/accessibility/aria/aria-modal.html +++ b/content/test/data/accessibility/aria/aria-modal.html
@@ -2,6 +2,7 @@ @WIN-ALLOW:xml-roles:* @WIN-ALLOW:IA2_STATE_MODAL @BLINK-ALLOW:modal* +@AURALINUX-ALLOW:modal --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-multiline-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-multiline-expected-auralinux.txt new file mode 100644 index 0000000..65be85b4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-multiline-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[entry] single-line selectable-text +++[entry] multi-line selectable-text
diff --git a/content/test/data/accessibility/aria/aria-multiline.html b/content/test/data/accessibility/aria/aria-multiline.html index 3eb9657..18f5c15 100644 --- a/content/test/data/accessibility/aria/aria-multiline.html +++ b/content/test/data/accessibility/aria/aria-multiline.html
@@ -4,6 +4,8 @@ @WIN-ALLOW:IA2_STATE_MULTI_LINE @WIN-ALLOW:xml-roles* @BLINK-ALLOW:multiline +@AURALINUX-ALLOW:multi-line +@AURALINUX-ALLOW:single-line --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-multiselectable-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-multiselectable-expected-auralinux.txt new file mode 100644 index 0000000..5cc5d71 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-multiselectable-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[list box] multiselectable +++[list box]
diff --git a/content/test/data/accessibility/aria/aria-navigation-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-navigation-expected-auralinux.txt new file mode 100644 index 0000000..d84218d --- /dev/null +++ b/content/test/data/accessibility/aria/aria-navigation-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[landmark] xml-roles:navigation
diff --git a/content/test/data/accessibility/aria/aria-navigation.html b/content/test/data/accessibility/aria/aria-navigation.html index 5033582..e0aeb0b 100644 --- a/content/test/data/accessibility/aria/aria-navigation.html +++ b/content/test/data/accessibility/aria/aria-navigation.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole=* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-none-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-none-expected-auralinux.txt new file mode 100644 index 0000000..42e242c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-none-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[text] name='With aria-role none'
diff --git a/content/test/data/accessibility/aria/aria-note-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-note-expected-auralinux.txt new file mode 100644 index 0000000..a877920 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-note-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[comment] xml-roles:note
diff --git a/content/test/data/accessibility/aria/aria-note.html b/content/test/data/accessibility/aria/aria-note.html index 24e7a349..4051ba6 100644 --- a/content/test/data/accessibility/aria/aria-note.html +++ b/content/test/data/accessibility/aria/aria-note.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @WIN-ALLOW:xml-roles* @WIN-ALLOW:LINKED* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-option-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-option-expected-auralinux.txt new file mode 100644 index 0000000..a0d18d0 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-option-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[list box] xml-roles:listbox +++++[list item] name='option 1' selectable xml-roles:option +++++[list item] name='label 2' selectable xml-roles:option
diff --git a/content/test/data/accessibility/aria/aria-option.html b/content/test/data/accessibility/aria/aria-option.html index 52112b6..c7d5ca7 100644 --- a/content/test/data/accessibility/aria/aria-option.html +++ b/content/test/data/accessibility/aria/aria-option.html
@@ -4,6 +4,8 @@ @WIN-ALLOW:SELECT* @BLINK-ALLOW:focus* @BLINK-ALLOW:select* +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-ALLOW:select* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-orientation-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-orientation-expected-auralinux.txt new file mode 100644 index 0000000..41efb2b --- /dev/null +++ b/content/test/data/accessibility/aria/aria-orientation-expected-auralinux.txt
@@ -0,0 +1,37 @@ +[document web] +++[combo box] +++[combo box] horizontal +++[combo box] vertical +++[list box] vertical +++[list box] horizontal +++[list box] vertical +++[menu] vertical +++[menu] horizontal +++[menu] vertical +++[menu bar] horizontal +++[menu bar] horizontal +++[menu bar] vertical +++[panel] +++[panel] horizontal +++[panel] vertical +++[scroll bar] vertical current=50.000000 minimum=0.000000 maximum=100.000000 +++[scroll bar] horizontal current=50.000000 minimum=0.000000 maximum=100.000000 +++[scroll bar] vertical current=50.000000 minimum=0.000000 maximum=100.000000 +++[slider] horizontal current=50.000000 minimum=0.000000 maximum=100.000000 +++[slider] horizontal current=50.000000 minimum=0.000000 maximum=100.000000 +++[slider] vertical current=50.000000 minimum=0.000000 maximum=100.000000 +++[separator] horizontal current=0.000000 minimum=0.000000 maximum=0.000000 +++[separator] horizontal current=0.000000 minimum=0.000000 maximum=0.000000 +++[separator] vertical current=0.000000 minimum=0.000000 maximum=0.000000 +++[page tab list] horizontal +++[page tab list] horizontal +++[page tab list] vertical +++[tool bar] horizontal +++[tool bar] horizontal +++[tool bar] vertical +++[tree] vertical +++[tree] horizontal +++[tree] vertical +++[tree table] +++[tree table] horizontal +++[tree table] vertical
diff --git a/content/test/data/accessibility/aria/aria-orientation.html b/content/test/data/accessibility/aria/aria-orientation.html index 7e67106..5b3866d 100644 --- a/content/test/data/accessibility/aria/aria-orientation.html +++ b/content/test/data/accessibility/aria/aria-orientation.html
@@ -4,6 +4,8 @@ @WIN-ALLOW:IA2_STATE_HORIZONTAL @BLINK-ALLOW:vertical @BLINK-ALLOW:horizontal +@AURALINUX-ALLOW:vertical +@AURALINUX-ALLOW:horizontal --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-posinset-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-posinset-expected-auralinux.txt new file mode 100644 index 0000000..1ce72973 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-posinset-expected-auralinux.txt
@@ -0,0 +1,36 @@ +[document web] +++[article] posinset:0 setsize:0 +++++[text] name='This is an ARIA article 1.' +++[article] posinset:0 setsize:0 +++++[text] name='This is an ARIA article 2.' +++[list box] setsize:2 +++++[list item] name='Item 1' selectable posinset:1 setsize:2 +++++[list item] name='Item 2' selectable posinset:2 setsize:2 +++[list box] setsize:2 +++++[list item] name='Item 1' selectable posinset:1 setsize:2 +++++[list item] name='Item 2' selectable posinset:2 setsize:2 +++[form] +++++[radio button] checkable:true posinset:3 setsize:4 +++++[text] name='1' +++++[text] name='<newline>' +++++[radio button] checkable:true posinset:4 setsize:4 +++++[text] name='2' +++[radio button] checkable:true posinset:1 setsize:2 +++[text] name='Apple' +++[text] name='<newline>' +++[radio button] checkable:true posinset:2 setsize:2 +++[text] name='Banana' +++[panel] name='Cake' labelled-by setsize:0 +++++[label] label-for +++++++[text] name='Cake' +++++[radio button] name='Chiffon cakes' checked checkable:true posinset:1 setsize:2 +++++[text] name='<newline>' +++++[radio button] name='Chocolate cakes' checkable:true posinset:2 setsize:2 +++[form] +++++[paragraph] +++++++[push button] name='changedFromRadio' +++++++[label] +++++++++[text] name='red' +++++++[text] name='<newline>' +++++++[radio button] name='blue' checkable:true posinset:1 setsize:1 +++[text] name='Done'
diff --git a/content/test/data/accessibility/aria/aria-posinset.html b/content/test/data/accessibility/aria/aria-posinset.html index ffcf2889..3c5cbc0 100644 --- a/content/test/data/accessibility/aria/aria-posinset.html +++ b/content/test/data/accessibility/aria/aria-posinset.html
@@ -5,6 +5,9 @@ @WIN-ALLOW:posinset* @BLINK-ALLOW:setSize* @BLINK-ALLOW:posInSet* +@AURALINUX-ALLOW:setsize* +@AURALINUX-ALLOW:posinset* +@AURALINUX-DENY:checkable @WAIT-FOR:Done --> <html>
diff --git a/content/test/data/accessibility/aria/aria-presentation-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-presentation-expected-auralinux.txt new file mode 100644 index 0000000..34294f83 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-presentation-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[text] name='aria-role presentation'
diff --git a/content/test/data/accessibility/aria/aria-pressed-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-pressed-expected-auralinux.txt new file mode 100644 index 0000000..1a285cdb0 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-pressed-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[push button] name='Regular button' +++[toggle button] name='Toggle button unpressed' checkable:true +++[toggle button] name='Toggle button pressed' pressed checkable:true +++[toggle button] name='Toggle button mixed' indeterminate checkable:true
diff --git a/content/test/data/accessibility/aria/aria-pressed.html b/content/test/data/accessibility/aria/aria-pressed.html index eaefc58..422e83ab 100644 --- a/content/test/data/accessibility/aria/aria-pressed.html +++ b/content/test/data/accessibility/aria/aria-pressed.html
@@ -5,6 +5,11 @@ @WIN-ALLOW:checkable:true @MAC-ALLOW:AXSubrole=* @MAC-ALLOW:AXRoleDescription=* +@AURALINUX-ALLOW:pressed +@AURALINUX-ALLOW:indeterminate +@AURALINUX-ALLOW:checked +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checkable:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-progressbar-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-progressbar-expected-auralinux.txt new file mode 100644 index 0000000..84de0a9a --- /dev/null +++ b/content/test/data/accessibility/aria/aria-progressbar-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[progress bar] current=3.000000 minimum=1.000000 maximum=37.000000 +++[progress bar] current=3.000000 minimum=1.000000 maximum=96.000000 +++[progress bar] current=0.000000 minimum=0.000000 maximum=10.000000
diff --git a/content/test/data/accessibility/aria/aria-radio-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-radio-expected-auralinux.txt new file mode 100644 index 0000000..23832cbd --- /dev/null +++ b/content/test/data/accessibility/aria/aria-radio-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[radio button] name='Radio1' checkable:true
diff --git a/content/test/data/accessibility/aria/aria-radio.html b/content/test/data/accessibility/aria/aria-radio.html index 043ef75..fee8817 100644 --- a/content/test/data/accessibility/aria/aria-radio.html +++ b/content/test/data/accessibility/aria/aria-radio.html
@@ -3,6 +3,9 @@ @WIN-ALLOW:checkable* @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:checkable:* +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checked --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-radiogroup-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-radiogroup-expected-auralinux.txt new file mode 100644 index 0000000..8dbc0f3 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-radiogroup-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[panel] name='My group' xml-roles:radiogroup +++++[radio button] name='Radio 1' checkable:true xml-roles:radio +++++[radio button] name='Radio 2' checkable:true xml-roles:radio
diff --git a/content/test/data/accessibility/aria/aria-radiogroup.html b/content/test/data/accessibility/aria/aria-radiogroup.html index e38430e..aa992b9 100644 --- a/content/test/data/accessibility/aria/aria-radiogroup.html +++ b/content/test/data/accessibility/aria/aria-radiogroup.html
@@ -5,6 +5,10 @@ @MAC-ALLOW:AXRole* @WIN-ALLOW:xml-roles:* @WIN-ALLOW:checkable* +@AURALINUX-ALLOW:checkable:* +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checked +@AURALINUX-ALLOW:xml-roles:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-readonly-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-readonly-expected-auralinux.txt new file mode 100644 index 0000000..b5c7c1e --- /dev/null +++ b/content/test/data/accessibility/aria/aria-readonly-expected-auralinux.txt
@@ -0,0 +1,23 @@ +[document web] enabled sensitive +++[section] enabled sensitive +++++[entry] editable enabled sensitive selectable-text +++[section] enabled sensitive +++++[entry] selectable-text +++[section] name='Readonly-false plain div' enabled sensitive +++[section] name='Readonly-true plain div' enabled sensitive +++[section] name='Readonly-false contenteditable div' editable enabled sensitive selectable-text +++[section] name='Readonly-true contenteditable div' editable enabled sensitive selectable-text +++[entry] name='Readonly-false role unimplemented textbox' enabled sensitive selectable-text +++[entry] name='Readonly-true role unimplemented textbox' selectable-text +++[entry] name='Readonly-false contenteditable textbox' enabled sensitive selectable-text +++[entry] name='Readonly-true contenteditable textbox' selectable-text +++[check box] name='Readonly checkbox' checkable:true +++[combo box] name='Readonly combobox' selectable-text +++[list box] name='Readonly listbox' +++[panel] name='Readonly radiogroup' +++[slider] name='Readonly slider' horizontal current=50.000000 minimum=0.000000 maximum=100.000000 +++[spin button] name='Readonly spinbutton' current=0.000000 minimum=0.000000 maximum=0.000000 +++[check menu item] name='Readonly menuitemcheckbox' checkable:true +++[radio menu item] name='Readonly menuitemradio' checkable:true +++[entry] name='Readonly searchbox' selectable-text +++[toggle button] name='Readonly switch' checkable:true
diff --git a/content/test/data/accessibility/aria/aria-readonly.html b/content/test/data/accessibility/aria/aria-readonly.html index defe376..0f21c53 100644 --- a/content/test/data/accessibility/aria/aria-readonly.html +++ b/content/test/data/accessibility/aria/aria-readonly.html
@@ -11,6 +11,12 @@ @BLINK-ALLOW:restriction* @BLINK-DENY:checkedState* @BLINK-DENY:*ForRange* +@AURALINUX-ALLOW:editable +@AURALINUX-ALLOW:enabled +@AURALINUX-ALLOW:sensitive +@AURALINUX-ALLOW:checked +@AURALINUX-ALLOW:checkable: +@AURALINUX-DENY:checkable --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-region-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-region-expected-auralinux.txt new file mode 100644 index 0000000..e755ca9e --- /dev/null +++ b/content/test/data/accessibility/aria/aria-region-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[landmark] xml-roles:region +++++[text] name='This is an ARIA region.'
diff --git a/content/test/data/accessibility/aria/aria-region.html b/content/test/data/accessibility/aria/aria-region.html index b374203..d285fb0 100644 --- a/content/test/data/accessibility/aria/aria-region.html +++ b/content/test/data/accessibility/aria/aria-region.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:xml-roles:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-relevant-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-relevant-expected-auralinux.txt new file mode 100644 index 0000000..a47561f --- /dev/null +++ b/content/test/data/accessibility/aria/aria-relevant-expected-auralinux.txt
@@ -0,0 +1,6 @@ +[document web] +++[log] container-relevant:additions relevant:additions +++[log] container-relevant:removals relevant:removals +++[log] container-relevant:text relevant:text +++[log] container-relevant:all relevant:all +++[log] container-relevant:additions text relevant:additions text
diff --git a/content/test/data/accessibility/aria/aria-relevant.html b/content/test/data/accessibility/aria/aria-relevant.html index 811212c..80a1969d 100644 --- a/content/test/data/accessibility/aria/aria-relevant.html +++ b/content/test/data/accessibility/aria/aria-relevant.html
@@ -5,6 +5,9 @@ @WIN-ALLOW:container-relevant:* @BLINK-ALLOW:liveRelevant* @BLINK-ALLOW:containerLiveRelevant* +@AURALINUX-ALLOW:relevant:* +@AURALINUX-ALLOW:container-relevant:* + --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-required-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-required-expected-auralinux.txt new file mode 100644 index 0000000..5a97ff4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-required-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[panel] required xml-roles:radiogroup +++++[radio button] checkable:true xml-roles:radio +++++[radio button] checkable:true xml-roles:radio
diff --git a/content/test/data/accessibility/aria/aria-required.html b/content/test/data/accessibility/aria/aria-required.html index 9f336df..6f453ec 100644 --- a/content/test/data/accessibility/aria/aria-required.html +++ b/content/test/data/accessibility/aria/aria-required.html
@@ -1,6 +1,9 @@ <!-- @MAC-ALLOW:AXRequired* @WIN-ALLOW:IA2_STATE_REQUIRED +@AURALINUX-ALLOW:required +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-DENY:checkable --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-roledescription-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-roledescription-expected-auralinux.txt new file mode 100644 index 0000000..6d4c029 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-roledescription-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[push button] name='Native button' +++[push button] name='ARIA button' +++[push button] name='Clicky button' roledescription:Clicky
diff --git a/content/test/data/accessibility/aria/aria-roledescription.html b/content/test/data/accessibility/aria/aria-roledescription.html index dfac33ef..a3137474 100644 --- a/content/test/data/accessibility/aria/aria-roledescription.html +++ b/content/test/data/accessibility/aria/aria-roledescription.html
@@ -2,6 +2,7 @@ <!-- @MAC-ALLOW:AXRoleDescription* @WIN-ALLOW:localized_extended_role* +@AURALINUX-ALLOW:roledescription* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-row-attr-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-row-attr-expected-auralinux.txt new file mode 100644 index 0000000..6ad5b7b --- /dev/null +++ b/content/test/data/accessibility/aria/aria-row-attr-expected-auralinux.txt
@@ -0,0 +1,14 @@ +[document web] +++[table] rowcount:5 cols=3 headers=('cell 2', 'cell 3', 'cell 4'); rows=2 headers=(NONE); caption=false; spans=(cell at 1,2: 0x0) +++++[table row] selectable +++++++[column header] name='cell 2' selectable rowindex:3 (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell 2' +++++++[column header] name='cell 3' selectable rowindex:3 (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell 3' +++++++[column header] name='cell 4' selectable rowindex:3 rowspan:2 (row=0, col=2, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell 4' +++++[table row] selectable rowindex:4 +++++++[table cell] name='cell 2' selectable rowindex:4 (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='cell 2' +++++++[table cell] name='cell 3' selectable rowindex:4 (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='cell 3'
diff --git a/content/test/data/accessibility/aria/aria-row-attr.html b/content/test/data/accessibility/aria/aria-row-attr.html index a906d6b..a08d419 100644 --- a/content/test/data/accessibility/aria/aria-row-attr.html +++ b/content/test/data/accessibility/aria/aria-row-attr.html
@@ -5,6 +5,9 @@ @MAC-ALLOW:AXARIARow* @BLINK-ALLOW:ariaRow* @BLINK-ALLOW:ariaCellRow* +@AURALINUX-ALLOW:rowcount* +@AURALINUX-ALLOW:rowindex* +@AURALINUX-ALLOW:rowspan* --> <!-- For compatibility with earlier versions of Jaws, We do not expose aria-row/colcount and aria-row/colindex information if they match the
diff --git a/content/test/data/accessibility/aria/aria-row-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-row-expected-auralinux.txt new file mode 100644 index 0000000..2724dbc --- /dev/null +++ b/content/test/data/accessibility/aria/aria-row-expected-auralinux.txt
@@ -0,0 +1,17 @@ +[document web] +++[table] cols=2 headers=('Browser', 'Rendering Engine'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Browser' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Browser' +++++++[column header] name='Rendering Engine' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Rendering Engine' +++++[table row] selectable +++++++[table cell] name='Chrome' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Chrome' +++++++[table cell] name='Blink' selectable (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Blink' +++++[table row] selectable +++++++[table cell] name='Safari' selectable (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Safari' +++++++[table cell] name='WebKit' selectable (row=2, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='WebKit'
diff --git a/content/test/data/accessibility/aria/aria-rowgroup-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-rowgroup-expected-auralinux.txt new file mode 100644 index 0000000..8a71d75c68 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-rowgroup-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[table] cols=0 headers=(NONE); rows=0 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++[table row] selectable
diff --git a/content/test/data/accessibility/aria/aria-rowheader-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-rowheader-expected-auralinux.txt new file mode 100644 index 0000000..209ead19 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-rowheader-expected-auralinux.txt
@@ -0,0 +1,16 @@ +[document web] +++[table] xml-roles:grid cols=3 headers=(NONE); rows=2 headers=('Browser', 'Rendering Engine'); caption=false; spans=(all: 1x1) +++++[table row] selectable xml-roles:row +++++++[row header] name='Browser' selectable xml-roles:rowheader (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Browser' +++++++[table cell] name='Chrome' selectable xml-roles:gridcell (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='Chrome' +++++++[table cell] name='Safari' selectable xml-roles:gridcell (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='Safari' +++++[table row] selectable xml-roles:row +++++++[row header] name='Rendering Engine' selectable xml-roles:rowheader (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Rendering Engine' +++++++[table cell] name='Blink' selectable xml-roles:gridcell (row=1, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='Blink' +++++++[table cell] name='WebKit' selectable xml-roles:gridcell (row=1, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='WebKit'
diff --git a/content/test/data/accessibility/aria/aria-rowheader.html b/content/test/data/accessibility/aria/aria-rowheader.html index 15f8b9a..e7bd86b7 100644 --- a/content/test/data/accessibility/aria/aria-rowheader.html +++ b/content/test/data/accessibility/aria/aria-rowheader.html
@@ -9,6 +9,7 @@ @WIN-ALLOW:xml-roles* @WIN-ALLOW:MULTISELECTABLE @WIN-ALLOW:EXTSELECTABLE +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-rowtext-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-rowtext-expected-auralinux.txt new file mode 100644 index 0000000..4bfd3c2 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-rowtext-expected-auralinux.txt
@@ -0,0 +1,12 @@ +[document web] +++[table] cols=2 headers=(NONE); rows=2 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[table cell] name='cell A3' selectable colindex:1 coltext:A rowindex:3 rowtext:3 (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell A3' +++++++[table cell] name='cell B3' selectable colindex:2 coltext:B rowindex:3 rowtext:3 (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell B3' +++++[table row] selectable +++++++[table cell] name='cell A4' selectable colindex:1 coltext:A rowindex:4 rowtext:4 (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell A4' +++++++[table cell] name='cell B4' selectable colindex:2 coltext:B rowindex:4 rowtext:4 (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='cell B4'
diff --git a/content/test/data/accessibility/aria/aria-rowtext.html b/content/test/data/accessibility/aria/aria-rowtext.html index 1e30257..c74a1126 100644 --- a/content/test/data/accessibility/aria/aria-rowtext.html +++ b/content/test/data/accessibility/aria/aria-rowtext.html
@@ -3,6 +3,10 @@ @WIN-ALLOW:rowtext* @WIN-ALLOW:colindex* @WIN-ALLOW:coltext* +@AURALINUX-ALLOW:rowindex* +@AURALINUX-ALLOW:rowtext* +@AURALINUX-ALLOW:colindex* +@AURALINUX-ALLOW:coltext* --> <div role="grid"> <div role="row">
diff --git a/content/test/data/accessibility/aria/aria-scrollbar-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-scrollbar-expected-auralinux.txt new file mode 100644 index 0000000..fba6199 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-scrollbar-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[scroll bar] vertical current=55.000000 minimum=0.000000 maximum=100.000000 +++[scroll bar] horizontal current=55.000000 minimum=0.000000 maximum=100.000000
diff --git a/content/test/data/accessibility/aria/aria-scrollbar.html b/content/test/data/accessibility/aria/aria-scrollbar.html index c4edbbb..9e83815 100644 --- a/content/test/data/accessibility/aria/aria-scrollbar.html +++ b/content/test/data/accessibility/aria/aria-scrollbar.html
@@ -6,6 +6,8 @@ @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:IA2_STATE* @WIN-ALLOW:xml-roles:* +@AURALINUX-ALLOW:horizontal +@AURALINUX-ALLOW:vertical --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-search-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-search-expected-auralinux.txt new file mode 100644 index 0000000..411619e --- /dev/null +++ b/content/test/data/accessibility/aria/aria-search-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[landmark] xml-roles:search +++++[text] name='ARIA role search.'
diff --git a/content/test/data/accessibility/aria/aria-search.html b/content/test/data/accessibility/aria/aria-search.html index 7c8db501..ff1fbf8 100644 --- a/content/test/data/accessibility/aria/aria-search.html +++ b/content/test/data/accessibility/aria/aria-search.html
@@ -2,6 +2,7 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-searchbox-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-searchbox-expected-auralinux.txt new file mode 100644 index 0000000..d0385ab4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-searchbox-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[entry] selectable-text xml-roles:searchbox
diff --git a/content/test/data/accessibility/aria/aria-searchbox.html b/content/test/data/accessibility/aria/aria-searchbox.html index 2be4998..525d61dd 100644 --- a/content/test/data/accessibility/aria/aria-searchbox.html +++ b/content/test/data/accessibility/aria/aria-searchbox.html
@@ -8,6 +8,7 @@ @WIN-ALLOW:selection_start* @WIN-ALLOW:selection_end* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-selected-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-selected-expected-auralinux.txt new file mode 100644 index 0000000..53debce2 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-selected-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[list box] +++++[list item] name='1' selectable selected +++++[list item] name='2' selectable
diff --git a/content/test/data/accessibility/aria/aria-selected.html b/content/test/data/accessibility/aria/aria-selected.html index 23d6505..291f352 100644 --- a/content/test/data/accessibility/aria/aria-selected.html +++ b/content/test/data/accessibility/aria/aria-selected.html
@@ -3,6 +3,7 @@ @MAC-ALLOW:AXSubrole* @MAC-ALLOW:AXSelected* @WIN-ALLOW:SELECTED +@AURALINUX-ALLOW:select* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-separator-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-separator-expected-auralinux.txt new file mode 100644 index 0000000..a12ed3a --- /dev/null +++ b/content/test/data/accessibility/aria/aria-separator-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[text] name='Before' +++[separator] horizontal current=0.000000 minimum=0.000000 maximum=0.000000 +++[separator] horizontal current=1.000000 minimum=1.000000 maximum=3.000000 +++[text] name='After'
diff --git a/content/test/data/accessibility/aria/aria-setsize-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-setsize-expected-auralinux.txt new file mode 100644 index 0000000..c15a315 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-setsize-expected-auralinux.txt
@@ -0,0 +1,12 @@ +[document web] +++[list box] setsize:4 +++++[list item] name='Item 1' selectable posinset:1 setsize:4 +++++[list item] name='Item 2' selectable posinset:2 setsize:4 +++++[list item] name='Item 3' selectable posinset:3 setsize:4 +++++[list item] name='Item 4' selectable posinset:4 setsize:4 +++[list box] setsize:5 +++++[list item] name='Item 1' selectable posinset:1 setsize:5 +++++[list item] name='Item 2' selectable posinset:2 setsize:5 +++++[list item] name='Item 3' selectable posinset:3 setsize:5 +++++[list item] name='Item 4' selectable posinset:4 setsize:5 +++++[list item] name='Item 5' selectable posinset:5 setsize:5
diff --git a/content/test/data/accessibility/aria/aria-setsize.html b/content/test/data/accessibility/aria/aria-setsize.html index 6e5e7a3b..f0d6dbc0 100644 --- a/content/test/data/accessibility/aria/aria-setsize.html +++ b/content/test/data/accessibility/aria/aria-setsize.html
@@ -5,6 +5,8 @@ @WIN-ALLOW:posinset* @BLINK-ALLOW:setSize* @BLINK-ALLOW:posInSet* +@AURALINUX-ALLOW:setsize* +@AURALINUX-ALLOW:posinset* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-slider-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-slider-expected-auralinux.txt new file mode 100644 index 0000000..3a1a586f --- /dev/null +++ b/content/test/data/accessibility/aria/aria-slider-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[slider] horizontal current=5.000000 minimum=1.000000 maximum=10.000000
diff --git a/content/test/data/accessibility/aria/aria-sort-aria-grid-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-sort-aria-grid-expected-auralinux.txt new file mode 100644 index 0000000..95cb00d --- /dev/null +++ b/content/test/data/accessibility/aria/aria-sort-aria-grid-expected-auralinux.txt
@@ -0,0 +1,91 @@ +[document web] +++[table] cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Alphabet' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] selectable +++++++[table cell] name='A' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] selectable +++++++[table cell] name='B' selectable (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++[table] cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Alphabet' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] selectable +++++++[table cell] name='A' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] selectable +++++++[table cell] name='B' selectable (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++[table] cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Alphabet' selectable sort:ascending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] selectable +++++++[table cell] name='A' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] selectable +++++++[table cell] name='B' selectable (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++[table] cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Alphabet' selectable sort:descending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] selectable +++++++[table cell] name='B' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++++[table row] selectable +++++++[table cell] name='A' selectable (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++[table] cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Alphabet' selectable sort:other (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] selectable +++++++[table cell] name='A' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] selectable +++++++[table cell] name='A' selectable (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++[table] cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[row header] name='Alphabet' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='B' selectable (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++[table] cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[row header] name='Alphabet' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='B' selectable (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++[table] cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[row header] name='Alphabet' selectable sort:ascending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='B' selectable (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++[table] cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[row header] name='Alphabet' selectable sort:descending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='B' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++++++[table cell] name='A' selectable (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++[table] cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[row header] name='Alphabet' selectable sort:other (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='A' selectable (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A'
diff --git a/content/test/data/accessibility/aria/aria-sort-aria-grid.html b/content/test/data/accessibility/aria/aria-sort-aria-grid.html index 31285db..f7419d6 100644 --- a/content/test/data/accessibility/aria/aria-sort-aria-grid.html +++ b/content/test/data/accessibility/aria/aria-sort-aria-grid.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXSortDirection* @WIN-ALLOW:sort:* +@AURALINUX-ALLOW:sort:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-sort-html-table-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-sort-html-table-expected-auralinux.txt new file mode 100644 index 0000000..9d0cdfc6 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-sort-html-table-expected-auralinux.txt
@@ -0,0 +1,103 @@ +[document web] +++[table] name='Data table' cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] +++++++[column header] name='Alphabet' (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] +++++++[table cell] name='A' (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] +++++++[table cell] name='B' (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++[table] name='Data table' cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] +++++++[column header] name='Alphabet' (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] +++++++[table cell] name='A' (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] +++++++[table cell] name='B' (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++[table] name='Data table' cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] +++++++[column header] name='Alphabet' sort:ascending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] +++++++[table cell] name='A' (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] +++++++[table cell] name='B' (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++[table] name='Data table' cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] +++++++[column header] name='Alphabet' sort:descending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] +++++++[table cell] name='B' (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++++[table row] +++++++[table cell] name='A' (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++[table] name='Data table' cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] +++++++[column header] name='Alphabet' sort:other (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] +++++++[table cell] name='A' (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] +++++++[table cell] name='A' (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++[table] name='Data table' cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] +++++++[row header] name='Alphabet' (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='B' (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++[table] name='Data table' cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] +++++++[row header] name='Alphabet' (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='B' (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++[table] name='Data table' cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] +++++++[row header] name='Alphabet' sort:ascending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='B' (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++[table] name='Data table' cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] +++++++[row header] name='Alphabet' sort:descending (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='B' (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='B' +++++++[table cell] name='A' (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++[table] name='Data table' cols=3 headers=(NONE); rows=1 headers=('Alphabet'); caption=false; spans=(all: 1x1) +++++[table row] +++++++[row header] name='Alphabet' sort:other (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++++[table cell] name='A' (row=0, col=1, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++++++[table cell] name='A' (row=0, col=2, row_span=1, col_span=1 n_row_headers=1, n_col_headers=0) +++++++++[text] name='A' +++[table] name='Data table' cols=1 headers=('Alphabet'); rows=3 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] +++++++[column header] name='Alphabet' (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Alphabet' +++++[table row] +++++++[table cell] name='A' (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='A' +++++[table row] +++++++[table cell] name='B' (row=2, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='B' +++[section] +++++[text] name='Alphabet'
diff --git a/content/test/data/accessibility/aria/aria-sort-html-table.html b/content/test/data/accessibility/aria/aria-sort-html-table.html index 16c3b1b..15d1b7a8 100644 --- a/content/test/data/accessibility/aria/aria-sort-html-table.html +++ b/content/test/data/accessibility/aria/aria-sort-html-table.html
@@ -1,6 +1,7 @@ <!-- @MAC-ALLOW:AXSortDirection* @WIN-ALLOW:sort:* +@AURALINUX-ALLOW:sort:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-spinbutton-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-spinbutton-expected-auralinux.txt new file mode 100644 index 0000000..6ae0707 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-spinbutton-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[spin button] current=5.000000 minimum=0.000000 maximum=0.000000 +++++[text] name='Inner text' +++[spin button] current=5.000000 minimum=1.000000 maximum=10.000000 +++++[text] name='Inner text'
diff --git a/content/test/data/accessibility/aria/aria-status-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-status-expected-auralinux.txt new file mode 100644 index 0000000..c53097c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-status-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[statusbar] atomic:true container-atomic:true container-live:polite container-relevant:additions text live:polite relevant:additions text xml-roles:status +++[statusbar] atomic:false container-atomic:false container-live:polite container-relevant:additions text live:polite relevant:additions text xml-roles:status
diff --git a/content/test/data/accessibility/aria/aria-status.html b/content/test/data/accessibility/aria/aria-status.html index efce91e..1babfe7e 100644 --- a/content/test/data/accessibility/aria/aria-status.html +++ b/content/test/data/accessibility/aria/aria-status.html
@@ -7,6 +7,11 @@ @WIN-ALLOW:*live* @WIN-ALLOW:*relevant* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:atomic:* +@AURALINUX-ALLOW:container-atomic:* +@AURALINUX-ALLOW:*live* +@AURALINUX-ALLOW:*relevant* +@AURALINUX-ALLOW:xml-roles* @BLINK-ALLOW:busy* @BLINK-ALLOW:live* @BLINK-ALLOW:container*
diff --git a/content/test/data/accessibility/aria/aria-switch-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-switch-expected-auralinux.txt new file mode 100644 index 0000000..29a5b67 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-switch-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[toggle button] name='Switch1' checkable:true xml-roles:switch +++[toggle button] name='Switch2' checkable:true xml-roles:switch +++[toggle button] name='Switch3' checked checkable:true xml-roles:switch +++[toggle button] name='Switch4' checked checkable:true xml-roles:switch
diff --git a/content/test/data/accessibility/aria/aria-switch.html b/content/test/data/accessibility/aria/aria-switch.html index 879b800..e441c07 100644 --- a/content/test/data/accessibility/aria/aria-switch.html +++ b/content/test/data/accessibility/aria/aria-switch.html
@@ -5,6 +5,12 @@ @WIN-ALLOW:CHECKED* @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:checked +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checkable:* +@AURALINUX-ALLOW:indeterminate +@AURALINUX-ALLOW:pressed +@AURALINUX-ALLOW:xml-roles:* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-tab-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-tab-expected-auralinux.txt new file mode 100644 index 0000000..0e6477b --- /dev/null +++ b/content/test/data/accessibility/aria/aria-tab-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[page tab list] horizontal setsize:2 xml-roles:tablist +++++[page tab] name='Tab 1' selectable posinset:1 setsize:2 xml-roles:tab +++++[page tab] name='Tab 2' selectable posinset:2 setsize:2 xml-roles:tab
diff --git a/content/test/data/accessibility/aria/aria-tab.html b/content/test/data/accessibility/aria/aria-tab.html index 90d66fb..450555d 100644 --- a/content/test/data/accessibility/aria/aria-tab.html +++ b/content/test/data/accessibility/aria/aria-tab.html
@@ -2,6 +2,11 @@ @MAC-ALLOW:AXRole* @WIN-ALLOW:xml-roles* @WIN-ALLOW:IA2_STATE_HORIZONTAL +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-ALLOW:horizontal +@AURALINUX-ALLOW:vertical +@AURALINUX-ALLOW:posinset* +@AURALINUX-ALLOW:setsize* @BLINK-ALLOW:horizontal @BLINK-ALLOW:setSize* @BLINK-ALLOW:posInSet*
diff --git a/content/test/data/accessibility/aria/aria-table-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-table-expected-auralinux.txt new file mode 100644 index 0000000..88b140d4 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-table-expected-auralinux.txt
@@ -0,0 +1,12 @@ +[document web] +++[table] cols=2 headers=('Browser', 'Rendering Engine'); rows=2 headers=(NONE); caption=false; spans=(all: 1x1) +++++[table row] selectable +++++++[column header] name='Browser' selectable (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Browser' +++++++[column header] name='Rendering Engine' selectable (row=0, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Rendering Engine' +++++[table row] selectable +++++++[table cell] name='Chrome' selectable (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Chrome' +++++++[table cell] name='Blink' selectable (row=1, col=1, row_span=1, col_span=1 n_row_headers=0, n_col_headers=1) +++++++++[text] name='Blink'
diff --git a/content/test/data/accessibility/aria/aria-tablist-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-tablist-expected-auralinux.txt new file mode 100644 index 0000000..3fb9a6c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-tablist-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[page tab list] horizontal setsize:2 +++++[page tab] name='Tab 1' selectable posinset:1 setsize:2 +++++[page tab] name='Tab 2' selectable posinset:2 setsize:2
diff --git a/content/test/data/accessibility/aria/aria-tablist.html b/content/test/data/accessibility/aria/aria-tablist.html index e049c34..abaf98c5 100644 --- a/content/test/data/accessibility/aria/aria-tablist.html +++ b/content/test/data/accessibility/aria/aria-tablist.html
@@ -3,6 +3,10 @@ @WIN-ALLOW:xml-roles* @WIN-ALLOW:IA2_STATE_HORIZONTAL @BLINK-ALLOW:horizontal +@AURALINUX-ALLOW:horizontal +@AURALINUX-ALLOW:vertical +@AURALINUX-ALLOW:posinset* +@AURALINUX-ALLOW:setsize* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-tabpanel-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-tabpanel-expected-auralinux.txt new file mode 100644 index 0000000..c40105a3 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-tabpanel-expected-auralinux.txt
@@ -0,0 +1,8 @@ +[document web] +++[scroll pane] +++++[page tab] name='Item' selectable +++++++[heading] name='Item' +++++++++[text] name='Item' +++++[page tab] name='Prices' selectable +++++++[heading] name='Prices' +++++++++[text] name='Prices'
diff --git a/content/test/data/accessibility/aria/aria-tabpanel.html b/content/test/data/accessibility/aria/aria-tabpanel.html index e1dfa941..511f10c 100644 --- a/content/test/data/accessibility/aria/aria-tabpanel.html +++ b/content/test/data/accessibility/aria/aria-tabpanel.html
@@ -2,6 +2,8 @@ @MAC-ALLOW:AXRole* @MAC-ALLOW:AXSubrole* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:horizontal +@AURALINUX-ALLOW:vertical --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-term-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-term-expected-auralinux.txt new file mode 100644 index 0000000..f4ef87c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-term-expected-auralinux.txt
@@ -0,0 +1,10 @@ +[document web] +++[list] xml-roles:list +++++[description term] xml-roles:term +++++++[text] name='Term1' +++++[description value] xml-roles:definition +++++++[text] name='Definition1' +++++[description term] xml-roles:term +++++++[text] name='Term2' +++++[description value] xml-roles:definition +++++++[text] name='Definition2'
diff --git a/content/test/data/accessibility/aria/aria-term.html b/content/test/data/accessibility/aria/aria-term.html index 6f67b61..4d0c9da 100644 --- a/content/test/data/accessibility/aria/aria-term.html +++ b/content/test/data/accessibility/aria/aria-term.html
@@ -3,6 +3,7 @@ @MAC-ALLOW:AXSubrole=AXTerm @MAC-DENY:AXTitle* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-textbox-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-textbox-expected-auralinux.txt new file mode 100644 index 0000000..c53a813 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-textbox-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[entry] single-line selectable-text xml-roles:textbox +++[entry] multi-line selectable-text xml-roles:textbox
diff --git a/content/test/data/accessibility/aria/aria-textbox-with-rich-text-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-textbox-with-rich-text-expected-auralinux.txt new file mode 100644 index 0000000..9e9f3cd --- /dev/null +++ b/content/test/data/accessibility/aria/aria-textbox-with-rich-text-expected-auralinux.txt
@@ -0,0 +1,9 @@ +[document web] +++[entry] editable single-line selectable-text xml-roles:textbox +++++[heading] name='TextBox1' editable xml-roles:heading +++++++[text] name='TextBox1' editable +++[entry] editable multi-line selectable-text xml-roles:textbox +++++[heading] name='TextBox2' editable xml-roles:heading +++++++[text] name='TextBox2' editable +++++[paragraph] editable +++++++[text] name='Some text.' editable
diff --git a/content/test/data/accessibility/aria/aria-textbox-with-rich-text.html b/content/test/data/accessibility/aria/aria-textbox-with-rich-text.html index 35e6ace..23f6b77 100644 --- a/content/test/data/accessibility/aria/aria-textbox-with-rich-text.html +++ b/content/test/data/accessibility/aria/aria-textbox-with-rich-text.html
@@ -9,6 +9,10 @@ @WIN-ALLOW:selection_end* @WIN-ALLOW:xml-roles* @WIN-ALLOW:n_characters=* +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-ALLOW:editable +@AURALINUX-ALLOW:single-line +@AURALINUX-ALLOW:multi-line --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-textbox.html b/content/test/data/accessibility/aria/aria-textbox.html index dcf3064..9011c68 100644 --- a/content/test/data/accessibility/aria/aria-textbox.html +++ b/content/test/data/accessibility/aria/aria-textbox.html
@@ -8,6 +8,10 @@ @WIN-ALLOW:selection_start* @WIN-ALLOW:selection_end* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:xml-roles* +@AURALINUX-ALLOW:editable +@AURALINUX-ALLOW:single-line +@AURALINUX-ALLOW:multi-line --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-timer-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-timer-expected-auralinux.txt new file mode 100644 index 0000000..5adecf3 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-timer-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[timer] atomic:false container-atomic:false live:polite +++++[text] name='This test is for aria-role = timer' atomic:false container-atomic:false
diff --git a/content/test/data/accessibility/aria/aria-timer.html b/content/test/data/accessibility/aria/aria-timer.html index 69d7b800..891b45a 100644 --- a/content/test/data/accessibility/aria/aria-timer.html +++ b/content/test/data/accessibility/aria/aria-timer.html
@@ -1,5 +1,8 @@ <!-- @MAC-ALLOW:AXRoleDescription='timer' +@AURALINUX-ALLOW:atomic:* +@AURALINUX-ALLOW:container-atomic:* +@AURALINUX-ALLOW:live:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-togglebutton-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-togglebutton-expected-auralinux.txt new file mode 100644 index 0000000..4228386 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-togglebutton-expected-auralinux.txt
@@ -0,0 +1,5 @@ +[document web] +++[push button] name='Regular button' xml-roles:button +++[toggle button] name='Toggle button' checkable:true xml-roles:button +++[toggle button] name='Toggle button' pressed checkable:true xml-roles:button +++[toggle button] name='Toggle button' indeterminate checkable:true xml-roles:button
diff --git a/content/test/data/accessibility/aria/aria-togglebutton.html b/content/test/data/accessibility/aria/aria-togglebutton.html index 9fd0d63..84e77a75 100644 --- a/content/test/data/accessibility/aria/aria-togglebutton.html +++ b/content/test/data/accessibility/aria/aria-togglebutton.html
@@ -3,6 +3,12 @@ @WIN-ALLOW:STATE_SYSTEM_* @MAC-ALLOW:AXSubrole=* @MAC-ALLOW:AXRoleDescription=* +@AURALINUX-ALLOW:checked +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checkable:* +@AURALINUX-ALLOW:indeterminate +@AURALINUX-ALLOW:pressed +@AURALINUX-ALLOW:xml-roles:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria-toolbar-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-toolbar-expected-auralinux.txt new file mode 100644 index 0000000..45194e9 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-toolbar-expected-auralinux.txt
@@ -0,0 +1,3 @@ +[document web] +++[tool bar] horizontal +++++[text] name='A toolbar'
diff --git a/content/test/data/accessibility/aria/aria-tooltip-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-tooltip-expected-auralinux.txt new file mode 100644 index 0000000..c97d2f0 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-tooltip-expected-auralinux.txt
@@ -0,0 +1,4 @@ +[document web] +++[entry] description='Your username should be your email id' selectable-text described-by +++[tool tip] name='Your username should be your email id' description-for +++++[text] name='Your username should be your email id'
diff --git a/content/test/data/accessibility/aria/aria-tree-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-tree-expected-auralinux.txt new file mode 100644 index 0000000..c907bc1 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-tree-expected-auralinux.txt
@@ -0,0 +1,22 @@ +[document web] +++[tree] setsize:2 +++++[tree item] name='Animals' selectable indeterminate checkable:true level:1 posinset:1 setsize:2 +++++++[link] name='Animals' +++++++++[text] name='Animals' +++++++[panel] setsize:2 +++++++++[tree item] name='Domesticated' selectable level:2 posinset:1 setsize:2 +++++++++++[link] name='Domesticated' +++++++++++++[text] name='Domesticated' +++++++++++[panel] setsize:2 +++++++++++++[tree item] name='Dog' checked selectable checkable:true level:3 posinset:1 setsize:2 +++++++++++++++[link] name='Dog' +++++++++++++++++[text] name='Dog' +++++++++++++[tree item] name='Cat' selectable checkable:true level:3 posinset:2 setsize:2 +++++++++++++++[link] name='Cat' +++++++++++++++++[text] name='Cat' +++++++++[tree item] name='Wild' selectable level:2 posinset:2 setsize:2 +++++++++++[link] name='Wild' +++++++++++++[text] name='Wild' +++++[tree item] name='Plants' selectable level:1 posinset:2 setsize:2 +++++++[link] name='Plants' +++++++++[text] name='Plants'
diff --git a/content/test/data/accessibility/aria/aria-tree.html b/content/test/data/accessibility/aria/aria-tree.html index be881cbe..a40e9aa7 100644 --- a/content/test/data/accessibility/aria/aria-tree.html +++ b/content/test/data/accessibility/aria/aria-tree.html
@@ -7,6 +7,13 @@ @WIN-ALLOW:CHECKED* @WIN-ALLOW:IA2_STATE_* @WIN-ALLOW:MIXED* +@AURALINUX-ALLOW:setsize* +@AURALINUX-ALLOW:posinset* +@AURALINUX-ALLOW:level* +@AURALINUX-DENY:checkable +@AURALINUX-ALLOW:checkable:* +@AURALINUX-ALLOW:checked +@AURALINUX-ALLOW:indeterminate @BLINK-ALLOW:check* @BLINK-ALLOW:hierarchicalLevel* @BLINK-ALLOW:setSize*
diff --git a/content/test/data/accessibility/aria/aria-treegrid-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-treegrid-expected-auralinux.txt new file mode 100644 index 0000000..a50d2db --- /dev/null +++ b/content/test/data/accessibility/aria/aria-treegrid-expected-auralinux.txt
@@ -0,0 +1,12 @@ +[document web] +++[tree table] xml-roles:treegrid +++++[table row] selectable level:1 xml-roles:row +++++++[table cell] name='Cell at level 1' selectable xml-roles:gridcell (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Cell at level 1' +++++[table row] selectable level:2 xml-roles:row +++++++[table cell] name='Cell at level 2' selectable xml-roles:gridcell (row=1, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Cell at level 2' +++[tree table] xml-roles:treegrid +++++[table row] selectable level:1 xml-roles:row +++++++[table cell] name='Cell at level 1' selectable xml-roles:gridcell (row=0, col=0, row_span=1, col_span=1 n_row_headers=0, n_col_headers=0) +++++++++[text] name='Cell at level 1'
diff --git a/content/test/data/accessibility/aria/aria-treegrid.html b/content/test/data/accessibility/aria/aria-treegrid.html index 18136c3..bded263 100644 --- a/content/test/data/accessibility/aria/aria-treegrid.html +++ b/content/test/data/accessibility/aria/aria-treegrid.html
@@ -3,6 +3,8 @@ @MAC-ALLOW:AXDisclosureLevel* @WIN-ALLOW:xml-roles:* @WIN-ALLOW:level* +@AURALINUX-ALLOW:xml-roles:* +@AURALINUX-ALLOW:level* --> <!DOCTYPE html> <html>
diff --git a/content/test/data/accessibility/aria/aria-valuemax-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-valuemax-expected-auralinux.txt new file mode 100644 index 0000000..ac97a7c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-valuemax-expected-auralinux.txt
@@ -0,0 +1,6 @@ +[document web] +++[progress bar] current=51.000000 minimum=1.000000 maximum=101.000000 +++[scroll bar] current=52.000000 minimum=2.000000 maximum=102.000000 +++[slider] horizontal current=53.000000 minimum=3.000000 maximum=103.000000 +++[spin button] current=54.000000 minimum=4.000000 maximum=104.000000 +++++[text] name='Spin'
diff --git a/content/test/data/accessibility/aria/aria-valuemin-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-valuemin-expected-auralinux.txt new file mode 100644 index 0000000..ac97a7c --- /dev/null +++ b/content/test/data/accessibility/aria/aria-valuemin-expected-auralinux.txt
@@ -0,0 +1,6 @@ +[document web] +++[progress bar] current=51.000000 minimum=1.000000 maximum=101.000000 +++[scroll bar] current=52.000000 minimum=2.000000 maximum=102.000000 +++[slider] horizontal current=53.000000 minimum=3.000000 maximum=103.000000 +++[spin button] current=54.000000 minimum=4.000000 maximum=104.000000 +++++[text] name='Spin'
diff --git a/content/test/data/accessibility/aria/aria-valuenow-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-valuenow-expected-auralinux.txt new file mode 100644 index 0000000..4d54bc1 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-valuenow-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[progress bar] current=3.000000 minimum=0.000000 maximum=0.000000
diff --git a/content/test/data/accessibility/aria/aria-valuetext-expected-auralinux.txt b/content/test/data/accessibility/aria/aria-valuetext-expected-auralinux.txt new file mode 100644 index 0000000..60e71f1 --- /dev/null +++ b/content/test/data/accessibility/aria/aria-valuetext-expected-auralinux.txt
@@ -0,0 +1,2 @@ +[document web] +++[progress bar] valuetext:three current=3.000000 minimum=1.000000 maximum=96.000000
diff --git a/content/test/data/accessibility/aria/aria-valuetext.html b/content/test/data/accessibility/aria/aria-valuetext.html index a0cb51fd..3884078 100644 --- a/content/test/data/accessibility/aria/aria-valuetext.html +++ b/content/test/data/accessibility/aria/aria-valuetext.html
@@ -8,6 +8,7 @@ @WIN-ALLOW:minimumValue=* @WIN-ALLOW:maximumValue=* @WIN-ALLOW:xml-roles* +@AURALINUX-ALLOW:valuetext:* --> <html> <body>
diff --git a/content/test/data/accessibility/aria/aria1.1-combobox-expected-auralinux.txt b/content/test/data/accessibility/aria/aria1.1-combobox-expected-auralinux.txt new file mode 100644 index 0000000..95254d33 --- /dev/null +++ b/content/test/data/accessibility/aria/aria1.1-combobox-expected-auralinux.txt
@@ -0,0 +1,13 @@ +[document web] +++[section] label-for +++++[text] name='State' +++[combo box] name='State' expandable expanded labelled-by haspopup:listbox +++++[entry] selectable-text controller-for +++[list box] controlled-by +++++[list item] name='Alabama' selectable +++++[list item] name='Alaska' selectable selected +++[combo box] name='State' expandable expanded labelled-by haspopup:listbox +++++[entry] selectable-text controller-for +++[list box] controlled-by +++++[list item] name='Alabama' selectable +++++[list item] name='Alaska' selectable
diff --git a/content/test/data/accessibility/aria/aria1.1-combobox.html b/content/test/data/accessibility/aria/aria1.1-combobox.html index e48faac..4eda25b 100644 --- a/content/test/data/accessibility/aria/aria1.1-combobox.html +++ b/content/test/data/accessibility/aria/aria1.1-combobox.html
@@ -9,6 +9,9 @@ @WIN-ALLOW:haspopup* @WIN-ALLOW:ia2_hypertext=* @WIN-ALLOW:SELECT* +@AURALINUX-ALLOW:collapsed* +@AURALINUX-ALLOW:expand* +@AURALINUX-ALLOW:haspopup:* @BLINK-ALLOW:haspopup* --> <html>
diff --git a/content/test/data/frame_tree/page_with_ancestor_masked_iframe.html b/content/test/data/frame_tree/page_with_ancestor_masked_iframe.html index d9faa98..6331a6f 100644 --- a/content/test/data/frame_tree/page_with_ancestor_masked_iframe.html +++ b/content/test/data/frame_tree/page_with_ancestor_masked_iframe.html
@@ -20,7 +20,6 @@ width: 200px; height: 200px; border: none; - opacity: 0.5; } </style> </head>
diff --git a/content/test/gpu/gpu_tests/pixel_expectations.py b/content/test/gpu/gpu_tests/pixel_expectations.py index 39376ec..b0d8b59 100644 --- a/content/test/gpu/gpu_tests/pixel_expectations.py +++ b/content/test/gpu/gpu_tests/pixel_expectations.py
@@ -27,7 +27,9 @@ self.Skip('Pixel_OffscreenCanvasWebGLSoftwareCompositing', ['android']) self.Skip('Pixel_OffscreenCanvasWebGLSoftwareCompositingWorker', ['android']) - # self.Skip('Pixel_CanvasDisplayLinearRGBUnaccelerated2D', ['android']) + self.Skip('Pixel_CanvasDisplayLinearRGBUnaccelerated2D', ['android']) + self.Skip('Pixel_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing', ['android']) + self.Skip('Pixel_CanvasDisplaySRGBUnaccelerated2D', ['android']) self.Skip('Pixel_CanvasUnacceleratedLowLatency2D', ['android']) self.Skip('Pixel_RepeatedWebGLTo2D_SoftwareCompositing', ['android']) @@ -139,14 +141,17 @@ ['android', 'nvidia'], bug=868596) # New tests, mark as failing - self.Fail('Pixel_CanvasDisplaySRGBUnaccelerated2D') + self.Fail('Pixel_CanvasDisplaySRGBUnaccelerated2D', + ['win', 'mac', 'linux', 'chromeos']) self.Fail('Pixel_CanvasDisplaySRGBUnaccelerated2DGPUCompositing') # float16 is not yet supported for accelerated canvases self.Fail('Pixel_CanvasDisplaySRGBAccelerated2D', bug=948141) # Color space has changed here so we need to rebaseline - self.Fail('Pixel_CanvasDisplayLinearRGBUnaccelerated2D') - self.Fail('Pixel_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing') + self.Fail('Pixel_CanvasDisplayLinearRGBUnaccelerated2D', + ['win', 'mac', 'linux', 'chromeos']) + self.Fail('Pixel_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing', + ['win', 'mac', 'linux', 'chromeos']) self.Fail('Pixel_CanvasDisplayLinearRGBAccelerated2D') # Fails on Nexus 5, 6 and 6P
diff --git a/content/test/gpu/gpu_tests/pixel_test_pages.py b/content/test/gpu/gpu_tests/pixel_test_pages.py index 40659ad0d..045d4b42 100644 --- a/content/test/gpu/gpu_tests/pixel_test_pages.py +++ b/content/test/gpu/gpu_tests/pixel_test_pages.py
@@ -812,28 +812,28 @@ 'pixel_canvas_display_linear-rgb.html', base_name + '_CanvasDisplayLinearRGBAccelerated2D', test_rect=[0, 0, 140, 140], - revision=7, + revision=8, browser_args=browser_args), PixelTestPage( 'pixel_canvas_display_linear-rgb.html', base_name + '_CanvasDisplayLinearRGBUnaccelerated2D', test_rect=[0, 0, 140, 140], - revision=1, + revision=2, browser_args=browser_args + unaccelerated_args), PixelTestPage( 'pixel_canvas_display_linear-rgb.html', base_name + '_CanvasDisplayLinearRGBUnaccelerated2DGPUCompositing', test_rect=[0, 0, 140, 140], - revision=7, + revision=8, browser_args=browser_args + ['--disable-accelerated-2d-canvas']), PixelTestPage( 'pixel_canvas_display_srgb.html', base_name + '_CanvasDisplaySRGBAccelerated2D', test_rect=[0, 0, 140, 140], - revision=0, # not used, unsupported, see crbug/TODO + revision=0, # not used, unsupported browser_args=browser_args), PixelTestPage(
diff --git a/content/test/navigation_simulator_impl.cc b/content/test/navigation_simulator_impl.cc index 1889bd0..44f0322d 100644 --- a/content/test/navigation_simulator_impl.cc +++ b/content/test/navigation_simulator_impl.cc
@@ -1202,6 +1202,7 @@ params->gesture = has_user_gesture_ ? NavigationGestureUser : NavigationGestureAuto; params->history_list_was_cleared = history_list_was_cleared_; + params->did_create_new_entry = DidCreateNewEntry(); if (failed_navigation) { // Note: Error pages must commit in a unique origin. So it is left unset. @@ -1214,26 +1215,26 @@ params->should_update_history = true; } + CHECK(same_document || request_); + params->nav_entry_id = request_ ? request_->nav_entry_id() : 0; + + // Simulate Blink assigning a item sequence number and document sequence + // number to the navigation. + params->item_sequence_number = ++g_unique_identifier; if (same_document) { - params->nav_entry_id = 0; - params->did_create_new_entry = false; - - params->page_state = - PageState::CreateForTesting(navigation_url_, false, nullptr, nullptr); + FrameNavigationEntry* current_entry = + web_contents_->GetController().GetLastCommittedEntry()->GetFrameEntry( + frame_tree_node_); + params->document_sequence_number = + current_entry->document_sequence_number(); } else { - CHECK(request_); - params->nav_entry_id = request_->nav_entry_id(); - params->did_create_new_entry = DidCreateNewEntry(); - - // Simulate Blink assigning an item and document sequence number to the - // navigation. - params->item_sequence_number = ++g_unique_identifier; params->document_sequence_number = ++g_unique_identifier; - params->page_state = PageState::CreateForTestingWithSequenceNumbers( - navigation_url_, params->item_sequence_number, - params->document_sequence_number); } + params->page_state = PageState::CreateForTestingWithSequenceNumbers( + navigation_url_, params->item_sequence_number, + params->document_sequence_number); + return params; }
diff --git a/content/test/stub_layer_tree_view_delegate.h b/content/test/stub_layer_tree_view_delegate.h index c8afbba..90f486d0 100644 --- a/content/test/stub_layer_tree_view_delegate.h +++ b/content/test/stub_layer_tree_view_delegate.h
@@ -29,9 +29,12 @@ void DidBeginMainFrame() override {} void RecordStartOfFrameMetrics() override {} void RecordEndOfFrameMetrics(base::TimeTicks) override {} + void BeginUpdateLayers() override {} + void EndUpdateLayers() override {} void RequestNewLayerTreeFrameSink( LayerTreeFrameSinkCallback callback) override; void DidCommitAndDrawCompositorFrame() override {} + void WillCommitCompositorFrame() override {} void DidCommitCompositorFrame() override {} void DidCompletePageScaleAnimation() override {} void UpdateVisualState() override {}
diff --git a/device/usb/usb_service_linux.cc b/device/usb/usb_service_linux.cc index 7c5c0b84..af675d7 100644 --- a/device/usb/usb_service_linux.cc +++ b/device/usb/usb_service_linux.cc
@@ -204,17 +204,15 @@ UsbServiceLinux::UsbServiceLinux() : UsbService(), blocking_task_runner_(CreateBlockingTaskRunner()), + helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)), weak_factory_(this) { - helper_ = - std::make_unique<BlockingTaskRunnerHelper>(weak_factory_.GetWeakPtr()); + helper_.reset(new BlockingTaskRunnerHelper(weak_factory_.GetWeakPtr())); blocking_task_runner_->PostTask( FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Start, base::Unretained(helper_.get()))); } -UsbServiceLinux::~UsbServiceLinux() { - blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); -} +UsbServiceLinux::~UsbServiceLinux() = default; void UsbServiceLinux::GetDevices(const GetDevicesCallback& callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/device/usb/usb_service_linux.h b/device/usb/usb_service_linux.h index df1f7ed..f558607 100644 --- a/device/usb/usb_service_linux.h +++ b/device/usb/usb_service_linux.h
@@ -11,6 +11,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "base/sequenced_task_runner.h" #include "device/usb/usb_service.h" namespace device { @@ -57,7 +58,7 @@ std::list<GetDevicesCallback> enumeration_callbacks_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; - std::unique_ptr<BlockingTaskRunnerHelper> helper_; + std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_; DeviceMap devices_by_path_; base::WeakPtrFactory<UsbServiceLinux> weak_factory_;
diff --git a/device/usb/usb_service_win.cc b/device/usb/usb_service_win.cc index 5eb314e..2ca7d4c 100644 --- a/device/usb/usb_service_win.cc +++ b/device/usb/usb_service_win.cc
@@ -290,6 +290,7 @@ UsbServiceWin::UsbServiceWin() : UsbService(), blocking_task_runner_(CreateBlockingTaskRunner()), + helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)), device_observer_(this), weak_factory_(this) { DeviceMonitorWin* device_monitor = @@ -297,16 +298,13 @@ if (device_monitor) device_observer_.Add(device_monitor); - helper_ = - std::make_unique<BlockingTaskRunnerHelper>(weak_factory_.GetWeakPtr()); + helper_.reset(new BlockingTaskRunnerHelper(weak_factory_.GetWeakPtr())); blocking_task_runner_->PostTask( FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::EnumerateDevices, base::Unretained(helper_.get()))); } -UsbServiceWin::~UsbServiceWin() { - blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); -} +UsbServiceWin::~UsbServiceWin() = default; void UsbServiceWin::GetDevices(const GetDevicesCallback& callback) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/device/usb/usb_service_win.h b/device/usb/usb_service_win.h index f7d4e44..475960d3 100644 --- a/device/usb/usb_service_win.h +++ b/device/usb/usb_service_win.h
@@ -13,6 +13,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/scoped_observer.h" +#include "base/sequenced_task_runner.h" #include "device/base/device_monitor_win.h" #include "device/usb/usb_device_win.h" @@ -54,7 +55,7 @@ std::list<GetDevicesCallback> enumeration_callbacks_; scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; - std::unique_ptr<BlockingTaskRunnerHelper> helper_; + std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_; std::unordered_map<std::string, scoped_refptr<UsbDeviceWin>> devices_by_path_; ScopedObserver<DeviceMonitorWin, DeviceMonitorWin::Observer> device_observer_;
diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index 30f2691..1611a43 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn
@@ -514,9 +514,10 @@ deps += [ "//chromeos", "//chromeos/audio", - "//chromeos/dbus:media_perception_proto", "//chromeos/dbus:power_manager_proto", "//chromeos/dbus:test_support", + "//chromeos/dbus/media_analytics", + "//chromeos/dbus/media_analytics:media_perception_proto", "//chromeos/login/login_state", "//chromeos/network", ] @@ -720,8 +721,9 @@ deps += [ "//chromeos:test_support", - "//chromeos/dbus:media_perception_proto", "//chromeos/dbus:test_support", + "//chromeos/dbus/media_analytics", + "//chromeos/dbus/media_analytics:media_perception_proto", "//chromeos/login/login_state", "//chromeos/network:test_support", "//components/feedback",
diff --git a/extensions/browser/api/BUILD.gn b/extensions/browser/api/BUILD.gn index 855f389..b6b5c2d0 100644 --- a/extensions/browser/api/BUILD.gn +++ b/extensions/browser/api/BUILD.gn
@@ -144,7 +144,8 @@ deps += [ "//chromeos", "//chromeos/dbus", - "//chromeos/dbus:media_perception_proto", + "//chromeos/dbus/media_analytics", + "//chromeos/dbus/media_analytics:media_perception_proto", "//chromeos/login/login_state", "//chromeos/services/media_perception/public/mojom", "//chromeos/services/media_perception/public/mojom:mojom_js_data_deps",
diff --git a/extensions/browser/api/media_perception_private/media_perception_api_manager.cc b/extensions/browser/api/media_perception_private/media_perception_api_manager.cc index 0652fc8..2996a45 100644 --- a/extensions/browser/api/media_perception_private/media_perception_api_manager.cc +++ b/extensions/browser/api/media_perception_private/media_perception_api_manager.cc
@@ -12,7 +12,7 @@ #include "base/files/file_path.h" #include "base/lazy_instance.h" #include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include "chromeos/dbus/upstart/upstart_client.h" #include "extensions/browser/api/extensions_api_client.h" #include "extensions/browser/api/media_perception_private/conversion_utils.h" @@ -140,8 +140,7 @@ analytics_process_state_(AnalyticsProcessState::IDLE), scoped_observer_(this), weak_ptr_factory_(this) { - scoped_observer_.Add( - chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient()); + scoped_observer_.Add(chromeos::MediaAnalyticsClient::Get()); } MediaPerceptionAPIManager::~MediaPerceptionAPIManager() { @@ -161,9 +160,7 @@ void MediaPerceptionAPIManager::GetState(APIStateCallback callback) { if (analytics_process_state_ == AnalyticsProcessState::RUNNING) { - chromeos::MediaAnalyticsClient* dbus_client = - chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); - dbus_client->GetState( + chromeos::MediaAnalyticsClient::Get()->GetState( base::BindOnce(&MediaPerceptionAPIManager::StateCallback, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); return; @@ -351,9 +348,7 @@ void MediaPerceptionAPIManager::SetStateInternal(APIStateCallback callback, const mri::State& state) { - chromeos::MediaAnalyticsClient* dbus_client = - chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); - dbus_client->SetState( + chromeos::MediaAnalyticsClient::Get()->SetState( state, base::BindOnce(&MediaPerceptionAPIManager::StateCallback, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); @@ -361,9 +356,7 @@ void MediaPerceptionAPIManager::GetDiagnostics( const APIGetDiagnosticsCallback& callback) { - chromeos::MediaAnalyticsClient* dbus_client = - chromeos::DBusThreadManager::Get()->GetMediaAnalyticsClient(); - dbus_client->GetDiagnostics( + chromeos::MediaAnalyticsClient::Get()->GetDiagnostics( base::Bind(&MediaPerceptionAPIManager::GetDiagnosticsCallback, weak_ptr_factory_.GetWeakPtr(), callback)); } @@ -417,12 +410,10 @@ base::ScopedFD fd = channel.TakeRemoteEndpoint().TakePlatformHandle().TakeFD(); - chromeos::DBusThreadManager::Get() - ->GetMediaAnalyticsClient() - ->BootstrapMojoConnection( - std::move(fd), - base::BindOnce(&MediaPerceptionAPIManager::OnBootstrapMojoConnection, - weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + chromeos::MediaAnalyticsClient::Get()->BootstrapMojoConnection( + std::move(fd), + base::BindOnce(&MediaPerceptionAPIManager::OnBootstrapMojoConnection, + weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } void MediaPerceptionAPIManager::OnBootstrapMojoConnection(
diff --git a/extensions/browser/api/media_perception_private/media_perception_api_manager.h b/extensions/browser/api/media_perception_private/media_perception_api_manager.h index 4f38e6f..4d2a78f 100644 --- a/extensions/browser/api/media_perception_private/media_perception_api_manager.h +++ b/extensions/browser/api/media_perception_private/media_perception_api_manager.h
@@ -10,7 +10,7 @@ #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/scoped_observer.h" -#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include "chromeos/dbus/media_perception/media_perception.pb.h" #include "chromeos/services/media_perception/public/mojom/media_perception_service.mojom.h" #include "extensions/browser/browser_context_keyed_api_factory.h"
diff --git a/extensions/browser/api/media_perception_private/media_perception_api_manager_unittest.cc b/extensions/browser/api/media_perception_private/media_perception_api_manager_unittest.cc index 636b44b..d43af6f 100644 --- a/extensions/browser/api/media_perception_private/media_perception_api_manager_unittest.cc +++ b/extensions/browser/api/media_perception_private/media_perception_api_manager_unittest.cc
@@ -9,9 +9,8 @@ #include "base/bind.h" #include "base/containers/queue.h" #include "base/run_loop.h" -#include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/fake_media_analytics_client.h" -#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/media_analytics/fake_media_analytics_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include "chromeos/dbus/upstart/fake_upstart_client.h" #include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_thread_bundle.h" @@ -161,12 +160,7 @@ ~MediaPerceptionAPIManagerTest() override = default; void SetUp() override { - std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); - auto media_analytics_client = - std::make_unique<chromeos::FakeMediaAnalyticsClient>(); - media_analytics_client_ = media_analytics_client.get(); - dbus_setter->SetMediaAnalyticsClient(std::move(media_analytics_client)); + chromeos::MediaAnalyticsClient::InitializeFake(); upstart_client_ = std::make_unique<TestUpstartClient>(); @@ -176,16 +170,14 @@ void TearDown() override { // Need to make sure that the MediaPerceptionAPIManager is destructed before - // the DbusThreadManager. + // MediaAnalyticsClient. manager_.reset(); upstart_client_.reset(); - chromeos::DBusThreadManager::Shutdown(); + chromeos::MediaAnalyticsClient::Shutdown(); } std::unique_ptr<MediaPerceptionAPIManager> manager_; - // Ownership of both is passed on to chromeos::DbusThreadManager. - chromeos::FakeMediaAnalyticsClient* media_analytics_client_; TestUpstartClient* upstart_client() { return upstart_client_.get(); } private: @@ -389,7 +381,7 @@ EXPECT_EQ(media_perception::SERVICE_ERROR_NONE, SetStateAndWaitForResponse(manager_.get(), state)); // Disable the functionality of the fake process. - media_analytics_client_->set_process_running(false); + chromeos::FakeMediaAnalyticsClient::Get()->set_process_running(false); EXPECT_EQ(media_perception::SERVICE_ERROR_SERVICE_UNREACHABLE, GetStateAndWaitForResponse(manager_.get())); EXPECT_EQ(media_perception::SERVICE_ERROR_SERVICE_UNREACHABLE,
diff --git a/extensions/browser/api/media_perception_private/media_perception_private_apitest.cc b/extensions/browser/api/media_perception_private/media_perception_private_apitest.cc index cc008bd..51c3644 100644 --- a/extensions/browser/api/media_perception_private/media_perception_private_apitest.cc +++ b/extensions/browser/api/media_perception_private/media_perception_private_apitest.cc
@@ -6,9 +6,8 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/threading/thread_task_runner_handle.h" -#include "chromeos/dbus/dbus_thread_manager.h" -#include "chromeos/dbus/fake_media_analytics_client.h" -#include "chromeos/dbus/media_analytics_client.h" +#include "chromeos/dbus/media_analytics/fake_media_analytics_client.h" +#include "chromeos/dbus/media_analytics/media_analytics_client.h" #include "chromeos/dbus/media_perception/media_perception.pb.h" #include "chromeos/dbus/upstart/upstart_client.h" #include "extensions/browser/api/media_perception_private/media_perception_api_delegate.h" @@ -99,15 +98,15 @@ } void SetUpInProcessBrowserTestFixture() override { - std::unique_ptr<chromeos::DBusThreadManagerSetter> dbus_setter = - chromeos::DBusThreadManager::GetSetterForTesting(); - // Initialize UpstartClient here so that it is available for - // FakeMediaAnalyticsClient. It will be shutdown in ChromeBrowserMain. + // MediaAnalyticsClient and UpstartClient are required by + // MediaPerceptionAPIManager. + chromeos::MediaAnalyticsClient::InitializeFake(); chromeos::UpstartClient::InitializeFake(); - auto media_analytics_client = - std::make_unique<chromeos::FakeMediaAnalyticsClient>(); - media_analytics_client_ = media_analytics_client.get(); - dbus_setter->SetMediaAnalyticsClient(std::move(media_analytics_client)); + } + + void TearDownInProcessBrowserTestFixture() override { + chromeos::UpstartClient::Shutdown(); + chromeos::MediaAnalyticsClient::Shutdown(); } void SetUpOnMainThread() override { @@ -116,9 +115,6 @@ ShellApiTest::SetUpOnMainThread(); } - // Ownership is passed on to chromeos::DbusThreadManager. - chromeos::FakeMediaAnalyticsClient* media_analytics_client_; - private: std::unique_ptr<base::AutoReset<extensions::FeatureSessionType>> session_feature_type_; @@ -156,7 +152,7 @@ mri::Diagnostics diagnostics; diagnostics.add_perception_sample()->mutable_frame_perception()->set_frame_id( 1); - media_analytics_client_->SetDiagnostics(diagnostics); + chromeos::FakeMediaAnalyticsClient::Get()->SetDiagnostics(diagnostics); ASSERT_TRUE(RunAppTest("media_perception_private/diagnostics")) << message_; } @@ -175,7 +171,8 @@ mri::MediaPerception media_perception; media_perception.add_frame_perception()->set_frame_id(1); ASSERT_TRUE( - media_analytics_client_->FireMediaPerceptionEvent(media_perception)); + chromeos::FakeMediaAnalyticsClient::Get()->FireMediaPerceptionEvent( + media_perception)); EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); }
diff --git a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.cc b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.cc index cddcebd..ae13bf6 100644 --- a/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.cc +++ b/extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container_manager.cc
@@ -22,8 +22,7 @@ namespace { using RenderFrameMap = - base::flat_map<content::RenderFrame*, - std::unique_ptr<MimeHandlerViewContainerManager>>; + base::flat_map<int32_t, std::unique_ptr<MimeHandlerViewContainerManager>>; RenderFrameMap* GetRenderFrameMap() { static base::NoDestructor<RenderFrameMap> instance; @@ -48,13 +47,14 @@ MimeHandlerViewContainerManager* MimeHandlerViewContainerManager::Get( content::RenderFrame* render_frame, bool create_if_does_not_exits) { + int32_t routing_id = render_frame->GetRoutingID(); auto& map = *GetRenderFrameMap(); - if (base::ContainsKey(map, render_frame)) - return map[render_frame].get(); + if (base::ContainsKey(map, routing_id)) + return map[routing_id].get(); if (create_if_does_not_exits) { - map[render_frame] = + map[routing_id] = std::make_unique<MimeHandlerViewContainerManager>(render_frame); - return map[render_frame].get(); + return map[routing_id].get(); } return nullptr; } @@ -68,7 +68,7 @@ void MimeHandlerViewContainerManager::OnDestruct() { bindings_.CloseAllBindings(); // This will delete the class. - GetRenderFrameMap()->erase(render_frame()); + GetRenderFrameMap()->erase(routing_id()); } void MimeHandlerViewContainerManager::CreateFrameContainer(
diff --git a/gpu/command_buffer/tests/fuzzer_main.cc b/gpu/command_buffer/tests/fuzzer_main.cc index 91cd94a..14f170b 100644 --- a/gpu/command_buffer/tests/fuzzer_main.cc +++ b/gpu/command_buffer/tests/fuzzer_main.cc
@@ -403,15 +403,16 @@ gfx::ColorSpace::CreateSRGB(), usage); } - context_->MakeCurrent(surface_.get()); #if defined(GPU_FUZZER_USE_RASTER_DECODER) CHECK(feature_info->feature_flags().chromium_raster_transport); + context_state_->MakeCurrent(nullptr); auto* context = context_state_->context(); decoder_.reset(raster::RasterDecoder::Create( command_buffer_.get(), command_buffer_->service(), &outputter_, gpu_feature_info, gpu_preferences_, nullptr /* memory_tracker */, shared_image_manager_.get(), context_state_)); #else + context_->MakeCurrent(surface_.get()); // GLES2Decoder may Initialize feature_info differently than // SharedContextState and should have its own. auto decoder_feature_info = base::MakeRefCounted<gles2::FeatureInfo>(
diff --git a/infra/config/luci-milo.cfg b/infra/config/luci-milo.cfg index f4c021b..4033c844 100644 --- a/infra/config/luci-milo.cfg +++ b/infra/config/luci-milo.cfg
@@ -151,7 +151,7 @@ } links { text: "perf" - url: "/p/chromium/g/chromium.perf" + url: "/p/chrome/g/chrome.perf/console" alt: "Chromium Perf console" } links { @@ -242,7 +242,7 @@ } console_groups { console_ids: "chromium/chromium.android" - console_ids: "chromium/chromium.perf" + console_ids: "chrome/chrome.perf" console_ids: "chromium/chromium.gpu.fyi" console_ids: "chromium/chromium.fuzz" } @@ -1186,122 +1186,6 @@ consoles { header_id: "chromium" - id: "chromium.perf" - name: "chromium.perf" - repo_url: "https://chromium.googlesource.com/chromium/src" - refs: "refs/heads/master" - manifest_name: "REVISION" - builders { - name: "buildbot/chromium.perf/Android Builder Perf" - name: "buildbucket/luci.chrome.ci/Android Builder Perf" - category: "builder|android" - short_name: "arm" - } - builders { - name: "buildbot/chromium.perf/Android arm64 Builder Perf" - name: "buildbucket/luci.chrome.ci/Android arm64 Builder Perf" - category: "builder|android" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chrome.ci/android-builder-perf" - category: "builder|android|compile" - short_name: "arm" - } - builders { - name: "buildbucket/luci.chrome.ci/android_arm64-builder-perf" - category: "builder|android|compile" - short_name: "a64" - } - builders { - name: "buildbucket/luci.chrome.ci/win32-builder-perf" - category: "builder|win" - short_name: "32" - } - builders { - name: "buildbucket/luci.chrome.ci/win64-builder-perf" - category: "builder|win" - short_name: "64" - } - builders { - name: "buildbucket/luci.chrome.ci/mac-builder-perf" - category: "builder" - short_name: "mac" - } - builders { - name: "buildbucket/luci.chrome.ci/linux-builder-perf" - category: "builder" - short_name: "lnx" - } - builders { - name: "buildbot/chromium.perf/Android Nexus5 Perf" - name: "buildbucket/luci.chrome.ci/Android Nexus5 Perf" - category: "perf|android" - short_name: "N5" - } - builders { - name: "buildbot/chromium.perf/android-nexus5x-perf" - name: "buildbucket/luci.chrome.ci/android-nexus5x-perf" - category: "perf|android" - short_name: "N5X" - } - builders { - name: "buildbucket/luci.chrome.ci/android-go-perf" - category: "perf|android" - short_name: "go" - } - builders { - name: "buildbot/chromium.perf/Android Nexus5X WebView Perf" - name: "buildbucket/luci.chrome.ci/Android Nexus5X WebView Perf" - category: "perf|android|webview" - short_name: "N5X" - } - builders { - name: "buildbot/chromium.perf/Android Nexus6 WebView Perf" - name: "buildbucket/luci.chrome.ci/Android Nexus6 WebView Perf" - category: "perf|android|webview" - short_name: "N6" - } - builders { - name: "buildbot/chromium.perf/win-10-perf" - name: "buildbucket/luci.chrome.ci/win-10-perf" - category: "perf|win|10" - short_name: "w10" - } - builders { - name: "buildbot/chromium.perf/Win 7 Perf" - name: "buildbucket/luci.chrome.ci/Win 7 Perf" - category: "perf|win|7" - short_name: "32" - } - builders { - name: "buildbot/chromium.perf/Win 7 Nvidia GPU Perf" - name: "buildbucket/luci.chrome.ci/Win 7 Nvidia GPU Perf" - category: "perf|win|7" - short_name: "nvi" - } - builders { - name: "buildbot/chromium.perf/mac-10_12_laptop_low_end-perf" - name: "buildbucket/luci.chrome.ci/mac-10_12_laptop_low_end-perf" - category: "perf|mac" - short_name: "low" - } - builders { - name: "buildbot/chromium.perf/mac-10_13_laptop_high_end-perf" - name: "buildbucket/luci.chrome.ci/mac-10_13_laptop_high_end-perf" - category: "perf|mac" - short_name: "high" - } - builders { - name: "buildbot/chromium.perf/linux-perf" - name: "buildbucket/luci.chrome.ci/linux-perf" - category: "perf" - short_name: "lnx" - } -} - -consoles { - header_id: "chromium" id: "chromium.fuzz" name: "chromium.fuzz" repo_url: "https://chromium.googlesource.com/chromium/src"
diff --git a/ios/chrome/browser/about_flags.mm b/ios/chrome/browser/about_flags.mm index 4442111..5294f5bc 100644 --- a/ios/chrome/browser/about_flags.mm +++ b/ios/chrome/browser/about_flags.mm
@@ -574,6 +574,13 @@ flag_descriptions::kPasswordGenerationName, flag_descriptions::kPasswordGenerationDescription, flags_ui::kOsIos, FEATURE_VALUE_TYPE(features::kPasswordGeneration)}, + {"new-omnibox-popup-layout", flag_descriptions::kNewOmniboxPopupLayoutName, + flag_descriptions::kNewOmniboxPopupLayoutDescription, flags_ui::kOsIos, + FEATURE_VALUE_TYPE(kNewOmniboxPopupLayout)}, + {"fill-on-account-select-http", + flag_descriptions::kFillOnAccountSelectHttpName, + flag_descriptions::kFillOnAccountSelectHttpDescription, flags_ui::kOsIos, + FEATURE_VALUE_TYPE(password_manager::features::kFillOnAccountSelectHttp)}, }; // Add all switches from experimental flags to |command_line|.
diff --git a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.h b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.h index d13ea93..fe34a5f 100644 --- a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.h +++ b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.h
@@ -29,7 +29,7 @@ // Saved passwords has been fetched or updated. - (void)passwordFetcher:(PasswordFetcher*)passwordFetcher didFetchPasswords: - (std::vector<std::unique_ptr<autofill::PasswordForm>>&)passwords; + (std::vector<std::unique_ptr<autofill::PasswordForm>>)passwords; @end
diff --git a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.mm b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.mm index 51c1e79..4ee58f0 100644 --- a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.mm +++ b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/autofill/manual_fill/passwords_fetcher.h" +#include "base/stl_util.h" #include "components/autofill/core/common/password_form.h" #include "components/password_manager/core/browser/android_affiliation/affiliation_utils.h" #include "components/password_manager/core/browser/password_list_sorter.h" @@ -101,23 +102,18 @@ #pragma mark - SavePasswordsConsumerDelegate - (void)onGetPasswordStoreResults: - (std::vector<std::unique_ptr<autofill::PasswordForm>>&)result { + (std::vector<std::unique_ptr<autofill::PasswordForm>>)results { // For Manual Fallback we filter out the android and the blacklisted // passwords. - result.erase( - std::remove_if(result.begin(), result.end(), - [](std::unique_ptr<autofill::PasswordForm>& form) { - const auto is_android_uri = - password_manager::IsValidAndroidFacetURI( - form->signon_realm); - return form->blacklisted_by_user || is_android_uri; - }), - result.end()); + base::EraseIf(results, [](const auto& form) { + return form->blacklisted_by_user || + password_manager::IsValidAndroidFacetURI(form->signon_realm); + }); password_manager::DuplicatesMap savedPasswordDuplicates; - password_manager::SortEntriesAndHideDuplicates(&result, + password_manager::SortEntriesAndHideDuplicates(&results, &savedPasswordDuplicates); - [self.delegate passwordFetcher:self didFetchPasswords:result]; + [self.delegate passwordFetcher:self didFetchPasswords:std::move(results)]; } #pragma mark - PasswordStoreObserver
diff --git a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm index ad906c5..9d904ce 100644 --- a/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm +++ b/ios/chrome/browser/autofill/manual_fill/passwords_fetcher_unittest.mm
@@ -42,7 +42,7 @@ - (void)passwordFetcher:(PasswordFetcher*)passwordFetcher didFetchPasswords: - (std::vector<std::unique_ptr<autofill::PasswordForm>>&)passwords { + (std::vector<std::unique_ptr<autofill::PasswordForm>>)passwords { _passwords = std::move(passwords); }
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.cc b/ios/chrome/browser/ios_chrome_flag_descriptions.cc index a85cff8..666369de 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.cc +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.cc
@@ -273,6 +273,12 @@ const char kFCMInvalidationsDescription[] = "Use the new FCM-based protocol for deliveling invalidations"; +const char kFillOnAccountSelectHttpName[] = + "Fill passwords on account selection on HTTP origins"; +const char kFillOnAccountSelectHttpDescription[] = + "Filling of passwords when an account is explicitly selected by the user " + "rather than autofilling credentials on page load on HTTP origins."; + const char kFullscreenViewportAdjustmentExperimentName[] = "Fullscreen Viewport Adjustment Mode"; const char kFullscreenViewportAdjustmentExperimentDescription[] = @@ -311,6 +317,11 @@ "version, currently under development. WARNING: when enabled, Password " "Manager might stop working"; +const char kNewOmniboxPopupLayoutName[] = "New omnibox popup"; +const char kNewOmniboxPopupLayoutDescription[] = + "Switches the omnibox suggestions and omnibox itself to display the new " + "design with favicons, new suggestion layout, rich entity support."; + const char kNonModalDialogsName[] = "Use non-modal JavaScript dialogs"; const char kNonModalDialogsDescription[] = "Presents JavaScript dialogs non-modally so that the user can change tabs "
diff --git a/ios/chrome/browser/ios_chrome_flag_descriptions.h b/ios/chrome/browser/ios_chrome_flag_descriptions.h index b9e9e4e..c35d37d6 100644 --- a/ios/chrome/browser/ios_chrome_flag_descriptions.h +++ b/ios/chrome/browser/ios_chrome_flag_descriptions.h
@@ -216,6 +216,11 @@ extern const char kFCMInvalidationsName[]; extern const char kFCMInvalidationsDescription[]; +// Title and description for the flag to enable fill passwords on account select +// on HTTP origins. +extern const char kFillOnAccountSelectHttpName[]; +extern const char kFillOnAccountSelectHttpDescription[]; + // Title and description for the command line switch used to determine the // active fullscreen viewport adjustment mode. extern const char kFullscreenViewportAdjustmentExperimentName[]; @@ -248,6 +253,10 @@ extern const char kNewPasswordFormParsingForSavingName[]; extern const char kNewPasswordFormParsingForSavingDescription[]; +// Title and description for the flag to display new omnibox popup. +extern const char kNewOmniboxPopupLayoutName[]; +extern const char kNewOmniboxPopupLayoutDescription[]; + // Title and description for the flag to enable non-modal JavaScript dialogs. extern const char kNonModalDialogsName[]; extern const char kNonModalDialogsDescription[];
diff --git a/ios/chrome/browser/passwords/save_passwords_consumer.h b/ios/chrome/browser/passwords/save_passwords_consumer.h index f8efc8c..0bb3ab5f 100644 --- a/ios/chrome/browser/passwords/save_passwords_consumer.h +++ b/ios/chrome/browser/passwords/save_passwords_consumer.h
@@ -15,7 +15,7 @@ // Callback called when the async request launched from // |getLoginsFromPasswordStore| finishes. - (void)onGetPasswordStoreResults: - (std::vector<std::unique_ptr<autofill::PasswordForm>>&)result; + (std::vector<std::unique_ptr<autofill::PasswordForm>>)results; @end
diff --git a/ios/chrome/browser/passwords/save_passwords_consumer.mm b/ios/chrome/browser/passwords/save_passwords_consumer.mm index 904c0c7..082e07b 100644 --- a/ios/chrome/browser/passwords/save_passwords_consumer.mm +++ b/ios/chrome/browser/passwords/save_passwords_consumer.mm
@@ -4,6 +4,10 @@ #include "ios/chrome/browser/passwords/save_passwords_consumer.h" +#include <utility> + +#include "components/autofill/core/common/password_form.h" + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif @@ -18,7 +22,7 @@ void SavePasswordsConsumer::OnGetPasswordStoreResults( std::vector<std::unique_ptr<autofill::PasswordForm>> results) { - [delegate_ onGetPasswordStoreResults:results]; + [delegate_ onGetPasswordStoreResults:std::move(results)]; } } // namespace ios
diff --git a/ios/chrome/browser/sync/profile_sync_service_factory.cc b/ios/chrome/browser/sync/profile_sync_service_factory.cc index 24d7dfc..aea71fe4 100644 --- a/ios/chrome/browser/sync/profile_sync_service_factory.cc +++ b/ios/chrome/browser/sync/profile_sync_service_factory.cc
@@ -12,13 +12,13 @@ #include "base/task/post_task.h" #include "base/time/time.h" #include "components/autofill/core/common/autofill_features.h" -#include "components/browser_sync/browser_sync_switches.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/invalidation/impl/invalidation_switches.h" #include "components/invalidation/impl/profile_invalidation_provider.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/network_time/network_time_tracker.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/startup_controller.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_util.h" #include "ios/chrome/browser/application_context.h" @@ -97,18 +97,18 @@ } // static -browser_sync::ProfileSyncService* +syncer::ProfileSyncService* ProfileSyncServiceFactory::GetAsProfileSyncServiceForBrowserState( ios::ChromeBrowserState* browser_state) { - return static_cast<browser_sync::ProfileSyncService*>( + return static_cast<syncer::ProfileSyncService*>( GetForBrowserState(browser_state)); } // static -browser_sync::ProfileSyncService* +syncer::ProfileSyncService* ProfileSyncServiceFactory::GetAsProfileSyncServiceForBrowserStateIfExists( ios::ChromeBrowserState* browser_state) { - return static_cast<browser_sync::ProfileSyncService*>( + return static_cast<syncer::ProfileSyncService*>( GetForBrowserStateIfExists(browser_state)); } @@ -158,10 +158,10 @@ // startup once bug has been fixed. ios::AboutSigninInternalsFactory::GetForBrowserState(browser_state); - browser_sync::ProfileSyncService::InitParams init_params; + syncer::ProfileSyncService::InitParams init_params; init_params.identity_manager = IdentityManagerFactory::GetForBrowserState(browser_state); - init_params.start_behavior = browser_sync::ProfileSyncService::MANUAL_START; + init_params.start_behavior = syncer::ProfileSyncService::MANUAL_START; init_params.sync_client = std::make_unique<IOSChromeSyncClient>(browser_state); init_params.network_time_update_callback = base::Bind(&UpdateNetworkTime); @@ -196,8 +196,8 @@ deprecated_invalidation_provider->GetIdentityProvider()); } - auto pss = std::make_unique<browser_sync::ProfileSyncService>( - std::move(init_params)); + auto pss = + std::make_unique<syncer::ProfileSyncService>(std::move(init_params)); pss->Initialize(); return pss; }
diff --git a/ios/chrome/browser/sync/profile_sync_service_factory.h b/ios/chrome/browser/sync/profile_sync_service_factory.h index 59748b5..7f56388 100644 --- a/ios/chrome/browser/sync/profile_sync_service_factory.h +++ b/ios/chrome/browser/sync/profile_sync_service_factory.h
@@ -11,11 +11,8 @@ #include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" -namespace browser_sync { -class ProfileSyncService; -} // namespace browser_sync - namespace syncer { +class ProfileSyncService; class SyncService; } // namespace syncer @@ -33,11 +30,10 @@ static syncer::SyncService* GetForBrowserStateIfExists( ios::ChromeBrowserState* browser_state); - static browser_sync::ProfileSyncService* - GetAsProfileSyncServiceForBrowserState( + static syncer::ProfileSyncService* GetAsProfileSyncServiceForBrowserState( ios::ChromeBrowserState* browser_state); - static browser_sync::ProfileSyncService* + static syncer::ProfileSyncService* GetAsProfileSyncServiceForBrowserStateIfExists( ios::ChromeBrowserState* browser_state);
diff --git a/ios/chrome/browser/ui/authentication/authentication_constants.h b/ios/chrome/browser/ui/authentication/authentication_constants.h index f8bf85b..35f657f 100644 --- a/ios/chrome/browser/ui/authentication/authentication_constants.h +++ b/ios/chrome/browser/ui/authentication/authentication_constants.h
@@ -14,8 +14,6 @@ extern const UIFontTextStyle kAuthenticationTitleFontStyle; extern const UIFontTextStyle kAuthenticationTextFontStyle; -// Color displayed in the non-safe area. -extern const int kAuthenticationHeaderBackgroundColor; // Horizontal margin between the container view and any elements inside. extern const CGFloat kAuthenticationHorizontalMargin; // Vertical margin between the header image and the main title.
diff --git a/ios/chrome/browser/ui/authentication/authentication_constants.mm b/ios/chrome/browser/ui/authentication/authentication_constants.mm index 66397c61..76d23a5 100644 --- a/ios/chrome/browser/ui/authentication/authentication_constants.mm +++ b/ios/chrome/browser/ui/authentication/authentication_constants.mm
@@ -8,12 +8,11 @@ #error "This file requires ARC support." #endif -const CGFloat kAuthenticationHeaderImageHeight = 88.; +const CGFloat kAuthenticationHeaderImageHeight = 180.; const UIFontTextStyle kAuthenticationTitleFontStyle = UIFontTextStyleTitle1; const UIFontTextStyle kAuthenticationTextFontStyle = UIFontTextStyleSubheadline; -const int kAuthenticationHeaderBackgroundColor = 0xf8f9fa; const CGFloat kAuthenticationHorizontalMargin = 16.; const CGFloat kAuthenticationHeaderTitleMargin = 19.;
diff --git a/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm index 1589fc80..1894ddb 100644 --- a/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/chrome_signin_view_controller.mm
@@ -74,6 +74,11 @@ // Internal padding between the title and image in the "More" button. const CGFloat kMoreButtonPadding = 5.0f; +// The maximum size for th unified consent embedded view on regular width and +// regular height layout. +const CGFloat kUCEmbeddedViewMaxWidthForRegularLayout = 600; +const CGFloat kUCEmbeddedViewMaxHeightForRegularLayout = 600; + struct AuthenticationViewConstants { CGFloat PrimaryFontSize; CGFloat SecondaryFontSize; @@ -99,9 +104,9 @@ 1.5 * kCompactConstants.SecondaryFontSize, kCompactConstants.GradientHeight, 1.5 * kCompactConstants.ButtonHeight, - 32, - 32, - 32, + 32, // ButtonHorizontalPadding + 32, // ButtonTopPadding + 32, // ButtonBottomPadding }; enum AuthenticationState { @@ -395,22 +400,43 @@ } - (void)updateLayout { - AuthenticationViewConstants constants; - if ([self.traitCollection horizontalSizeClass] == - UIUserInterfaceSizeClassRegular) { - constants = kRegularConstants; - } else { - constants = kCompactConstants; - } + BOOL isRegularSizeClass = IsRegularXRegularSizeClass(self.traitCollection); + AuthenticationViewConstants constants = + isRegularSizeClass ? kRegularConstants : kCompactConstants; [self layoutButtons:constants]; + // Layout |_embeddedView|. CGSize viewSize = self.view.bounds.size; - CGFloat collectionViewHeight = - _primaryButton.frame.origin.y - constants.ButtonTopPadding; - CGRect collectionViewFrame = - CGRectMake(0, 0, viewSize.width, collectionViewHeight); - [_embeddedView setFrame:collectionViewFrame]; + CGPoint contentViewOrigin = CGPointZero; + CGSize collectionViewSize = + CGSizeMake(viewSize.width, + _primaryButton.frame.origin.y - constants.ButtonTopPadding); + if (_unifiedConsentEnabled) { + if (isRegularSizeClass && + !UIContentSizeCategoryIsAccessibilityCategory( + self.traitCollection.preferredContentSizeCategory)) { + // Constraint the size to (|kUCEmbeddedViewMaxWidthForRegularLayout| x + // |kUCEmbeddedViewMaxHeightForRegularLayout|) on regular layout. This is + // required to avoid having a lot of empty space between |_embeddedView| + // and the buttons. + if (collectionViewSize.width > kUCEmbeddedViewMaxWidthForRegularLayout) { + contentViewOrigin.x = floorf((collectionViewSize.width - + kUCEmbeddedViewMaxWidthForRegularLayout) / + 2); + collectionViewSize.width = kUCEmbeddedViewMaxWidthForRegularLayout; + } + if (collectionViewSize.height > + kUCEmbeddedViewMaxHeightForRegularLayout) { + contentViewOrigin.y = + floorf((collectionViewSize.height - + kUCEmbeddedViewMaxHeightForRegularLayout) / + 2); + collectionViewSize.height = kUCEmbeddedViewMaxHeightForRegularLayout; + } + } + } + [_embeddedView setFrame:CGRect{contentViewOrigin, collectionViewSize}]; // Layout the gradient view right above the buttons. CGFloat gradientOriginY = _primaryButton.frame.origin.y -
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@2x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@2x.png index 19284ca0..4e916741 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@2x.png +++ b/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@2x.png Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@3x.png b/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@3x.png index 63043401..57e2482 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@3x.png +++ b/ios/chrome/browser/ui/authentication/unified_consent/resources/unified_consent_header.imageset/unified_consent_header@3x.png Binary files differ
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm index e13d5b4..899f14b 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm
@@ -59,6 +59,12 @@ @property(nonatomic, strong) NSLayoutConstraint* noIdentityConstraint; // Constraint when identityPickerView is visible. @property(nonatomic, strong) NSLayoutConstraint* withIdentityConstraint; +// Constraint for the maximum height of the header view (also used to hide the +// the header view if needed). +@property(nonatomic, strong) NSLayoutConstraint* headerViewMaxHeightConstraint; +// Constraint for the proportiortional size of the header view. +@property(nonatomic, strong) + NSLayoutConstraint* headerViewProportionalHeightConstraint; // Settings link controller. @property(nonatomic, strong) LabelLinkController* settingsLinkController; // Label related to customize sync text. @@ -148,8 +154,6 @@ // areas (like the status bar). UIView* imageBackgroundView = [[UIView alloc] initWithFrame:CGRectZero]; imageBackgroundView.translatesAutoresizingMaskIntoConstraints = NO; - imageBackgroundView.backgroundColor = - UIColorFromRGB(kAuthenticationHeaderBackgroundColor); [container addSubview:imageBackgroundView]; // Header image. @@ -157,6 +161,7 @@ headerImageView.translatesAutoresizingMaskIntoConstraints = NO; headerImageView.image = [UIImage imageNamed:kAuthenticationHeaderImageName]; headerImageView.contentMode = UIViewContentModeScaleAspectFit; + headerImageView.clipsToBounds = YES; [container addSubview:headerImageView]; // Title. @@ -222,7 +227,6 @@ @"VSeparatorText" : @(kVerticalSeparatorTextMargin), @"VTextMargin" : @(kVerticalTextMargin), @"SeparatorHeight" : @(kAuthenticationSeparatorHeight), - @"HeaderHeight" : @(kAuthenticationHeaderImageHeight), @"HeaderTitleMargin" : @(kAuthenticationHeaderTitleMargin), }; NSArray* constraints = @[ @@ -242,14 +246,25 @@ @"V:[synctitle]-[syncsubtitle]-(VBetweenText)-[separator]", @"V:[separator]-(VSeparatorText)-[customizesync]-(VTextMargin)-|", // Size constraints. - @"V:[header(HeaderHeight)]", @"V:[separator(SeparatorHeight)]", ]; ApplyVisualConstraintsWithMetrics(constraints, views, metrics); - // Header image horizonatally centered. - [headerImageView.centerXAnchor - constraintEqualToAnchor:self.view.centerXAnchor] - .active = YES; + + // Adding constraints for header image. + AddSameCenterXConstraint(self.view, headerImageView); + // |headerView| fills 20% of |view|, capped at + // |kAuthenticationHeaderImageHeight|. + self.headerViewProportionalHeightConstraint = [headerImageView.heightAnchor + constraintEqualToAnchor:self.view.heightAnchor + multiplier:0.2]; + self.headerViewProportionalHeightConstraint.priority = + UILayoutPriorityDefaultHigh; + self.headerViewProportionalHeightConstraint.active = YES; + self.headerViewMaxHeightConstraint = [headerImageView.heightAnchor + constraintLessThanOrEqualToConstant:kAuthenticationHeaderImageHeight]; + self.headerViewMaxHeightConstraint.active = YES; + [self updateHeaderViewConstraints]; + // Adding constraints with or without identity. self.noIdentityConstraint = [syncTitleLabel.topAnchor constraintEqualToAnchor:title.bottomAnchor @@ -257,10 +272,12 @@ self.withIdentityConstraint = [syncTitleLabel.topAnchor constraintEqualToAnchor:self.identityPickerView.bottomAnchor constant:kVerticalTextMargin]; + // Adding constraints for the container. id<LayoutGuideProvider> safeArea = self.view.safeAreaLayoutGuide; [container.widthAnchor constraintEqualToAnchor:safeArea.widthAnchor].active = YES; + // Adding constraints for |imageBackgroundView|. AddSameCenterXConstraint(self.view, imageBackgroundView); [imageBackgroundView.widthAnchor @@ -289,7 +306,6 @@ [self.delegate unifiedConsentViewControllerViewDidAppear:self]; } -// Updates the scroll view content inset, used by pre iOS 11. - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator: (id<UIViewControllerTransitionCoordinator>)coordinator { @@ -302,6 +318,11 @@ completion:nil]; } +- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { + [super traitCollectionDidChange:previousTraitCollection]; + [self updateHeaderViewConstraints]; +} + - (void)didMoveToParentViewController:(UIViewController*)parent { if (!parent) return; @@ -400,6 +421,17 @@ } } +// Updates the header view constraints based on the height class traits of +// |view|. +- (void)updateHeaderViewConstraints { + if (IsCompactHeight(self)) { + self.headerViewMaxHeightConstraint.constant = 0; + } else { + self.headerViewMaxHeightConstraint.constant = + kAuthenticationHeaderImageHeight; + } +} + #pragma mark - UIScrollViewDelegate - (void)scrollViewDidScroll:(UIScrollView*)scrollView {
diff --git a/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.mm b/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.mm index 4d5cefd..51a0f4f4 100644 --- a/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.mm +++ b/ios/chrome/browser/ui/autofill/form_input_accessory_mediator.mm
@@ -546,7 +546,7 @@ - (void)passwordFetcher:(PasswordFetcher*)passwordFetcher didFetchPasswords: - (std::vector<std::unique_ptr<autofill::PasswordForm>>&)passwords { + (std::vector<std::unique_ptr<autofill::PasswordForm>>)passwords { self.consumer.passwordButtonHidden = passwords.empty(); }
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/password_mediator.mm b/ios/chrome/browser/ui/autofill/manual_fill/password_mediator.mm index eeb72d83..b80db987 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/password_mediator.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/password_mediator.mm
@@ -111,13 +111,12 @@ - (void)passwordFetcher:(PasswordFetcher*)passwordFetcher didFetchPasswords: - (std::vector<std::unique_ptr<autofill::PasswordForm>>&)passwords { + (std::vector<std::unique_ptr<autofill::PasswordForm>>)passwords { NSMutableArray<ManualFillCredential*>* credentials = [[NSMutableArray alloc] initWithCapacity:passwords.size()]; - for (auto it = passwords.begin(); it != passwords.end(); ++it) { - autofill::PasswordForm& form = **it; + for (const auto& form : passwords) { ManualFillCredential* credential = - [[ManualFillCredential alloc] initWithPasswordForm:form]; + [[ManualFillCredential alloc] initWithPasswordForm:*form]; [credentials addObject:credential]; } self.credentials = credentials;
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/password_view_controller_egtest.mm b/ios/chrome/browser/ui/autofill/manual_fill/password_view_controller_egtest.mm index 15c1e9b..a6d16a1b 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/password_view_controller_egtest.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/password_view_controller_egtest.mm
@@ -136,18 +136,12 @@ const std::vector<autofill::PasswordForm>& GetStoreResults() { results_.clear(); ResetObtained(); - GetPasswordStore()->GetAutofillableLogins(this); + GetPasswordStore()->GetAllLogins(this); bool responded = base::test::ios::WaitUntilConditionOrTimeout(1.0, ^bool { return !AreObtainedReset(); }); GREYAssert(responded, @"Obtaining fillable items took too long."); AppendObtainedToResults(); - GetPasswordStore()->GetBlacklistLogins(this); - responded = base::test::ios::WaitUntilConditionOrTimeout(1.0, ^bool { - return !AreObtainedReset(); - }); - GREYAssert(responded, @"Obtaining blacklisted items took too long."); - AppendObtainedToResults(); return results_; }
diff --git a/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_row_cell.mm b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_row_cell.mm index 98ef1a48..2cb3127 100644 --- a/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_row_cell.mm +++ b/ios/chrome/browser/ui/omnibox/popup/omnibox_popup_row_cell.mm
@@ -20,7 +20,7 @@ #endif namespace { -const CGFloat kLeadingMargin = 24; +const CGFloat kLeadingMargin = 12; const CGFloat kLeadingMarginIpad = 183; const CGFloat kTextTopMargin = 6; const CGFloat kTextLeadingMargin = 10; @@ -29,9 +29,6 @@ const CGFloat kImageViewCornerRadius = 7; const CGFloat kTrailingButtonSize = 48; const CGFloat kTrailingButtonTrailingMargin = 4; -const CGFloat kAnswerImageSize = 30; -const CGFloat kAnswerImageLeadingMargin = -1; -const CGFloat kAnswerImageViewTopMargin = 2; NSString* const kOmniboxPopupRowSwitchTabAccessibilityIdentifier = @"OmniboxPopupRowSwitchTabAccessibilityIdentifier"; @@ -44,6 +41,8 @@ // Whether the cell is currently dispalying in incognito mode or not. @property(nonatomic, assign) BOOL incognito; +// Stack view containing all text labels. +@property(nonatomic, strong) UIStackView* textStackView; // Truncating label for the main text. @property(nonatomic, strong) OmniboxPopupTruncatingLabel* textTruncatingLabel; // Truncating label for the detail text. @@ -52,14 +51,10 @@ // Answers have slightly different display requirements, like possibility of // multiple lines and truncating with ellipses instead of a fade gradient. @property(nonatomic, strong) UILabel* detailAnswerLabel; -// Image view for the image in an answer (e.g. weather image). -@property(nonatomic, strong) UIImageView* detailAnswerImageView; // Image view for the leading image (only appears on iPad). @property(nonatomic, strong) UIImageView* leadingImageView; // Trailing button for appending suggestion into omnibox. @property(nonatomic, strong) UIButton* trailingButton; -// Layout guide encapsulating everything related to the detail section. -@property(nonatomic, strong) UILayoutGuide* detailLayoutGuide; @end @@ -72,28 +67,24 @@ _textTruncatingLabel = [[OmniboxPopupTruncatingLabel alloc] initWithFrame:CGRectZero]; _textTruncatingLabel.translatesAutoresizingMaskIntoConstraints = NO; - _textTruncatingLabel.userInteractionEnabled = NO; + + _textStackView = [[UIStackView alloc] + initWithArrangedSubviews:@[ _textTruncatingLabel ]]; + _textStackView.translatesAutoresizingMaskIntoConstraints = NO; + _textStackView.axis = UILayoutConstraintAxisVertical; _detailTruncatingLabel = [[OmniboxPopupTruncatingLabel alloc] initWithFrame:CGRectZero]; _detailTruncatingLabel.translatesAutoresizingMaskIntoConstraints = NO; - _detailTruncatingLabel.userInteractionEnabled = NO; // Answers use a UILabel with NSLineBreakByTruncatingTail to produce a // truncation with an ellipse instead of fading on multi-line text. _detailAnswerLabel = [[UILabel alloc] initWithFrame:CGRectZero]; _detailAnswerLabel.translatesAutoresizingMaskIntoConstraints = NO; - _detailAnswerLabel.userInteractionEnabled = NO; _detailAnswerLabel.lineBreakMode = NSLineBreakByTruncatingTail; - _detailAnswerImageView = [[UIImageView alloc] initWithImage:nil]; - _detailAnswerImageView.translatesAutoresizingMaskIntoConstraints = NO; - _detailAnswerImageView.userInteractionEnabled = NO; - _detailAnswerImageView.contentMode = UIViewContentModeScaleAspectFit; - _leadingImageView = [[UIImageView alloc] initWithImage:nil]; _leadingImageView.translatesAutoresizingMaskIntoConstraints = NO; - _leadingImageView.userInteractionEnabled = NO; _leadingImageView.contentMode = UIViewContentModeCenter; _leadingImageView.layer.cornerRadius = kImageViewCornerRadius; @@ -103,8 +94,10 @@ action:@selector(trailingButtonTapped) forControlEvents:UIControlEventTouchUpInside]; [_trailingButton setContentMode:UIViewContentModeRight]; + // The trailing button also shows answer images. In that case, the + // button will be disabled, but the image shouldn't be dimmed. + _trailingButton.adjustsImageWhenDisabled = NO; - _detailLayoutGuide = [[UILayoutGuide alloc] init]; _incognito = NO; self.backgroundColor = [UIColor clearColor]; @@ -117,77 +110,41 @@ // Setup the layout of the cell initially. This only adds the elements that are // always in the cell. - (void)setupLayout { - [self.contentView addSubview:self.textTruncatingLabel]; - [self.contentView addSubview:self.detailTruncatingLabel]; - [self.contentView addSubview:self.detailAnswerLabel]; - [self.contentView addLayoutGuide:self.detailLayoutGuide]; + [self.contentView addSubview:self.leadingImageView]; + [self.contentView addSubview:self.textStackView]; [NSLayoutConstraint activateConstraints:@[ - // Use greater/less than or equal constraints to allow for when any optional - // elements are added (leadingImageView, trailingButton, etc.) + // Row has a minimum height. + [self.contentView.heightAnchor constraintGreaterThanOrEqualToConstant:48], - // Position textTruncatingLabel - [self.textTruncatingLabel.leadingAnchor - constraintGreaterThanOrEqualToAnchor:self.contentView.leadingAnchor - constant:kLeadingMargin], + // Position leadingImageView at the leading edge of the view + [self.leadingImageView.heightAnchor + constraintEqualToConstant:kImageViewSize], + [self.leadingImageView.widthAnchor + constraintEqualToConstant:kImageViewSize], + [self.leadingImageView.leadingAnchor + constraintEqualToAnchor:self.contentView.leadingAnchor + constant:IsRegularXRegularSizeClass() + ? kLeadingMarginIpad + : kLeadingMargin], + [self.leadingImageView.centerYAnchor + constraintEqualToAnchor:self.contentView.centerYAnchor], + + // Position textStackView after leadingImageView. + [self.textStackView.leadingAnchor + constraintEqualToAnchor:self.leadingImageView.trailingAnchor + constant:kTextLeadingMargin], + // Use greater than or equal constraints because there may be a trailing + // button here. [self.contentView.trailingAnchor - constraintGreaterThanOrEqualToAnchor:self.textTruncatingLabel - .trailingAnchor], - [self.textTruncatingLabel.topAnchor - constraintEqualToAnchor:self.contentView.topAnchor - constant:kTextTopMargin], - - // Position detailLayoutGuide - [self.detailLayoutGuide.leadingAnchor - constraintGreaterThanOrEqualToAnchor:self.contentView.leadingAnchor - constant:kLeadingMargin], - [self.contentView.trailingAnchor - constraintGreaterThanOrEqualToAnchor:self.detailLayoutGuide - .trailingAnchor], - [self.detailLayoutGuide.topAnchor - constraintEqualToAnchor:self.textTruncatingLabel.bottomAnchor], - [self.detailLayoutGuide.bottomAnchor - constraintEqualToAnchor:self.contentView.bottomAnchor], - - // Position detailTruncatingLabel in detailLayoutGuide. - [self.detailTruncatingLabel.leadingAnchor - constraintGreaterThanOrEqualToAnchor:self.detailLayoutGuide - .leadingAnchor], - [self.detailTruncatingLabel.trailingAnchor - constraintEqualToAnchor:self.detailLayoutGuide.trailingAnchor], - [self.detailTruncatingLabel.topAnchor - constraintEqualToAnchor:self.detailLayoutGuide.topAnchor], - [self.detailTruncatingLabel.bottomAnchor - constraintEqualToAnchor:self.detailLayoutGuide.bottomAnchor], - - // Position detailAnswerLabel exactly equal to detailTruncatingLabel. - [self.detailAnswerLabel.topAnchor - constraintEqualToAnchor:self.detailTruncatingLabel.topAnchor], - [self.detailAnswerLabel.bottomAnchor - constraintEqualToAnchor:self.detailTruncatingLabel.bottomAnchor], - [self.detailAnswerLabel.leadingAnchor - constraintEqualToAnchor:self.detailTruncatingLabel.leadingAnchor], - [self.detailAnswerLabel.trailingAnchor - constraintEqualToAnchor:self.detailTruncatingLabel.trailingAnchor], - ]]; - - // To prevent ambiguity when there is no leading image view, add a - // non-required leading space 0 constraint to force the "Greater than or - // equal" to become as small as possible. - NSLayoutConstraint* textConstraint = [self.textTruncatingLabel.leadingAnchor - constraintEqualToAnchor:self.contentView.leadingAnchor]; - textConstraint.priority = UILayoutPriorityDefaultHigh; - - NSLayoutConstraint* detailConstraint = [self.detailLayoutGuide.leadingAnchor - constraintEqualToAnchor:self.contentView.leadingAnchor]; - detailConstraint.priority = UILayoutPriorityDefaultHigh; - - NSLayoutConstraint* detailTextConstraint = - [self.detailTruncatingLabel.leadingAnchor - constraintEqualToAnchor:self.self.detailLayoutGuide.leadingAnchor]; - detailTextConstraint.priority = UILayoutPriorityDefaultHigh; - [NSLayoutConstraint activateConstraints:@[ - textConstraint, detailConstraint, detailTextConstraint + constraintGreaterThanOrEqualToAnchor:self.textStackView.trailingAnchor], + // Top space should be at least the given top margin, but can be more if + // the row is short enough to use the minimum height constraint above. + [self.textStackView.topAnchor + constraintGreaterThanOrEqualToAnchor:self.contentView.topAnchor + constant:kTextTopMargin], + [self.textStackView.centerYAnchor + constraintEqualToAnchor:self.contentView.centerYAnchor], ]]; } @@ -205,52 +162,8 @@ constraintEqualToAnchor:self.trailingButton.trailingAnchor constant:kTrailingButtonTrailingMargin], [self.trailingButton.leadingAnchor - constraintEqualToAnchor:self.textTruncatingLabel.trailingAnchor + constraintEqualToAnchor:self.textStackView.trailingAnchor constant:kTextTrailingMargin], - [self.trailingButton.leadingAnchor - constraintEqualToAnchor:self.detailLayoutGuide.trailingAnchor - constant:kTextTrailingMargin], - ]]; -} - -// Add the leading image view as a subview and setup its constraints. -- (void)setupLeadingImageViewLayout { - [self.contentView addSubview:self.leadingImageView]; - [NSLayoutConstraint activateConstraints:@[ - [self.leadingImageView.heightAnchor - constraintEqualToConstant:kImageViewSize], - [self.leadingImageView.widthAnchor - constraintEqualToConstant:kImageViewSize], - [self.leadingImageView.centerYAnchor - constraintEqualToAnchor:self.contentView.centerYAnchor], - [self.leadingImageView.leadingAnchor - constraintEqualToAnchor:self.contentView.leadingAnchor - constant:kLeadingMarginIpad], - [self.textTruncatingLabel.leadingAnchor - constraintEqualToAnchor:self.leadingImageView.trailingAnchor - constant:kTextLeadingMargin], - [self.detailLayoutGuide.leadingAnchor - constraintEqualToAnchor:self.leadingImageView.trailingAnchor - constant:kTextLeadingMargin], - ]]; -} - -// Add the detail answer image view as a subview and setup its constraints. -- (void)setupDetailAnswerImageViewLayout { - [self.contentView addSubview:self.detailAnswerImageView]; - [NSLayoutConstraint activateConstraints:@[ - [self.detailAnswerImageView.heightAnchor - constraintEqualToConstant:kAnswerImageSize], - [self.detailAnswerImageView.widthAnchor - constraintEqualToConstant:kAnswerImageSize], - [self.detailAnswerImageView.leadingAnchor - constraintEqualToAnchor:self.detailLayoutGuide.leadingAnchor - constant:kAnswerImageLeadingMargin], - [self.detailAnswerImageView.topAnchor - constraintEqualToAnchor:self.detailLayoutGuide.topAnchor - constant:kAnswerImageViewTopMargin], - [self.detailAnswerImageView.trailingAnchor - constraintEqualToAnchor:self.detailTruncatingLabel.leadingAnchor], ]]; } @@ -260,10 +173,16 @@ self.suggestion = nil; self.incognito = NO; - // Remove optional views + // Clear text. + self.textTruncatingLabel.attributedText = nil; + self.detailTruncatingLabel.attributedText = nil; + self.detailAnswerLabel.attributedText = nil; + + // Remove optional views. + [self.trailingButton setImage:nil forState:UIControlStateNormal]; [self.trailingButton removeFromSuperview]; - [self.leadingImageView removeFromSuperview]; - [self.detailAnswerImageView removeFromSuperview]; + [self.detailTruncatingLabel removeFromSuperview]; + [self.detailAnswerLabel removeFromSuperview]; self.trailingButton.accessibilityIdentifier = nil; @@ -285,82 +204,89 @@ self.textTruncatingLabel.attributedText = self.suggestion.text; - self.detailAnswerLabel.hidden = !self.suggestion.hasAnswer; - self.detailTruncatingLabel.hidden = self.suggestion.hasAnswer; // URLs have have special layout requirements. self.detailTruncatingLabel.displayAsURL = suggestion.isURL; UILabel* detailLabel = self.suggestion.hasAnswer ? self.detailAnswerLabel : self.detailTruncatingLabel; - detailLabel.attributedText = self.suggestion.detailText; - if (self.suggestion.hasAnswer) { - detailLabel.numberOfLines = self.suggestion.numberOfLines; + if ([self.suggestion.detailText length] > 0) { + [self.textStackView addArrangedSubview:detailLabel]; + detailLabel.attributedText = self.suggestion.detailText; + if (self.suggestion.hasAnswer) { + detailLabel.numberOfLines = self.suggestion.numberOfLines; + } } - // Show append button for search history/search suggestions as the right - // control element (aka an accessory element of a table view cell). - if (self.suggestion.isAppendable || self.suggestion.isTabMatch) { - [self setupTrailingButtonLayout]; + if (self.suggestion.hasImage || self.suggestion.isAppendable || + self.suggestion.isTabMatch) { + [self setupTrailingButton]; + } - NSString* trailingButtonActionName = - suggestion.isTabMatch - ? l10n_util::GetNSString(IDS_IOS_OMNIBOX_POPUP_SWITCH_TO_OPEN_TAB) - : l10n_util::GetNSString(IDS_IOS_OMNIBOX_POPUP_APPEND); - UIAccessibilityCustomAction* trailingButtonAction = - [[UIAccessibilityCustomAction alloc] - initWithName:trailingButtonActionName - target:self - selector:@selector(trailingButtonTapped)]; + self.leadingImageView.image = self.suggestion.suggestionTypeIcon; + self.leadingImageView.backgroundColor = + self.incognito ? [UIColor colorWithWhite:1 alpha:0.05] + : [UIColor colorWithWhite:0 alpha:0.03]; + self.leadingImageView.tintColor = self.incognito + ? [UIColor colorWithWhite:1 alpha:0.4] + : [UIColor colorWithWhite:0 alpha:0.33]; +} - self.accessibilityCustomActions = @[ trailingButtonAction ]; +- (void)setupTrailingButton { + [self setupTrailingButtonLayout]; - UIImage* trailingButtonImage = nil; - if (self.suggestion.isTabMatch) { - trailingButtonImage = [UIImage imageNamed:@"omnibox_popup_tab_match"]; - trailingButtonImage = - trailingButtonImage.imageFlippedForRightToLeftLayoutDirection; - self.trailingButton.accessibilityIdentifier = - kOmniboxPopupRowSwitchTabAccessibilityIdentifier; - } else { - int trailingButtonResourceID = 0; - if (base::FeatureList::IsEnabled(omnibox::kOmniboxTabSwitchSuggestions)) { - trailingButtonResourceID = IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND; - } else { - trailingButtonResourceID = - self.incognito ? IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO - : IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND; - } - trailingButtonImage = - NativeReversableImage(trailingButtonResourceID, YES); - } - trailingButtonImage = [trailingButtonImage - imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + // If there's an image, put it in the button, but disable interaction. + if (self.suggestion.hasImage) { + self.trailingButton.enabled = NO; + [self.trailingButton setImage:nil forState:UIControlStateNormal]; + return; + } - [self.trailingButton setImage:trailingButtonImage - forState:UIControlStateNormal]; + // Show append button for search history/search suggestions or + // switch-to-open-tab as the right control element (aka an accessory element + // of a table view cell). + NSString* trailingButtonActionName = + self.suggestion.isTabMatch + ? l10n_util::GetNSString(IDS_IOS_OMNIBOX_POPUP_SWITCH_TO_OPEN_TAB) + : l10n_util::GetNSString(IDS_IOS_OMNIBOX_POPUP_APPEND); + UIAccessibilityCustomAction* trailingButtonAction = + [[UIAccessibilityCustomAction alloc] + initWithName:trailingButtonActionName + target:self + selector:@selector(trailingButtonTapped)]; + + self.accessibilityCustomActions = @[ trailingButtonAction ]; + + UIImage* trailingButtonImage = nil; + if (self.suggestion.isTabMatch) { + trailingButtonImage = [UIImage imageNamed:@"omnibox_popup_tab_match"]; + trailingButtonImage = + trailingButtonImage.imageFlippedForRightToLeftLayoutDirection; + self.trailingButton.accessibilityIdentifier = + kOmniboxPopupRowSwitchTabAccessibilityIdentifier; + } else { + int trailingButtonResourceID = 0; if (base::FeatureList::IsEnabled(omnibox::kOmniboxTabSwitchSuggestions)) { - self.trailingButton.tintColor = - self.incognito ? [UIColor whiteColor] - : UIColorFromRGB(kLocationBarTintBlue); + trailingButtonResourceID = IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND; } else { - self.trailingButton.tintColor = - self.incognito ? [UIColor colorWithWhite:1 alpha:0.5] - : [UIColor colorWithWhite:0 alpha:0.3]; + trailingButtonResourceID = + self.incognito ? IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND_INCOGNITO + : IDR_IOS_OMNIBOX_KEYBOARD_VIEW_APPEND; } + trailingButtonImage = NativeReversableImage(trailingButtonResourceID, YES); } + trailingButtonImage = [trailingButtonImage + imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; - if ([self showsLeadingIcons]) { - self.leadingImageView.image = self.suggestion.suggestionTypeIcon; - self.leadingImageView.backgroundColor = - self.incognito ? [UIColor colorWithWhite:1 alpha:0.05] - : [UIColor colorWithWhite:0 alpha:0.03]; - self.leadingImageView.tintColor = - self.incognito ? [UIColor colorWithWhite:1 alpha:0.4] - : [UIColor colorWithWhite:0 alpha:0.33]; - [self setupLeadingImageViewLayout]; - } - - if (suggestion.hasImage) { - [self setupDetailAnswerImageViewLayout]; + self.trailingButton.enabled = YES; + [self.trailingButton setImage:trailingButtonImage + forState:UIControlStateNormal]; + if (base::FeatureList::IsEnabled(omnibox::kOmniboxTabSwitchSuggestions)) { + self.trailingButton.tintColor = self.incognito + ? [UIColor whiteColor] + : UIColorFromRGB(kLocationBarTintBlue); + } else { + self.trailingButton.tintColor = self.incognito + ? [UIColor colorWithWhite:1 alpha:0.5] + : [UIColor colorWithWhite:0 alpha:0.3]; } } @@ -374,10 +300,6 @@ : self.detailTruncatingLabel.attributedText.string; } -- (BOOL)showsLeadingIcons { - return IsRegularXRegularSizeClass(); -} - - (void)trailingButtonTapped { [self.delegate trailingButtonTappedForCell:self]; }
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm index f692c7e..1965c3b 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm
@@ -455,6 +455,28 @@ [self accessibilityIdentifierFromItemType:itemType]; tableViewClearDataItem.dataTypeMask = mask; tableViewClearDataItem.prefName = prefName; + if (IsNewClearBrowsingDataUIEnabled()) { + if (itemType == ItemTypeDataTypeCookiesSiteData) { + // Because there is no counter for cookies, an explanatory text is + // displayed. + tableViewClearDataItem.detailText = + l10n_util::GetNSString(IDS_DEL_COOKIES_COUNTER); + } else { + __weak ClearBrowsingDataManager* weakSelf = self; + __weak TableViewClearBrowsingDataItem* weakTableClearDataItem = + tableViewClearDataItem; + std::unique_ptr<BrowsingDataCounterWrapper> counter = + BrowsingDataCounterWrapper::CreateCounterWrapper( + prefName, self.browserState, prefs, + base::BindRepeating(^( + const browsing_data::BrowsingDataCounter::Result& result) { + weakTableClearDataItem.detailText = + [weakSelf counterTextFromResult:result]; + [weakSelf.consumer updateCellsForItem:weakTableClearDataItem]; + })); + _countersByMasks.emplace(mask, std::move(counter)); + } + } clearDataItem = tableViewClearDataItem; } return clearDataItem;
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm index 0a4354d..c947fe5a 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_table_view_controller.mm
@@ -159,7 +159,7 @@ - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - + [self.dataManager restartCounters:BrowsingDataRemoveMask::REMOVE_ALL]; if (IsNewClearBrowsingDataUIEnabled()) { // Showing toolbar here because parent class hides toolbar in // viewWillDisappear:.
diff --git a/ios/chrome/browser/ui/settings/google_services/BUILD.gn b/ios/chrome/browser/ui/settings/google_services/BUILD.gn index dc1f49c..1a1cc0b 100644 --- a/ios/chrome/browser/ui/settings/google_services/BUILD.gn +++ b/ios/chrome/browser/ui/settings/google_services/BUILD.gn
@@ -19,6 +19,7 @@ "google_services_settings_coordinator.mm", "google_services_settings_mediator.h", "google_services_settings_mediator.mm", + "google_services_settings_mode.h", "google_services_settings_service_delegate.h", "google_services_settings_view_controller.h", "google_services_settings_view_controller.mm",
diff --git a/ios/chrome/browser/ui/settings/google_services/advanced_signin_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/advanced_signin_settings_coordinator.mm index 1b3ec75..c947b73 100644 --- a/ios/chrome/browser/ui/settings/google_services/advanced_signin_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/advanced_signin_settings_coordinator.mm
@@ -48,7 +48,9 @@ self.googleServicesSettingsCoordinator = [[GoogleServicesSettingsCoordinator alloc] initWithBaseViewController:self.advancedSigninSettingsNavigationController - browserState:self.browserState]; + browserState:self.browserState + mode: + GoogleServicesSettingsModeAdvancedSigninSettings]; self.googleServicesSettingsCoordinator.navigationController = self.advancedSigninSettingsNavigationController; [self.googleServicesSettingsCoordinator start];
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_navigation_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/google_services_navigation_coordinator.mm index 7ac6853..1ac17ff8 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_navigation_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_navigation_coordinator.mm
@@ -8,6 +8,7 @@ #include "components/strings/grit/components_strings.h" #import "ios/chrome/browser/ui/icons/chrome_icon.h" #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.h" +#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_mode.h" #include "ui/base/l10n/l10n_util_mac.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -36,7 +37,8 @@ self.googleServicesSettingsCoordinator = [[GoogleServicesSettingsCoordinator alloc] initWithBaseViewController:self.navigationController - browserState:self.browserState]; + browserState:self.browserState + mode:GoogleServicesSettingsModeSettings]; self.googleServicesSettingsCoordinator.navigationController = self.navigationController; [self.googleServicesSettingsCoordinator start];
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.h b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.h index 64733f1..e6a63b6 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.h +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.h
@@ -6,6 +6,7 @@ #define IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_GOOGLE_SERVICES_SETTINGS_COORDINATOR_H_ #import "ios/chrome/browser/ui/coordinators/chrome_coordinator.h" +#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_mode.h" @protocol ApplicationCommands; @class GoogleServicesSettingsCoordinator; @@ -30,6 +31,25 @@ // Global dispatcher. @property(nonatomic, weak) id<ApplicationCommands> dispatcher; +- (instancetype)initWithBaseViewController:(UIViewController*)viewController + NS_UNAVAILABLE; +- (instancetype)initWithBaseViewController:(UIViewController*)viewController + browserState: + (ios::ChromeBrowserState*)browserState + NS_UNAVAILABLE; +- (instancetype)initWithBaseViewController:(UIViewController*)viewController + browser:(Browser*)browser NS_UNAVAILABLE; + +// Designated initializer. +// |viewController|: navigation controller. +// |browserState|: browser state. +// |mode|: mode to display the Google services settings. +- (instancetype)initWithBaseViewController:(UIViewController*)viewController + browserState: + (ios::ChromeBrowserState*)browserState + mode:(GoogleServicesSettingsMode)mode + NS_DESIGNATED_INITIALIZER; + @end #endif // IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_GOOGLE_SERVICES_SETTINGS_COORDINATOR_H_
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm index 837decba..acdad9b4 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm
@@ -31,6 +31,8 @@ GoogleServicesSettingsViewControllerPresentationDelegate, ManageSyncSettingsCoordinatorDelegate> +// Google services settings mode. +@property(nonatomic, assign, readonly) GoogleServicesSettingsMode mode; // Google services settings mediator. @property(nonatomic, strong) GoogleServicesSettingsMediator* mediator; // Returns the authentication service. @@ -52,6 +54,17 @@ @implementation GoogleServicesSettingsCoordinator +- (instancetype)initWithBaseViewController:(UIViewController*)viewController + browserState: + (ios::ChromeBrowserState*)browserState + mode:(GoogleServicesSettingsMode)mode { + if ([super initWithBaseViewController:viewController + browserState:browserState]) { + _mode = mode; + } + return self; +} + - (void)start { UITableViewStyle style = base::FeatureList::IsEnabled(kSettingsRefresh) ? UITableViewStylePlain @@ -68,7 +81,8 @@ self.mediator = [[GoogleServicesSettingsMediator alloc] initWithUserPrefService:self.browserState->GetPrefs() localPrefService:GetApplicationContext()->GetLocalState() - syncSetupService:syncSetupService]; + syncSetupService:syncSetupService + mode:self.mode]; self.mediator.consumer = viewController; self.mediator.authService = self.authService; self.mediator.identityManager =
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.h b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.h index ba35981..eabd0aa 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.h +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.h
@@ -8,6 +8,7 @@ #import <UIKit/UIKit.h> #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_consumer.h" +#import "ios/chrome/browser/ui/settings/google_services/google_services_settings_mode.h" #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_service_delegate.h" #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller.h" #import "ios/chrome/browser/ui/settings/google_services/google_services_settings_view_controller_model_delegate.h" @@ -31,6 +32,8 @@ : NSObject <GoogleServicesSettingsServiceDelegate, GoogleServicesSettingsViewControllerModelDelegate> +// Google services settings mode. +@property(nonatomic, assign, readonly) GoogleServicesSettingsMode mode; // View controller. @property(nonatomic, weak) id<GoogleServicesSettingsConsumer> consumer; // Authentication service. @@ -47,9 +50,11 @@ // |userPrefService|: preference service from the browser state. // |localPrefService|: preference service from the application context. // |syncSetupService|: allows configuring sync. +// |mode|: mode to display the Google services settings. - (instancetype)initWithUserPrefService:(PrefService*)userPrefService localPrefService:(PrefService*)localPrefService syncSetupService:(SyncSetupService*)syncSetupService + mode:(GoogleServicesSettingsMode)mode NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE;
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm index 83fe7d2..99d6303 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm
@@ -143,12 +143,14 @@ - (instancetype)initWithUserPrefService:(PrefService*)userPrefService localPrefService:(PrefService*)localPrefService - syncSetupService:(SyncSetupService*)syncSetupService { + syncSetupService:(SyncSetupService*)syncSetupService + mode:(GoogleServicesSettingsMode)mode { self = [super init]; if (self) { DCHECK(userPrefService); DCHECK(localPrefService); DCHECK(syncSetupService); + _mode = mode; _syncSetupService = syncSetupService; _autocompleteSearchPreference = [[PrefBackedBoolean alloc] initWithPrefService:userPrefService @@ -189,7 +191,12 @@ DCHECK(!self.accountItem); self.accountItem = [[TableViewAccountItem alloc] initWithType:IdentityItemType]; - self.accountItem.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + if (self.mode == GoogleServicesSettingsModeAdvancedSigninSettings) { + self.accountItem.mode = TableViewAccountModeNonTappable; + } else { + self.accountItem.accessoryType = + UITableViewCellAccessoryDisclosureIndicator; + } [model addItem:self.accountItem toSectionWithIdentifier:IdentitySectionIdentifier]; }
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_mode.h b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mode.h new file mode 100644 index 0000000..7676dd9 --- /dev/null +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mode.h
@@ -0,0 +1,19 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_GOOGLE_SERVICES_SETTINGS_MODE_H_ +#define IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_GOOGLE_SERVICES_SETTINGS_MODE_H_ + +#import <Foundation/Foundation.h> + +// Configures Google services settings UI according to the context when it is +// used. +typedef NS_ENUM(NSInteger, GoogleServicesSettingsMode) { + // Show the Google services settings without being able to log-out. + GoogleServicesSettingsModeAdvancedSigninSettings, + // Show the regular Google services settings. + GoogleServicesSettingsModeSettings, +}; + +#endif // IOS_CHROME_BROWSER_UI_SETTINGS_GOOGLE_SERVICES_GOOGLE_SERVICES_SETTINGS_MODE_H_
diff --git a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm index 24746c321..4376744 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_settings_egtest.mm
@@ -287,18 +287,12 @@ const std::vector<autofill::PasswordForm>& GetStoreResults() { results_.clear(); ResetObtained(); - GetPasswordStore()->GetAutofillableLogins(this); - bool responded = base::test::ios::WaitUntilConditionOrTimeout(1.0, ^bool { + GetPasswordStore()->GetAllLogins(this); + bool responded = base::test::ios::WaitUntilConditionOrTimeout(2.0, ^bool { return !AreObtainedReset(); }); GREYAssert(responded, @"Obtaining fillable items took too long."); AppendObtainedToResults(); - GetPasswordStore()->GetBlacklistLogins(this); - responded = base::test::ios::WaitUntilConditionOrTimeout(2.0, ^bool { - return !AreObtainedReset(); - }); - GREYAssert(responded, @"Obtaining blacklisted items took too long."); - AppendObtainedToResults(); return results_; }
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm index 1c19f5b2..85fa39a 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller.mm
@@ -170,9 +170,6 @@ // A helper object for passing data about saved passwords from a finished // password store request to the PasswordsTableViewController. std::unique_ptr<ios::SavePasswordsConsumer> savedPasswordsConsumer_; - // A helper object for passing data about blacklisted sites from a finished - // password store request to the PasswordsTableViewController. - std::unique_ptr<ios::SavePasswordsConsumer> blacklistPasswordsConsumer_; // The list of the user's saved passwords. std::vector<std::unique_ptr<autofill::PasswordForm>> savedForms_; // The list of the user's blacklisted sites. @@ -501,13 +498,11 @@ #pragma mark - SavePasswordsConsumerDelegate - (void)onGetPasswordStoreResults: - (std::vector<std::unique_ptr<autofill::PasswordForm>>&)result { - if (result.empty()) { + (std::vector<std::unique_ptr<autofill::PasswordForm>>)results { + if (results.empty()) { return; } - for (auto it = result.begin(); it != result.end(); ++it) { - // PasswordForm is needed when user wants to delete the site/password. - auto form = std::make_unique<autofill::PasswordForm>(**it); + for (auto& form : results) { if (form->blacklisted_by_user) blacklistedForms_.push_back(std::move(form)); else @@ -718,9 +713,7 @@ // Starts requests for saved and blacklisted passwords to the store. - (void)getLoginsFromPasswordStore { savedPasswordsConsumer_.reset(new ios::SavePasswordsConsumer(self)); - passwordStore_->GetAutofillableLogins(savedPasswordsConsumer_.get()); - blacklistPasswordsConsumer_.reset(new ios::SavePasswordsConsumer(self)); - passwordStore_->GetBlacklistLogins(blacklistPasswordsConsumer_.get()); + passwordStore_->GetAllLogins(savedPasswordsConsumer_.get()); } - (void)updateExportPasswordsButton {
diff --git a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm index 45754c29..13da8c07 100644 --- a/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/password/passwords_table_view_controller_unittest.mm
@@ -81,7 +81,7 @@ static_cast<PasswordsTableViewController*>(controller()); std::vector<std::unique_ptr<autofill::PasswordForm>> passwords; passwords.push_back(std::move(form)); - [passwords_controller onGetPasswordStoreResults:passwords]; + [passwords_controller onGetPasswordStoreResults:std::move(passwords)]; } // Creates and adds a saved password form.
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm index 094b3b4..ebcd5e27 100644 --- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
@@ -388,7 +388,8 @@ self.googleServicesSettingsCoordinator = [[GoogleServicesSettingsCoordinator alloc] initWithBaseViewController:self - browserState:mainBrowserState_]; + browserState:mainBrowserState_ + mode:GoogleServicesSettingsModeSettings]; self.googleServicesSettingsCoordinator.dispatcher = [delegate_ dispatcherForSettings]; self.googleServicesSettingsCoordinator.navigationController = self;
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index 99e69743..40cc072a 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -946,7 +946,8 @@ _googleServicesSettingsCoordinator = [[GoogleServicesSettingsCoordinator alloc] initWithBaseViewController:self.navigationController - browserState:_browserState]; + browserState:_browserState + mode:GoogleServicesSettingsModeSettings]; _googleServicesSettingsCoordinator.dispatcher = self.dispatcher; _googleServicesSettingsCoordinator.navigationController = self.navigationController;
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm index 57cacfdd..bfff3d3 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm
@@ -8,10 +8,10 @@ #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/google/core/common/google_util.h" #include "components/strings/grit/components_strings.h" #include "components/sync/base/sync_prefs.h" +#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" #include "ios/chrome/browser/application_context.h"
diff --git a/ios/chrome/browser/ui/ui_feature_flags.cc b/ios/chrome/browser/ui/ui_feature_flags.cc index 5763592..2b4c3a0 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.cc +++ b/ios/chrome/browser/ui/ui_feature_flags.cc
@@ -31,3 +31,6 @@ const base::Feature kDisplaySearchEngineFavicon{ "DisplaySearchEngineFavicon", base::FEATURE_DISABLED_BY_DEFAULT}; + +const base::Feature kNewOmniboxPopupLayout{"NewOmniboxPopupLayout", + base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/ios/chrome/browser/ui/ui_feature_flags.h b/ios/chrome/browser/ui/ui_feature_flags.h index fe54cc1..883336831 100644 --- a/ios/chrome/browser/ui/ui_feature_flags.h +++ b/ios/chrome/browser/ui/ui_feature_flags.h
@@ -35,4 +35,8 @@ // Feature to display search engine favicons in Settings. extern const base::Feature kDisplaySearchEngineFavicon; +// Feature to display the new omnibox popup design with favicons, search engine +// favicon in the omnibox, rich entities support, new layout. +extern const base::Feature kNewOmniboxPopupLayout; + #endif // IOS_CHROME_BROWSER_UI_UI_FEATURE_FLAGS_H_
diff --git a/ios/web/features.mm b/ios/web/features.mm index 35a56747..1045776 100644 --- a/ios/web/features.mm +++ b/ios/web/features.mm
@@ -8,11 +8,6 @@ namespace features { bool StorePendingItemInContext() { - if (base::FeatureList::IsEnabled(web::features::kSlimNavigationManager)) { - // TODO(crbug.com/899827): Store Pending Item in NavigationContext with - // slim-navigation-manager. - return false; - } return base::FeatureList::IsEnabled(kStorePendingItemInContext); }
diff --git a/ios/web/web_state/ui/crw_web_controller.mm b/ios/web/web_state/ui/crw_web_controller.mm index ec33310..5eae10a 100644 --- a/ios/web/web_state/ui/crw_web_controller.mm +++ b/ios/web/web_state/ui/crw_web_controller.mm
@@ -4916,6 +4916,11 @@ rendererInitiated:rendererInitiated]; } else if (_webUIManager) { [_webUIManager loadWebUIForURL:item->GetURL()]; + // Pending item is stored in NavigationManager for WebUI navigations, + // because WebUIManager does not have access to NavigationContext. + if (web::features::StorePendingItemInContext() && context->GetItem()) { + self.navigationManagerImpl->SetPendingItem(context->ReleaseItem()); + } } }
diff --git a/ios/web_view/internal/sync/web_view_profile_sync_service_factory.mm b/ios/web_view/internal/sync/web_view_profile_sync_service_factory.mm index cd31651..95bbf3f2 100644 --- a/ios/web_view/internal/sync/web_view_profile_sync_service_factory.mm +++ b/ios/web_view/internal/sync/web_view_profile_sync_service_factory.mm
@@ -11,11 +11,11 @@ #include "base/no_destructor.h" #include "base/time/time.h" #include "components/autofill/core/common/autofill_features.h" -#include "components/browser_sync/profile_sync_service.h" #include "components/invalidation/impl/profile_invalidation_provider.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/sync/base/model_type.h" #include "components/sync/device_info/local_device_info_provider_impl.h" +#include "components/sync/driver/profile_sync_service.h" #include "components/sync/driver/startup_controller.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_util.h" @@ -84,9 +84,9 @@ WebViewIdentityManagerFactory::GetForBrowserState(browser_state); WebViewGCMProfileServiceFactory::GetForBrowserState(browser_state); - browser_sync::ProfileSyncService::InitParams init_params; + syncer::ProfileSyncService::InitParams init_params; init_params.identity_manager = identity_manager; - init_params.start_behavior = browser_sync::ProfileSyncService::MANUAL_START; + init_params.start_behavior = syncer::ProfileSyncService::MANUAL_START; init_params.sync_client = std::make_unique<WebViewSyncClient>(browser_state); init_params.url_loader_factory = browser_state->GetSharedURLLoaderFactory(); // ios/web_view has no need to update network time. @@ -102,8 +102,7 @@ autofill::features::kAutofillEnableAccountWalletStorage); auto profile_sync_service = - std::make_unique<browser_sync::ProfileSyncService>( - std::move(init_params)); + std::make_unique<syncer::ProfileSyncService>(std::move(init_params)); profile_sync_service->Initialize(); return profile_sync_service; }
diff --git a/ios/web_view/internal/sync/web_view_sync_client.mm b/ios/web_view/internal/sync/web_view_sync_client.mm index d1ff570f..dfd30dc 100644 --- a/ios/web_view/internal/sync/web_view_sync_client.mm +++ b/ios/web_view/internal/sync/web_view_sync_client.mm
@@ -16,7 +16,6 @@ #include "components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/autofill/core/common/autofill_features.h" -#include "components/browser_sync/browser_sync_switches.h" #include "components/browser_sync/profile_sync_components_factory_impl.h" #include "components/history/core/common/pref_names.h" #include "components/invalidation/impl/profile_invalidation_provider.h"
diff --git a/media/audio/android/audio_android_unittest.cc b/media/audio/android/audio_android_unittest.cc index 4e63f2e6..5af0c4a3 100644 --- a/media/audio/android/audio_android_unittest.cc +++ b/media/audio/android/audio_android_unittest.cc
@@ -280,12 +280,13 @@ double volume) override { const int num_samples = src->frames() * src->channels(); std::unique_ptr<int16_t> interleaved(new int16_t[num_samples]); - const int bytes_per_sample = sizeof(*interleaved); - src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); + src->ToInterleaved<SignedInt16SampleTypeTraits>(src->frames(), + interleaved.get()); // Store data data in a temporary buffer to avoid making blocking // fwrite() calls in the audio callback. The complete buffer will be // written to file in the destructor. + const int bytes_per_sample = sizeof(*interleaved); const int size = bytes_per_sample * num_samples; if (!buffer_->Append((const uint8_t*)interleaved.get(), size)) event_->Signal(); @@ -331,8 +332,9 @@ const int num_samples = src->frames() * src->channels(); std::unique_ptr<int16_t> interleaved(new int16_t[num_samples]); + src->ToInterleaved<SignedInt16SampleTypeTraits>(src->frames(), + interleaved.get()); const int bytes_per_sample = sizeof(*interleaved); - src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); const int size = bytes_per_sample * num_samples; base::AutoLock lock(lock_);
diff --git a/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/media/audio/mac/audio_low_latency_input_mac_unittest.cc index 970f4b3..bace146 100644 --- a/media/audio/mac/audio_low_latency_input_mac_unittest.cc +++ b/media/audio/mac/audio_low_latency_input_mac_unittest.cc
@@ -89,12 +89,13 @@ double volume) override { const int num_samples = src->frames() * src->channels(); std::unique_ptr<int16_t> interleaved(new int16_t[num_samples]); - const int bytes_per_sample = sizeof(*interleaved); - src->ToInterleaved(src->frames(), bytes_per_sample, interleaved.get()); + src->ToInterleaved<SignedInt16SampleTypeTraits>(src->frames(), + interleaved.get()); // Store data data in a temporary buffer to avoid making blocking // fwrite() calls in the audio callback. The complete buffer will be // written to file in the destructor. + const int bytes_per_sample = sizeof(*interleaved); const int size = bytes_per_sample * num_samples; if (buffer_.Append((const uint8_t*)interleaved.get(), size)) { bytes_to_write_ += size;
diff --git a/media/audio/win/audio_low_latency_output_win_unittest.cc b/media/audio/win/audio_low_latency_output_win_unittest.cc index 60648d2..877c883 100644 --- a/media/audio/win/audio_low_latency_output_win_unittest.cc +++ b/media/audio/win/audio_low_latency_output_win_unittest.cc
@@ -130,11 +130,13 @@ // Use samples read from a data file and fill up the audio buffer // provided to us in the callback. - if (pos_ + static_cast<int>(max_size) > file_size()) + if (pos_ + max_size > file_size()) max_size = file_size() - pos_; int frames = max_size / (dest->channels() * kBitsPerSample / 8); if (max_size) { - dest->FromInterleaved(file_->data() + pos_, frames, kBitsPerSample / 8); + static_assert(kBitsPerSample == 16, "FromInterleaved expects 2 bytes."); + dest->FromInterleaved<SignedInt16SampleTypeTraits>( + reinterpret_cast<const int16_t*>(file_->data() + pos_), frames); pos_ += max_size; } return frames;
diff --git a/media/base/audio_bus.cc b/media/base/audio_bus.cc index 0c61d5f..12f2e7ae 100644 --- a/media/base/audio_bus.cc +++ b/media/base/audio_bus.cc
@@ -346,31 +346,6 @@ } } -// Forwards to non-deprecated version. -void AudioBus::ToInterleavedPartial(int start_frame, - int frames, - int bytes_per_sample, - void* dest) const { - DCHECK(!is_bitstream_format_); - switch (bytes_per_sample) { - case 1: - ToInterleavedPartial<UnsignedInt8SampleTypeTraits>( - start_frame, frames, reinterpret_cast<uint8_t*>(dest)); - break; - case 2: - ToInterleavedPartial<SignedInt16SampleTypeTraits>( - start_frame, frames, reinterpret_cast<int16_t*>(dest)); - break; - case 4: - ToInterleavedPartial<SignedInt32SampleTypeTraits>( - start_frame, frames, reinterpret_cast<int32_t*>(dest)); - break; - default: - NOTREACHED() << "Unsupported bytes per sample encountered: " - << bytes_per_sample; - } -} - void AudioBus::CopyTo(AudioBus* dest) const { dest->set_is_bitstream_format(is_bitstream_format()); if (is_bitstream_format()) {
diff --git a/media/base/audio_bus.h b/media/base/audio_bus.h index 7726302..e128f32 100644 --- a/media/base/audio_bus.h +++ b/media/base/audio_bus.h
@@ -147,14 +147,6 @@ int num_frames_to_read, typename TargetSampleTypeTraits::ValueType* dest_buffer) const; - // DEPRECATED (https://crbug.com/580391) - // Please use the version templated with TargetSampleTypeTraits instead. - // TODO(chfremer): Remove (https://crbug.com/619623) - void ToInterleavedPartial(int start_frame, - int frames, - int bytes_per_sample, - void* dest) const; - // Helper method for copying channel data from one AudioBus to another. Both // AudioBus object must have the same frames() and channels(). void CopyTo(AudioBus* dest) const;
diff --git a/media/base/audio_bus_unittest.cc b/media/base/audio_bus_unittest.cc index aacafb9..9b21d76 100644 --- a/media/base/audio_bus_unittest.cc +++ b/media/base/audio_bus_unittest.cc
@@ -558,20 +558,6 @@ kTestVectorFrameCount * sizeof(*expected->channel(ch))); } - // Test deprecated version that takes |bytes_per_sample| as an input. - { - SCOPED_TRACE("int16_t"); - int16_t test_array[base::size(kTestVectorInt16)]; - expected->ToInterleavedPartial(kPartialStart, kPartialFrames, - sizeof(*kTestVectorInt16), test_array); - ASSERT_EQ(0, memcmp(test_array, kTestVectorInt16 + - kPartialStart * kTestVectorChannelCount, - kPartialFrames * sizeof(*kTestVectorInt16) * - kTestVectorChannelCount)); - } - - // Test non-deprecated version that takes SampleTypeTraits as a template - // parameter. { SCOPED_TRACE("Float32SampleTypeTraits"); float test_array[base::size(kTestVectorFloat32)];
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc index 91ed9654..31c4054 100644 --- a/media/base/media_switches.cc +++ b/media/base/media_switches.cc
@@ -390,6 +390,11 @@ const base::Feature kAImageReaderVideoOutput{"AImageReaderVideoOutput", base::FEATURE_DISABLED_BY_DEFAULT}; +// Prevents using SurfaceLayer for videos. This is meant to be used by embedders +// that cannot support SurfaceLayer at the moment. +const base::Feature kDisableSurfaceLayerForVideo{ + "DisableSurfaceLayerForVideo", base::FEATURE_DISABLED_BY_DEFAULT}; + #endif // defined(OS_ANDROID) #if defined(OS_WIN)
diff --git a/media/base/media_switches.h b/media/base/media_switches.h index 533c17ed..ee0241b 100644 --- a/media/base/media_switches.h +++ b/media/base/media_switches.h
@@ -144,6 +144,7 @@ MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioning; MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioningAtStartup; MEDIA_EXPORT extern const base::Feature kAImageReaderVideoOutput; +MEDIA_EXPORT extern const base::Feature kDisableSurfaceLayerForVideo; #endif // defined(OS_ANDROID) #if defined(OS_WIN)
diff --git a/media/cast/receiver/audio_decoder.cc b/media/cast/receiver/audio_decoder.cc index 9792777..39f56ec6 100644 --- a/media/cast/receiver/audio_decoder.cc +++ b/media/cast/receiver/audio_decoder.cc
@@ -205,7 +205,8 @@ pcm_data[i] = static_cast<int16_t>(base::NetToHost16(pcm_data[i])); #endif audio_bus = AudioBus::Create(num_channels_, num_samples); - audio_bus->FromInterleaved(pcm_data, num_samples, sizeof(int16_t)); + audio_bus->FromInterleaved<SignedInt16SampleTypeTraits>(pcm_data, + num_samples); return audio_bus; }
diff --git a/media/cast/receiver/audio_decoder_unittest.cc b/media/cast/receiver/audio_decoder_unittest.cc index 2c7f12b..2e324d5 100644 --- a/media/cast/receiver/audio_decoder_unittest.cc +++ b/media/cast/receiver/audio_decoder_unittest.cc
@@ -95,8 +95,8 @@ // Encode |audio_bus| into |encoded_frame->data|. const int num_elements = audio_bus->channels() * audio_bus->frames(); std::vector<int16_t> interleaved(num_elements); - audio_bus->ToInterleaved(audio_bus->frames(), sizeof(int16_t), - &interleaved.front()); + audio_bus->ToInterleaved<SignedInt16SampleTypeTraits>(audio_bus->frames(), + &interleaved.front()); if (GetParam().codec == CODEC_AUDIO_PCM16) { encoded_frame->data.resize(num_elements * sizeof(int16_t)); int16_t* const pcm_data =
diff --git a/media/cast/sender/audio_encoder.cc b/media/cast/sender/audio_encoder.cc index 3031912..ade6228 100644 --- a/media/cast/sender/audio_encoder.cc +++ b/media/cast/sender/audio_encoder.cc
@@ -732,8 +732,8 @@ int source_offset, int buffer_fill_offset, int num_samples) final { - audio_bus->ToInterleavedPartial( - source_offset, num_samples, sizeof(int16_t), + audio_bus->ToInterleavedPartial<SignedInt16SampleTypeTraits>( + source_offset, num_samples, buffer_.get() + buffer_fill_offset * num_channels_); }
diff --git a/media/webrtc/audio_processor_unittest.cc b/media/webrtc/audio_processor_unittest.cc index 96d7030..acfb1ac1 100644 --- a/media/webrtc/audio_processor_unittest.cc +++ b/media/webrtc/audio_processor_unittest.cc
@@ -101,7 +101,8 @@ const base::TimeDelta input_capture_delay = base::TimeDelta::FromMilliseconds(20); for (int i = 0; i < kNumberOfPacketsForTest; ++i) { - data_bus->FromInterleaved(data_ptr, data_bus->frames(), 2); + data_bus->FromInterleaved<SignedInt16SampleTypeTraits>( + data_ptr, data_bus->frames()); // |audio_processor| does nothing when the audio processing is off in // the processor. webrtc::AudioProcessing* ap = audio_processor->audio_processing_.get();
diff --git a/mojo/core/channel.cc b/mojo/core/channel.cc index 7daaaa1..acc79e45 100644 --- a/mojo/core/channel.cc +++ b/mojo/core/channel.cc
@@ -22,6 +22,7 @@ #include "mojo/public/cpp/platform/features.h" #if defined(OS_MACOSX) && !defined(OS_IOS) +#include "base/debug/dump_without_crashing.h" #include "base/mac/mach_logging.h" #elif defined(OS_WIN) #include "base/win/win_util.h" @@ -797,6 +798,11 @@ } void Channel::OnError(Error error) { +#if defined(OS_MACOSX) && !defined(OS_IOS) + // TODO(crbug.com/946372): Remove when fixed. + if (base::FeatureList::IsEnabled(features::kMojoChannelMac)) + base::debug::DumpWithoutCrashing(); +#endif if (delegate_) delegate_->OnChannelError(error); }
diff --git a/net/base/test_completion_callback.cc b/net/base/test_completion_callback.cc index ad56508..3cd8957 100644 --- a/net/base/test_completion_callback.cc +++ b/net/base/test_completion_callback.cc
@@ -46,18 +46,8 @@ TestClosure::~TestClosure() = default; -TestCompletionCallback::TestCompletionCallback() - : callback_(base::Bind(&TestCompletionCallback::SetResult, - base::Unretained(this))) { -} - TestCompletionCallback::~TestCompletionCallback() = default; -TestInt64CompletionCallback::TestInt64CompletionCallback() - : callback_(base::Bind(&TestInt64CompletionCallback::SetResult, - base::Unretained(this))) { -} - TestInt64CompletionCallback::~TestInt64CompletionCallback() = default; ReleaseBufferCompletionCallback::ReleaseBufferCompletionCallback(
diff --git a/net/base/test_completion_callback.h b/net/base/test_completion_callback.h index b6de351c..f4c33923 100644 --- a/net/base/test_completion_callback.h +++ b/net/base/test_completion_callback.h
@@ -8,11 +8,12 @@ #include <stdint.h> #include <memory> +#include <utility> #include "base/callback.h" #include "base/compiler_specific.h" #include "base/macros.h" -#include "net/base/completion_callback.h" +#include "net/base/completion_once_callback.h" #include "net/base/net_errors.h" //----------------------------------------------------------------------------- @@ -116,27 +117,29 @@ class TestCompletionCallback : public TestCompletionCallbackBase { public: - TestCompletionCallback(); + TestCompletionCallback() {} ~TestCompletionCallback() override; - const CompletionCallback& callback() const { return callback_; } + CompletionOnceCallback callback() { + return base::BindOnce(&TestCompletionCallback::SetResult, + base::Unretained(this)); + } private: - const CompletionCallback callback_; - DISALLOW_COPY_AND_ASSIGN(TestCompletionCallback); }; class TestInt64CompletionCallback : public TestInt64CompletionCallbackBase { public: - TestInt64CompletionCallback(); + TestInt64CompletionCallback() {} ~TestInt64CompletionCallback() override; - const Int64CompletionCallback& callback() const { return callback_; } + Int64CompletionOnceCallback callback() { + return base::BindOnce(&TestInt64CompletionCallback::SetResult, + base::Unretained(this)); + } private: - const Int64CompletionCallback callback_; - DISALLOW_COPY_AND_ASSIGN(TestInt64CompletionCallback); };
diff --git a/net/data/websocket/README b/net/data/websocket/README index ef9d896..515601e 100644 --- a/net/data/websocket/README +++ b/net/data/websocket/README
@@ -47,6 +47,9 @@ Used by kinds of PPAPI tests for WebSocket, ExtensionApiTest.WebSocket, and WorkerTest.WebSocketSharedWorker. +- close-immediately_wsh.py : A WebSocket URL handler that performs an immediate + clean close as soon as the connection is established. + - close_wsh.py : A WebSocket URL handler for testing outgoing close code and reason. Used by kinds of PPAPI tests for WebSocket.
diff --git a/net/data/websocket/close-immediately_wsh.py b/net/data/websocket/close-immediately_wsh.py new file mode 100644 index 0000000..6cc08424 --- /dev/null +++ b/net/data/websocket/close-immediately_wsh.py
@@ -0,0 +1,11 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +def web_socket_do_extra_handshake(_request): + pass # Always accept. + + +def web_socket_transfer_data(_request): + pass # Close immediately
diff --git a/net/filter/brotli_source_stream_unittest.cc b/net/filter/brotli_source_stream_unittest.cc index 4893fb2..d1aabc3 100644 --- a/net/filter/brotli_source_stream_unittest.cc +++ b/net/filter/brotli_source_stream_unittest.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include <string> +#include <utility> #include "base/bind.h" #include "base/bit_cast.h" @@ -55,9 +56,9 @@ brotli_stream_ = CreateBrotliSourceStream(std::move(source)); } - int ReadStream(const TestCompletionCallback& callback) { + int ReadStream(net::CompletionOnceCallback callback) { return brotli_stream_->Read(out_buffer(), out_data_size(), - callback.callback()); + std::move(callback)); } IOBuffer* out_buffer() { return out_buffer_.get(); } @@ -91,7 +92,7 @@ MockSourceStream::SYNC); out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); TestCompletionCallback callback; - int bytes_read = ReadStream(callback); + int bytes_read = ReadStream(callback.callback()); EXPECT_EQ(static_cast<int>(source_data_len()), bytes_read); EXPECT_EQ(0, memcmp(out_data(), source_data().c_str(), source_data_len())); @@ -111,7 +112,7 @@ out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); std::string actual_output; TestCompletionCallback callback; - int bytes_read = ReadStream(callback); + int bytes_read = ReadStream(callback.callback()); EXPECT_EQ(0, bytes_read); EXPECT_EQ("BROTLI", brotli_stream()->Description()); } @@ -128,9 +129,9 @@ MockSourceStream::SYNC); out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); std::string actual_output; - TestCompletionCallback callback; while (true) { - int bytes_read = ReadStream(callback); + TestCompletionCallback callback; + int bytes_read = ReadStream(callback.callback()); if (bytes_read == OK) break; ASSERT_GT(bytes_read, OK); @@ -153,9 +154,9 @@ source()->AddReadResult(extra_data.c_str(), 0, OK, MockSourceStream::SYNC); out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); std::string actual_output; - TestCompletionCallback callback; while (true) { - int bytes_read = ReadStream(callback); + TestCompletionCallback callback; + int bytes_read = ReadStream(callback.callback()); if (bytes_read == OK) break; ASSERT_GT(bytes_read, OK); @@ -173,7 +174,7 @@ MockSourceStream::SYNC); out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); TestCompletionCallback callback; - int bytes_read = ReadStream(callback); + int bytes_read = ReadStream(callback.callback()); EXPECT_EQ(static_cast<int>(source_data_len()), bytes_read); EXPECT_EQ(0, memcmp(out_data(), source_data().c_str(), source_data_len())); EXPECT_EQ("BROTLI", brotli_stream()->Description()); @@ -185,7 +186,7 @@ MockSourceStream::ASYNC); out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); TestCompletionCallback callback; - int bytes_read = ReadStream(callback); + int bytes_read = ReadStream(callback.callback()); EXPECT_EQ(ERR_IO_PENDING, bytes_read); source()->CompleteNextRead(); @@ -210,9 +211,9 @@ base::MakeRefCounted<IOBufferWithSize>(source_data_len()); size_t total_bytes_read = 0; int bytes_read = 0; - TestCompletionCallback callback; do { - bytes_read = ReadStream(callback); + TestCompletionCallback callback; + bytes_read = ReadStream(callback.callback()); EXPECT_LE(OK, bytes_read); EXPECT_GE(kSmallBufferSize, static_cast<size_t>(bytes_read)); memcpy(buffer->data() + total_bytes_read, out_data(), bytes_read); @@ -240,7 +241,7 @@ int bytes_read = 0; do { TestCompletionCallback callback; - bytes_read = ReadStream(callback); + bytes_read = ReadStream(callback.callback()); if (bytes_read == ERR_IO_PENDING) { source()->CompleteNextRead(); bytes_read = callback.WaitForResult(); @@ -269,7 +270,7 @@ int bytes_read = 0; do { TestCompletionCallback callback; - bytes_read = ReadStream(callback); + bytes_read = ReadStream(callback.callback()); EXPECT_NE(ERR_IO_PENDING, bytes_read); EXPECT_GE(1, bytes_read); memcpy(buffer->data() + total_bytes_read, out_data(), bytes_read); @@ -292,17 +293,18 @@ source()->AddReadResult(corrupt_data, corrupt_data_len, OK, MockSourceStream::SYNC); out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); - TestCompletionCallback callback; int error = OK; do { - error = ReadStream(callback); + TestCompletionCallback callback; + error = ReadStream(callback.callback()); EXPECT_NE(ERR_IO_PENDING, error); } while (error > 0); // Expect failures EXPECT_EQ(ERR_CONTENT_DECODING_FAILED, error); // Calling Read again gives the same error. - error = ReadStream(callback); + TestCompletionCallback callback; + error = ReadStream(callback.callback()); EXPECT_EQ(ERR_CONTENT_DECODING_FAILED, error); EXPECT_EQ("BROTLI", brotli_stream()->Description()); @@ -326,7 +328,7 @@ int error = OK; do { TestCompletionCallback callback; - error = ReadStream(callback); + error = ReadStream(callback.callback()); EXPECT_NE(ERR_IO_PENDING, error); } while (error > 0); // Expect failures @@ -343,7 +345,7 @@ source()->AddReadResult(data, 0, OK, MockSourceStream::SYNC); out_buffer_ = base::MakeRefCounted<IOBufferWithSize>(kDefaultBufferSize); TestCompletionCallback callback; - int bytes_read = ReadStream(callback); + int bytes_read = ReadStream(callback.callback()); EXPECT_EQ(OK, bytes_read); EXPECT_EQ("BROTLI", brotli_stream()->Description()); }
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index 3be1771..c429671 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc
@@ -30,6 +30,7 @@ #include "base/trace_event/process_memory_dump.h" #include "base/trace_event/traced_value.h" #include "net/base/cache_type.h" +#include "net/base/completion_repeating_callback.h" #include "net/base/elements_upload_data_stream.h" #include "net/base/features.h" #include "net/base/host_port_pair.h" @@ -11349,11 +11350,16 @@ response_info.cache_entry_status); } -class TestCompletionCallbackForHttpCache : public TestCompletionCallback { +class TestCompletionCallbackForHttpCache : public TestCompletionCallbackBase { public: TestCompletionCallbackForHttpCache() {} ~TestCompletionCallbackForHttpCache() override = default; + CompletionRepeatingCallback callback() { + return base::BindRepeating(&TestCompletionCallbackForHttpCache::SetResult, + base::Unretained(this)); + } + const std::vector<int>& results() { return results_; } private:
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 300d1be..cc19132 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc
@@ -625,6 +625,7 @@ establishing_tunnel_ = true; response_.headers = proxy_response.headers; response_.auth_challenge = proxy_response.auth_challenge; + response_.did_use_http_auth = proxy_response.did_use_http_auth; if (response_.headers.get() && !ContentEncodingsValid()) { DoCallback(ERR_CONTENT_DECODING_FAILED);
diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 295d069..0ee8d86 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc
@@ -3710,6 +3710,7 @@ EXPECT_EQ(10, response->headers->GetContentLength()); EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); + EXPECT_FALSE(response->did_use_http_auth); TestCompletionCallback callback2; @@ -3726,6 +3727,7 @@ EXPECT_EQ(10, response->headers->GetContentLength()); EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); EXPECT_TRUE(CheckBasicProxyAuth(response->auth_challenge.get())); + EXPECT_TRUE(response->did_use_http_auth); // Flush the idle socket before the NetLog and HttpNetworkTransaction go // out of scope. @@ -6740,6 +6742,7 @@ EXPECT_EQ(407, response->headers->response_code()); EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); EXPECT_TRUE(CheckBasicSecureProxyAuth(response->auth_challenge.get())); + EXPECT_FALSE(response->did_use_http_auth); TestCompletionCallback callback2; @@ -6761,6 +6764,7 @@ EXPECT_EQ(200, response->headers->response_code()); EXPECT_EQ(100, response->headers->GetContentLength()); EXPECT_TRUE(HttpVersion(1, 1) == response->headers->GetHttpVersion()); + EXPECT_TRUE(response->did_use_http_auth); // The password prompt info should not be set. EXPECT_FALSE(response->auth_challenge);
diff --git a/net/http/http_proxy_client_socket.cc b/net/http/http_proxy_client_socket.cc index 51d112a8..a33223d 100644 --- a/net/http/http_proxy_client_socket.cc +++ b/net/http/http_proxy_client_socket.cc
@@ -376,6 +376,10 @@ HttpRequestHeaders extra_headers; if (auth_->HaveAuth()) auth_->AddAuthorizationHeader(&extra_headers); + // AddAuthorizationHeader() might not have added the header even if + // HaveAuth(). + response_.did_use_http_auth = + extra_headers.HasHeader(HttpRequestHeaders::kProxyAuthorization); if (proxy_delegate_) { HttpRequestHeaders proxy_delegate_headers;
diff --git a/net/http/http_proxy_connect_job.cc b/net/http/http_proxy_connect_job.cc index bbfba52..a84153ee 100644 --- a/net/http/http_proxy_connect_job.cc +++ b/net/http/http_proxy_connect_job.cc
@@ -260,44 +260,39 @@ NOTREACHED(); } -base::TimeDelta HttpProxyConnectJob::ConnectionTimeout( +base::TimeDelta HttpProxyConnectJob::AlternateNestedConnectionTimeout( const HttpProxySocketParams& params, const NetworkQualityEstimator* network_quality_estimator) { + base::TimeDelta default_alternate_timeout; + + // On Android and iOS, a default proxy connection timeout is used instead of + // the actual TCP/SSL timeouts of nested jobs. +#if defined(OS_ANDROID) || defined(OS_IOS) + default_alternate_timeout = kHttpProxyConnectJobTunnelTimeout; +#endif // !defined(OS_ANDROID) && !defined(OS_IOS) + bool is_https = params.ssl_params() != nullptr; // HTTP proxy connections can't be on top of proxy connections. DCHECK(!is_https || params.ssl_params()->GetConnectionType() == SSLSocketParams::DIRECT); - if (network_quality_estimator) { - base::Optional<base::TimeDelta> http_rtt_estimate = - network_quality_estimator->GetHttpRTT(); - if (http_rtt_estimate) { - int32_t multiplier = - is_https - ? GetProxyTimeoutExperiments()->ssl_http_rtt_multiplier() - : GetProxyTimeoutExperiments()->non_ssl_http_rtt_multiplier(); - base::TimeDelta timeout = base::TimeDelta::FromMicroseconds( - multiplier * http_rtt_estimate.value().InMicroseconds()); - // Ensure that connection timeout is between - // |min_proxy_connection_timeout_| and |max_proxy_connection_timeout_|. - return base::ClampToRange( - timeout, GetProxyTimeoutExperiments()->min_proxy_connection_timeout(), - GetProxyTimeoutExperiments()->max_proxy_connection_timeout()); - } - } + if (!network_quality_estimator) + return default_alternate_timeout; - // Return the default proxy connection timeout. - base::TimeDelta nested_job_timeout; -#if !defined(OS_ANDROID) && !defined(OS_IOS) - if (is_https) { - nested_job_timeout = SSLConnectJob::ConnectionTimeout( - *params.ssl_params(), network_quality_estimator); - } else { - nested_job_timeout = TransportConnectJob::ConnectionTimeout(); - } -#endif // !defined(OS_ANDROID) && !defined(OS_IOS) + base::Optional<base::TimeDelta> http_rtt_estimate = + network_quality_estimator->GetHttpRTT(); + if (!http_rtt_estimate) + return default_alternate_timeout; - return nested_job_timeout + kHttpProxyConnectJobTunnelTimeout; + int32_t multiplier = + is_https ? GetProxyTimeoutExperiments()->ssl_http_rtt_multiplier() + : GetProxyTimeoutExperiments()->non_ssl_http_rtt_multiplier(); + base::TimeDelta timeout = multiplier * http_rtt_estimate.value(); + // Ensure that connection timeout is between + // |min_proxy_connection_timeout_| and |max_proxy_connection_timeout_|. + return base::ClampToRange( + timeout, GetProxyTimeoutExperiments()->min_proxy_connection_timeout(), + GetProxyTimeoutExperiments()->max_proxy_connection_timeout()); } base::TimeDelta HttpProxyConnectJob::TunnelTimeoutForTesting() { @@ -417,7 +412,8 @@ int HttpProxyConnectJob::DoBeginConnect() { connect_start_time_ = base::TimeTicks::Now(); - ResetTimer(ConnectionTimeout(*params_, network_quality_estimator())); + ResetTimer( + AlternateNestedConnectionTimeout(*params_, network_quality_estimator())); switch (GetProxyServerScheme()) { case ProxyServer::SCHEME_QUIC: next_state_ = STATE_QUIC_PROXY_CREATE_SESSION; @@ -462,11 +458,6 @@ has_established_connection_ = true; - // Reset the timer to just the length of time allowed for HttpProxy handshake - // so that a fast TCP connection plus a slow HttpProxy failure doesn't take - // longer to timeout than it should. - ResetTimer(kHttpProxyConnectJobTunnelTimeout); - next_state_ = STATE_HTTP_PROXY_CONNECT; return result; } @@ -556,6 +547,11 @@ int HttpProxyConnectJob::DoHttpProxyConnect() { next_state_ = STATE_HTTP_PROXY_CONNECT_COMPLETE; + // Reset the timer to just the length of time allowed for HttpProxy handshake + // so that a fast TCP connection plus a slow HttpProxy failure doesn't take + // longer to timeout than it should. + ResetTimer(kHttpProxyConnectJobTunnelTimeout); + if (params_->transport_params()) { UMA_HISTOGRAM_MEDIUM_TIMES("Net.HttpProxy.ConnectLatency.Insecure.Success", base::TimeTicks::Now() - connect_start_time_); @@ -595,6 +591,12 @@ DCHECK(using_spdy_); DCHECK(params_->tunnel()); DCHECK(params_->ssl_params()); + + // Reset the timer to just the length of time allowed for HttpProxy handshake + // so that a fast TCP connection plus a slow HttpProxy failure doesn't take + // longer to timeout than it should. + ResetTimer(kHttpProxyConnectJobTunnelTimeout); + SpdySessionKey key( params_->ssl_params()->GetDirectConnectionParams()->destination(), ProxyServer::Direct(), PRIVACY_MODE_DISABLED, @@ -652,6 +654,11 @@ DCHECK(params_->tunnel()); DCHECK(!common_connect_job_params()->quic_supported_versions->empty()); + // Reset the timer to just the length of time allowed for HttpProxy handshake + // so that a fast TCP connection plus a slow HttpProxy failure doesn't take + // longer to timeout than it should. + ResetTimer(kHttpProxyConnectJobTunnelTimeout); + next_state_ = STATE_QUIC_PROXY_CREATE_STREAM; const HostPortPair& proxy_server = ssl_params->GetDirectConnectionParams()->destination(); @@ -711,6 +718,8 @@ int HttpProxyConnectJob::DoRestartWithAuth() { DCHECK(transport_socket_); + // TODO(mmenke): This should presumably restart the timeout timer using the + // handshake timeout. next_state_ = STATE_RESTART_WITH_AUTH_COMPLETE; return transport_socket_->RestartWithAuth(base::BindOnce( &HttpProxyConnectJob::OnIOComplete, base::Unretained(this)));
diff --git a/net/http/http_proxy_connect_job.h b/net/http/http_proxy_connect_job.h index 20d6657..5442405 100644 --- a/net/http/http_proxy_connect_job.h +++ b/net/http/http_proxy_connect_job.h
@@ -112,9 +112,13 @@ base::OnceClosure restart_with_auth_callback, ConnectJob* job) override; - // Returns the connection timeout that will be used by a HttpProxyConnectJob - // created with the specified parameters, given current network conditions. - static base::TimeDelta ConnectionTimeout( + // In some cases, a timeout that's stricter than the TCP (+SSL, if applicable) + // is used for HTTP proxies during connection establishment and SSL + // negotiation for the connection to the proxy itself. In those cases, returns + // the connection timeout that will be used by a HttpProxyConnectJob created + // with the specified parameters, given current network conditions. Otherwise, + // returns base::TimeDelta(). + static base::TimeDelta AlternateNestedConnectionTimeout( const HttpProxySocketParams& params, const NetworkQualityEstimator* network_quality_estimator);
diff --git a/net/http/http_proxy_connect_job_unittest.cc b/net/http/http_proxy_connect_job_unittest.cc index d3defed..8d9c42b 100644 --- a/net/http/http_proxy_connect_job_unittest.cc +++ b/net/http/http_proxy_connect_job_unittest.cc
@@ -207,12 +207,34 @@ ssl_data->next_proto = kProtoHTTP2; } - base::TimeDelta GetProxyConnectionTimeout() { + // Return the timeout for establishing the lower layer connection. i.e., for + // an HTTP proxy, the TCP connection timeout, and for an HTTPS proxy, the + // TCP+SSL connection timeout. In many cases, this will return the return + // value of the "AlternateNestedConnectionTimeout()". + base::TimeDelta GetNestedConnectionTimeout() { + base::TimeDelta normal_nested_connection_timeout = + TransportConnectJob::ConnectionTimeout(); + if (GetParam() != HTTP) + normal_nested_connection_timeout += + SSLConnectJob::HandshakeTimeoutForTesting(); + // Doesn't actually matter whether or not this is for a tunnel - the // connection timeout is the same, though it probably shouldn't be the same, // since tunnels need an extra round trip. - return HttpProxyConnectJob::ConnectionTimeout( - *CreateParams(true /* tunnel */), network_quality_estimator_.get()); + base::TimeDelta alternate_connection_timeout = + HttpProxyConnectJob::AlternateNestedConnectionTimeout( + *CreateParams(true /* tunnel */), network_quality_estimator_.get()); + + // If there's an alternate connection timeout, and it's less than the + // standard TCP+SSL timeout (Which is also applied by the nested connect + // jobs), return the alternate connection timeout. Otherwise, return the + // normal timeout. + if (!alternate_connection_timeout.is_zero() && + alternate_connection_timeout < normal_nested_connection_timeout) { + return alternate_connection_timeout; + } + + return normal_nested_connection_timeout; } protected: @@ -1283,12 +1305,8 @@ EXPECT_TRUE(session_deps_.host_resolver->has_pending_requests()); EXPECT_EQ(LOAD_STATE_RESOLVING_HOST, connect_job->GetLoadState()); - // Run until just before timeout. The proxy timeout can be less than the - // connection timeout, as it can be set based on the - // NetworkQualityEstimator, which the connection timeout is not. - FastForwardBy(std::min(TransportConnectJob::ConnectionTimeout(), - GetProxyConnectionTimeout()) - - kTinyTime); + // Run until just before timeout. + FastForwardBy(GetNestedConnectionTimeout() - kTinyTime); EXPECT_FALSE(test_delegate.has_result()); // Wait until timeout, if appropriate. @@ -1326,7 +1344,7 @@ EXPECT_FALSE(test_delegate.has_result()); // ConnectJobs cannot timeout while showing an auth dialog. - FastForwardBy(base::TimeDelta::FromDays(1) + GetProxyConnectionTimeout()); + FastForwardBy(base::TimeDelta::FromDays(1)); EXPECT_FALSE(test_delegate.has_result()); // Send credentials @@ -1338,14 +1356,9 @@ // When sending proxy auth on the same socket a challenge was just received // on, all subsequent proxy handshakes cannot timeout. However, H2 always // follows the establish new connection path, which means its second proxy - // handshake *can* timeout. Retrying with an already established H2 stream - // uses the entire proxy timeout for just establishing the tunnel, rather - // than the tunnel timeout. - // - // TODO(https://crbug.com/937137): This behavior seems strange. Should we do - // something about it? + // handshake *can* timeout. if (GetParam() == SPDY) { - FastForwardBy(GetProxyConnectionTimeout() - kTinyTime); + FastForwardBy(HttpProxyConnectJob::TunnelTimeoutForTesting() - kTinyTime); EXPECT_FALSE(test_delegate.has_result()); if (timeout_phase == TimeoutPhase::SECOND_PROXY_HANDSHAKE) { @@ -1357,7 +1370,7 @@ } } else { // See above comment for explanation. - FastForwardBy(base::TimeDelta::FromDays(1) + GetProxyConnectionTimeout()); + FastForwardBy(base::TimeDelta::FromDays(1)); EXPECT_FALSE(test_delegate.has_result()); } @@ -1440,12 +1453,8 @@ EXPECT_TRUE(session_deps_.host_resolver->has_pending_requests()); EXPECT_EQ(LOAD_STATE_RESOLVING_HOST, connect_job->GetLoadState()); - // Run until just before timeout. The proxy timeout can be less than the - // connection timeout, as it can be set based on the - // NetworkQualityEstimator, which the connection timeout is not. - FastForwardBy(std::min(TransportConnectJob::ConnectionTimeout(), - GetProxyConnectionTimeout()) - - kTinyTime); + // Run until just before timeout. + FastForwardBy(GetNestedConnectionTimeout() - kTinyTime); EXPECT_FALSE(test_delegate.has_result()); // Wait until timeout, if appropriate. @@ -1484,7 +1493,7 @@ EXPECT_FALSE(test_delegate.has_result()); // ConnectJobs cannot timeout while showing an auth dialog. - FastForwardBy(base::TimeDelta::FromDays(1) + GetProxyConnectionTimeout()); + FastForwardBy(base::TimeDelta::FromDays(1)); EXPECT_FALSE(test_delegate.has_result()); // Send credentials @@ -1500,12 +1509,8 @@ EXPECT_TRUE(session_deps_.host_resolver->has_pending_requests()); EXPECT_EQ(LOAD_STATE_RESOLVING_HOST, connect_job->GetLoadState()); - // Run until just before timeout. The proxy timeout can be less than the - // connection timeout, as it can be set based on the - // NetworkQualityEstimator, which the connection timeout is not. - FastForwardBy(std::min(TransportConnectJob::ConnectionTimeout(), - GetProxyConnectionTimeout()) - - kTinyTime); + // Run until just before timeout. + FastForwardBy(GetNestedConnectionTimeout() - kTinyTime); EXPECT_FALSE(test_delegate.has_result()); // Wait until timeout, if appropriate. @@ -1545,20 +1550,39 @@ } } +TEST_P(HttpProxyConnectJobTest, ConnectionTimeoutNoNQE) { + // Doesn't actually matter whether or not this is for a tunnel - the + // connection timeout is the same, though it probably shouldn't be the same, + // since tunnels need an extra round trip. + base::TimeDelta alternate_connection_timeout = + HttpProxyConnectJob::AlternateNestedConnectionTimeout( + *CreateParams(true /* tunnel */), + nullptr /* network_quality_estimator */); + +#if defined(OS_ANDROID) || defined(OS_IOS) + // On Android and iOS, when there's no NQE, there's a hard-coded alternate + // proxy timeout. + EXPECT_EQ(base::TimeDelta::FromSeconds(10), alternate_connection_timeout); +#else + // On other platforms, there is not. + EXPECT_EQ(base::TimeDelta(), alternate_connection_timeout); +#endif +} + TEST_P(HttpProxyConnectJobTest, ConnectionTimeoutMin) { // Set RTT estimate to a low value. base::TimeDelta rtt_estimate = base::TimeDelta::FromMilliseconds(1); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_LE(base::TimeDelta(), GetProxyConnectionTimeout()); + EXPECT_LE(base::TimeDelta(), GetNestedConnectionTimeout()); // Test against a large value. - EXPECT_GE(base::TimeDelta::FromMinutes(10), GetProxyConnectionTimeout()); + EXPECT_GE(base::TimeDelta::FromMinutes(10), GetNestedConnectionTimeout()); #if (defined(OS_ANDROID) || defined(OS_IOS)) - EXPECT_EQ(base::TimeDelta::FromSeconds(8), GetProxyConnectionTimeout()); + EXPECT_EQ(base::TimeDelta::FromSeconds(8), GetNestedConnectionTimeout()); #else - EXPECT_EQ(base::TimeDelta::FromSeconds(30), GetProxyConnectionTimeout()); + EXPECT_EQ(base::TimeDelta::FromSeconds(30), GetNestedConnectionTimeout()); #endif } @@ -1567,15 +1591,15 @@ base::TimeDelta rtt_estimate = base::TimeDelta::FromSeconds(100); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_LE(base::TimeDelta(), GetProxyConnectionTimeout()); + EXPECT_LE(base::TimeDelta(), GetNestedConnectionTimeout()); // Test against a large value. - EXPECT_GE(base::TimeDelta::FromMinutes(10), GetProxyConnectionTimeout()); + EXPECT_GE(base::TimeDelta::FromMinutes(10), GetNestedConnectionTimeout()); #if (defined(OS_ANDROID) || defined(OS_IOS)) - EXPECT_EQ(base::TimeDelta::FromSeconds(30), GetProxyConnectionTimeout()); + EXPECT_EQ(base::TimeDelta::FromSeconds(30), GetNestedConnectionTimeout()); #else - EXPECT_EQ(base::TimeDelta::FromSeconds(60), GetProxyConnectionTimeout()); + EXPECT_EQ(base::TimeDelta::FromSeconds(60), GetNestedConnectionTimeout()); #endif } @@ -1589,22 +1613,22 @@ InitAdaptiveTimeoutFieldTrialWithParams(false, kMultiplier, kMultiplier, kMinTimeout, kMaxTimeout); - EXPECT_LE(base::TimeDelta(), GetProxyConnectionTimeout()); + EXPECT_LE(base::TimeDelta(), GetNestedConnectionTimeout()); base::TimeDelta rtt_estimate = base::TimeDelta::FromSeconds(4); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); base::TimeDelta expected_connection_timeout = kMultiplier * rtt_estimate; - EXPECT_EQ(expected_connection_timeout, GetProxyConnectionTimeout()); + EXPECT_EQ(expected_connection_timeout, GetNestedConnectionTimeout()); // Connection timeout should not exceed kMaxTimeout. rtt_estimate = base::TimeDelta::FromSeconds(25); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_EQ(kMaxTimeout, GetProxyConnectionTimeout()); + EXPECT_EQ(kMaxTimeout, GetNestedConnectionTimeout()); // Connection timeout should not be less than kMinTimeout. rtt_estimate = base::TimeDelta::FromSeconds(0); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_EQ(kMinTimeout, GetProxyConnectionTimeout()); + EXPECT_EQ(kMinTimeout, GetNestedConnectionTimeout()); } // Tests the connection timeout values when the field trial parameters are @@ -1617,26 +1641,26 @@ InitAdaptiveTimeoutFieldTrialWithParams(false, kMultiplier, kMultiplier, kMinTimeout, kMaxTimeout); - EXPECT_LE(base::TimeDelta(), GetProxyConnectionTimeout()); + EXPECT_LE(base::TimeDelta(), GetNestedConnectionTimeout()); base::TimeDelta rtt_estimate = base::TimeDelta::FromSeconds(2); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_EQ(kMultiplier * rtt_estimate, GetProxyConnectionTimeout()); + EXPECT_EQ(kMultiplier * rtt_estimate, GetNestedConnectionTimeout()); // A change in RTT estimate should also change the connection timeout. rtt_estimate = base::TimeDelta::FromSeconds(7); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_EQ(kMultiplier * rtt_estimate, GetProxyConnectionTimeout()); + EXPECT_EQ(kMultiplier * rtt_estimate, GetNestedConnectionTimeout()); // Connection timeout should not exceed kMaxTimeout. rtt_estimate = base::TimeDelta::FromSeconds(35); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_EQ(kMaxTimeout, GetProxyConnectionTimeout()); + EXPECT_EQ(kMaxTimeout, GetNestedConnectionTimeout()); // Connection timeout should not be less than kMinTimeout. rtt_estimate = base::TimeDelta::FromSeconds(0); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_EQ(kMinTimeout, GetProxyConnectionTimeout()); + EXPECT_EQ(kMinTimeout, GetNestedConnectionTimeout()); } TEST_P(HttpProxyConnectJobTest, ConnectionTimeoutWithConnectionProperty) { @@ -1653,9 +1677,10 @@ // By default, connection timeout should return the timeout for secure // proxies. if (GetParam() != HTTP) { - EXPECT_EQ(kSecureMultiplier * kRttEstimate, GetProxyConnectionTimeout()); + EXPECT_EQ(kSecureMultiplier * kRttEstimate, GetNestedConnectionTimeout()); } else { - EXPECT_EQ(kNonSecureMultiplier * kRttEstimate, GetProxyConnectionTimeout()); + EXPECT_EQ(kNonSecureMultiplier * kRttEstimate, + GetNestedConnectionTimeout()); } } @@ -1664,30 +1689,30 @@ TEST_P(HttpProxyConnectJobTest, ProxyPoolTimeoutWithExperimentDefaultParams) { InitAdaptiveTimeoutFieldTrialWithParams(true, 0, 0, base::TimeDelta(), base::TimeDelta()); - EXPECT_LE(base::TimeDelta(), GetProxyConnectionTimeout()); + EXPECT_LE(base::TimeDelta(), GetNestedConnectionTimeout()); // Timeout should be |http_rtt_multiplier| times the HTTP RTT // estimate. base::TimeDelta rtt_estimate = base::TimeDelta::FromMilliseconds(10); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); // Connection timeout should not be less than the HTTP RTT estimate. - EXPECT_LE(rtt_estimate, GetProxyConnectionTimeout()); + EXPECT_LE(rtt_estimate, GetNestedConnectionTimeout()); // A change in RTT estimate should also change the connection timeout. rtt_estimate = base::TimeDelta::FromSeconds(10); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); // Connection timeout should not be less than the HTTP RTT estimate. - EXPECT_LE(rtt_estimate, GetProxyConnectionTimeout()); + EXPECT_LE(rtt_estimate, GetNestedConnectionTimeout()); // Set RTT to a very large value. rtt_estimate = base::TimeDelta::FromMinutes(60); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_GT(rtt_estimate, GetProxyConnectionTimeout()); + EXPECT_GT(rtt_estimate, GetNestedConnectionTimeout()); // Set RTT to a very small value. rtt_estimate = base::TimeDelta::FromSeconds(0); network_quality_estimator_->SetStartTimeNullHttpRtt(rtt_estimate); - EXPECT_LT(rtt_estimate, GetProxyConnectionTimeout()); + EXPECT_LT(rtt_estimate, GetNestedConnectionTimeout()); } } // namespace net
diff --git a/net/socket/connect_job.cc b/net/socket/connect_job.cc index 7c0c7f76..85a2c01f 100644 --- a/net/socket/connect_job.cc +++ b/net/socket/connect_job.cc
@@ -146,6 +146,10 @@ timer_.Start(FROM_HERE, remaining_time, this, &ConnectJob::OnTimeout); } +bool ConnectJob::TimerIsRunning() const { + return timer_.IsRunning(); +} + void ConnectJob::LogConnectStart() { connect_timing_.connect_start = base::TimeTicks::Now(); net_log().BeginEvent(net_log_connect_event_type_);
diff --git a/net/socket/connect_job.h b/net/socket/connect_job.h index be2939d6..c42b71d8 100644 --- a/net/socket/connect_job.h +++ b/net/socket/connect_job.h
@@ -233,8 +233,16 @@ void NotifyDelegateOfProxyAuth(const HttpResponseInfo& response, HttpAuthController* auth_controller, base::OnceClosure restart_with_auth_callback); + + // If |remaining_time| is base::TimeDelta(), stops the timeout timer, if it's + // running. Otherwise, Starts / restarts the timeout timer to trigger in the + // specified amount of time. void ResetTimer(base::TimeDelta remaining_time); + // Returns whether or not the timeout timer is running. Only intended for use + // by DCHECKs. + bool TimerIsRunning() const; + // Connection establishment timing information. // TODO(mmenke): This should be private. LoadTimingInfo::ConnectTiming connect_timing_;
diff --git a/net/socket/socks_connect_job.cc b/net/socket/socks_connect_job.cc index 68d18972..76ebde8 100644 --- a/net/socket/socks_connect_job.cc +++ b/net/socket/socks_connect_job.cc
@@ -18,9 +18,9 @@ namespace net { -// SOCKSConnectJobs will time out after this many seconds. Note this is in -// addition to the timeout for the transport socket. -static const int kSOCKSConnectJobTimeoutInSeconds = 30; +// SOCKSConnectJobs will time out if the SOCKS handshake takes longer than this. +static constexpr base::TimeDelta kSOCKSConnectJobTimeout = + base::TimeDelta::FromSeconds(30); SOCKSSocketParams::SOCKSSocketParams( scoped_refptr<TransportSocketParams> proxy_server_params, @@ -43,7 +43,7 @@ const NetLogWithSource* net_log) : ConnectJob(priority, socket_tag, - ConnectionTimeout(), + base::TimeDelta(), common_connect_job_params, delegate, net_log, @@ -77,9 +77,8 @@ next_state_ == STATE_SOCKS_CONNECT_COMPLETE; } -base::TimeDelta SOCKSConnectJob::ConnectionTimeout() { - return TransportConnectJob::ConnectionTimeout() + - base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds); +base::TimeDelta SOCKSConnectJob::HandshakeTimeoutForTesting() { + return kSOCKSConnectJobTimeout; } void SOCKSConnectJob::OnIOComplete(int result) { @@ -149,10 +148,8 @@ if (result != OK) return ERR_PROXY_CONNECTION_FAILED; - // Reset the timer to just the length of time allowed for SOCKS handshake - // so that a fast TCP connection plus a slow SOCKS failure doesn't take - // longer to timeout than it should. - ResetTimer(base::TimeDelta::FromSeconds(kSOCKSConnectJobTimeoutInSeconds)); + // Start the timer to time allowed for SOCKS handshake. + ResetTimer(kSOCKSConnectJobTimeout); next_state_ = STATE_SOCKS_CONNECT; return result; }
diff --git a/net/socket/socks_connect_job.h b/net/socket/socks_connect_job.h index ddd1766..f3d4131 100644 --- a/net/socket/socks_connect_job.h +++ b/net/socket/socks_connect_job.h
@@ -74,8 +74,8 @@ LoadState GetLoadState() const override; bool HasEstablishedConnection() const override; - // Returns the connection timeout used by SOCKSConnectJobs. - static base::TimeDelta ConnectionTimeout(); + // Returns the handshake timeout used by SOCKSConnectJobs. + static base::TimeDelta HandshakeTimeoutForTesting(); private: enum State {
diff --git a/net/socket/socks_connect_job_unittest.cc b/net/socket/socks_connect_job_unittest.cc index 75a51b2..9469220f 100644 --- a/net/socket/socks_connect_job_unittest.cc +++ b/net/socket/socks_connect_job_unittest.cc
@@ -280,11 +280,6 @@ // Check that SOCKSConnectJob's timeout is respected for the handshake phase. TEST_F(SOCKSConnectJobTest, TimeoutDuringHandshake) { - // This test assumes TransportConnectJobs have a shorter timeout than - // SOCKSConnectJobs. - ASSERT_LT(TransportConnectJob::ConnectionTimeout(), - SOCKSConnectJob::ConnectionTimeout()); - host_resolver_.set_ondemand_mode(true); MockWrite writes[] = { @@ -309,20 +304,17 @@ EXPECT_TRUE(host_resolver_.has_pending_requests()); // DNS resolution completes, and the socket connects. The request should not - // time out, even after the TransportConnectJob's timeout passes. + // time out, even after the TransportConnectJob's timeout passes. The + // SOCKSConnectJob's handshake timer should also be started. host_resolver_.ResolveAllPending(); - // The timer is now restarted with a value of - // SOCKSConnectJob::ConnectionTimeout() - - // TransportConnectJob::ConnectionTimeout(). Waiting until almost that much - // time has passed should cause no observable change in the SOCKSConnectJob's - // status. - FastForwardBy(SOCKSConnectJob::ConnectionTimeout() - - TransportConnectJob::ConnectionTimeout() - kTinyTime); + // Waiting until just before the SOCKS handshake times out. There should cause + // no observable change in the SOCKSConnectJob's status. + FastForwardBy(SOCKSConnectJob::HandshakeTimeoutForTesting() - kTinyTime); EXPECT_FALSE(test_delegate.has_result()); - // Wait for exactly the SOCKSConnectJob's timeout has fully elapsed. The Job - // should time out. + // Wait for exactly the SOCKSConnectJob's handshake timeout has fully elapsed. + // The Job should time out. FastForwardBy(kTinyTime); EXPECT_FALSE(host_resolver_.has_pending_requests()); EXPECT_TRUE(test_delegate.has_result());
diff --git a/net/socket/ssl_connect_job.cc b/net/socket/ssl_connect_job.cc index 93498ac..b88e485c 100644 --- a/net/socket/ssl_connect_job.cc +++ b/net/socket/ssl_connect_job.cc
@@ -32,6 +32,14 @@ namespace net { +namespace { + +// Timeout for the SSL handshake portion of the connect. +constexpr base::TimeDelta kSSLHandshakeTimeout( + base::TimeDelta::FromSeconds(30)); + +} // namespace + SSLSocketParams::SSLSocketParams( scoped_refptr<TransportSocketParams> direct_params, scoped_refptr<SOCKSSocketParams> socks_proxy_params, @@ -87,9 +95,6 @@ return http_proxy_params_; } -// Timeout for the SSL handshake portion of the connect. -static const int kSSLHandshakeTimeoutInSeconds = 30; - SSLConnectJob::SSLConnectJob( RequestPriority priority, const SocketTag& socket_tag, @@ -97,16 +102,16 @@ scoped_refptr<SSLSocketParams> params, ConnectJob::Delegate* delegate, const NetLogWithSource* net_log) - : ConnectJob(priority, - socket_tag, - ConnectionTimeout( - *params, - common_connect_job_params->network_quality_estimator), - common_connect_job_params, - delegate, - net_log, - NetLogSourceType::SSL_CONNECT_JOB, - NetLogEventType::SSL_CONNECT_JOB_CONNECT), + : ConnectJob( + priority, + socket_tag, + // The SSLConnectJob's timer is only started during the SSL handshake. + base::TimeDelta(), + common_connect_job_params, + delegate, + net_log, + NetLogSourceType::SSL_CONNECT_JOB, + NetLogEventType::SSL_CONNECT_JOB_CONNECT), params_(std::move(params)), callback_(base::BindRepeating(&SSLConnectJob::OnIOComplete, base::Unretained(this))) {} @@ -159,8 +164,9 @@ ConnectJob* job) { DCHECK_EQ(next_state_, STATE_TUNNEL_CONNECT_COMPLETE); - // Stop running the connection timer while potentially waiting for user input. - ResetTimer(base::TimeDelta()); + // The timer shouldn't have started running yet, since the handshake only + // starts after a tunnel has been established through the proxy. + DCHECK(!TimerIsRunning()); // Just pass the callback up to the consumer. This class doesn't need to do // anything once credentials are provided. @@ -189,26 +195,8 @@ handle->set_connection_attempts(connection_attempts_); } -base::TimeDelta SSLConnectJob::ConnectionTimeout( - const SSLSocketParams& params, - const NetworkQualityEstimator* network_quality_estimator) { - SSLSocketParams::ConnectionType connection_type = params.GetConnectionType(); - - base::TimeDelta nested_job_timeout; - switch (connection_type) { - case SSLSocketParams::DIRECT: - nested_job_timeout = TransportConnectJob::ConnectionTimeout(); - break; - case SSLSocketParams::SOCKS_PROXY: - nested_job_timeout = SOCKSConnectJob::ConnectionTimeout(); - break; - case SSLSocketParams::HTTP_PROXY: - nested_job_timeout = HttpProxyConnectJob::ConnectionTimeout( - *params.GetHttpProxyConnectionParams(), network_quality_estimator); - break; - } - return nested_job_timeout + - base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds); +base::TimeDelta SSLConnectJob::HandshakeTimeoutForTesting() { + return kSSLHandshakeTimeout; } void SSLConnectJob::OnIOComplete(int result) { @@ -267,6 +255,7 @@ int SSLConnectJob::DoTransportConnect() { DCHECK(!nested_connect_job_); DCHECK(params_->GetDirectConnectionParams()); + DCHECK(!TimerIsRunning()); next_state_ = STATE_TRANSPORT_CONNECT_COMPLETE; nested_connect_job_ = TransportConnectJob::CreateTransportConnectJob( @@ -295,6 +284,7 @@ int SSLConnectJob::DoSOCKSConnect() { DCHECK(!nested_connect_job_); DCHECK(params_->GetSocksProxyConnectionParams()); + DCHECK(!TimerIsRunning()); next_state_ = STATE_SOCKS_CONNECT_COMPLETE; nested_connect_job_ = std::make_unique<SOCKSConnectJob>( @@ -315,6 +305,7 @@ int SSLConnectJob::DoTunnelConnect() { DCHECK(!nested_connect_job_); DCHECK(params_->GetHttpProxyConnectionParams()); + DCHECK(!TimerIsRunning()); next_state_ = STATE_TUNNEL_CONNECT_COMPLETE; scoped_refptr<HttpProxySocketParams> http_proxy_params = @@ -350,10 +341,12 @@ int SSLConnectJob::DoSSLConnect() { TRACE_EVENT0(NetTracingCategory(), "SSLConnectJob::DoSSLConnect"); + DCHECK(!TimerIsRunning()); + next_state_ = STATE_SSL_CONNECT_COMPLETE; - // Reset the timeout to just the time allowed for the SSL handshake. - ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds)); + // Set the timeout to just the time allowed for the SSL handshake. + ResetTimer(kSSLHandshakeTimeout); // If the handle has a fresh socket, get its connect start and DNS times. const LoadTimingInfo::ConnectTiming* socket_connect_timing = nullptr;
diff --git a/net/socket/ssl_connect_job.h b/net/socket/ssl_connect_job.h index 6b2f8534..b74953d 100644 --- a/net/socket/ssl_connect_job.h +++ b/net/socket/ssl_connect_job.h
@@ -103,11 +103,9 @@ void GetAdditionalErrorState(ClientSocketHandle* handle) override; - // Returns the connection timeout that will be used by a HttpProxyConnectJob - // created with the specified parameters, given current network conditions. - static base::TimeDelta ConnectionTimeout( - const SSLSocketParams& params, - const NetworkQualityEstimator* network_quality_estimator); + // Returns the timeout for the SSL handshake. This is the same for all + // connections regardless of whether or not there is a proxy in use. + static base::TimeDelta HandshakeTimeoutForTesting(); private: enum State {
diff --git a/net/socket/ssl_connect_job_unittest.cc b/net/socket/ssl_connect_job_unittest.cc index 166a9f9e..7d346ba 100644 --- a/net/socket/ssl_connect_job_unittest.cc +++ b/net/socket/ssl_connect_job_unittest.cc
@@ -208,6 +208,96 @@ } } +TEST_F(SSLConnectJobTest, TCPTimeout) { + const base::TimeDelta kTinyTime = base::TimeDelta::FromMicroseconds(1); + + // Make request hang. + host_resolver_.set_ondemand_mode(true); + + TestConnectJobDelegate test_delegate; + std::unique_ptr<ConnectJob> ssl_connect_job = + CreateConnectJob(&test_delegate); + ASSERT_THAT(ssl_connect_job->Connect(), test::IsError(ERR_IO_PENDING)); + + // Right up until just before the TCP connection timeout, the job does not + // time out. + FastForwardBy(TransportConnectJob::ConnectionTimeout() - kTinyTime); + EXPECT_FALSE(test_delegate.has_result()); + + // But at the exact time of TCP connection timeout, the job fails. + FastForwardBy(kTinyTime); + EXPECT_TRUE(test_delegate.has_result()); + EXPECT_THAT(test_delegate.WaitForResult(), test::IsError(ERR_TIMED_OUT)); +} + +TEST_F(SSLConnectJobTest, SSLTimeoutSyncConnect) { + const base::TimeDelta kTinyTime = base::TimeDelta::FromMicroseconds(1); + + // DNS lookup and transport connect complete synchronously, but SSL + // negotiation hangs. + host_resolver_.set_synchronous_mode(true); + StaticSocketDataProvider data; + data.set_connect_data(MockConnect(SYNCHRONOUS, OK)); + socket_factory_.AddSocketDataProvider(&data); + SSLSocketDataProvider ssl(SYNCHRONOUS, ERR_IO_PENDING); + socket_factory_.AddSSLSocketDataProvider(&ssl); + + // Make request hang. + TestConnectJobDelegate test_delegate; + std::unique_ptr<ConnectJob> ssl_connect_job = + CreateConnectJob(&test_delegate); + ASSERT_THAT(ssl_connect_job->Connect(), test::IsError(ERR_IO_PENDING)); + + // Right up until just before the SSL handshake timeout, the job does not time + // out. + FastForwardBy(SSLConnectJob::HandshakeTimeoutForTesting() - kTinyTime); + EXPECT_FALSE(test_delegate.has_result()); + + // But at the exact SSL handshake timeout time, the job fails. + FastForwardBy(kTinyTime); + EXPECT_TRUE(test_delegate.has_result()); + EXPECT_THAT(test_delegate.WaitForResult(), test::IsError(ERR_TIMED_OUT)); +} + +TEST_F(SSLConnectJobTest, SSLTimeoutAsyncTcpConnect) { + const base::TimeDelta kTinyTime = base::TimeDelta::FromMicroseconds(1); + + // DNS lookup is asynchronous, and later SSL negotiation hangs. + host_resolver_.set_ondemand_mode(true); + StaticSocketDataProvider data; + data.set_connect_data(MockConnect(SYNCHRONOUS, OK)); + socket_factory_.AddSocketDataProvider(&data); + SSLSocketDataProvider ssl(SYNCHRONOUS, ERR_IO_PENDING); + socket_factory_.AddSSLSocketDataProvider(&ssl); + + TestConnectJobDelegate test_delegate; + std::unique_ptr<ConnectJob> ssl_connect_job = + CreateConnectJob(&test_delegate); + // Connecting should hand on the TransportConnectJob connect. + ASSERT_THAT(ssl_connect_job->Connect(), test::IsError(ERR_IO_PENDING)); + + // Right up until just before the TCP connection timeout, the job does not + // time out. + FastForwardBy(TransportConnectJob::ConnectionTimeout() - kTinyTime); + EXPECT_FALSE(test_delegate.has_result()); + + // The DNS lookup completes, and a TCP connection is immediately establshed, + // which cancels the TCP connection timer. The SSL handshake timer is started, + // and the SSL handshake hangs. + host_resolver_.ResolveOnlyRequestNow(); + EXPECT_FALSE(test_delegate.has_result()); + + // Right up until just before the SSL handshake timeout, the job does not time + // out. + FastForwardBy(SSLConnectJob::HandshakeTimeoutForTesting() - kTinyTime); + EXPECT_FALSE(test_delegate.has_result()); + + // But at the exact SSL handshake timeout time, the job fails. + FastForwardBy(kTinyTime); + EXPECT_TRUE(test_delegate.has_result()); + EXPECT_THAT(test_delegate.WaitForResult(), test::IsError(ERR_TIMED_OUT)); +} + TEST_F(SSLConnectJobTest, BasicDirectSync) { host_resolver_.set_synchronous_mode(true); StaticSocketDataProvider data;
diff --git a/net/socket/transport_connect_job_unittest.cc b/net/socket/transport_connect_job_unittest.cc index 0d42d4d..0b14db6 100644 --- a/net/socket/transport_connect_job_unittest.cc +++ b/net/socket/transport_connect_job_unittest.cc
@@ -8,6 +8,7 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/test/scoped_task_environment.h" #include "net/base/address_family.h" #include "net/base/address_list.h" #include "net/base/ip_address.h" @@ -29,10 +30,15 @@ const char kHostName[] = "unresolvable.host.name"; -class TransportConnectJobTest : public TestWithScopedTaskEnvironment { +class TransportConnectJobTest : public WithScopedTaskEnvironment, + public testing::Test { public: TransportConnectJobTest() - : client_socket_factory_(&net_log_), + : WithScopedTaskEnvironment( + base::test::ScopedTaskEnvironment::MainThreadType::MOCK_TIME, + base::test::ScopedTaskEnvironment::NowSource:: + MAIN_THREAD_MOCK_TIME), + client_socket_factory_(&net_log_), common_connect_job_params_( &client_socket_factory_, &host_resolver_, @@ -48,7 +54,11 @@ nullptr /* socket_performance_watcher_factory */, nullptr /* network_quality_estimator */, &net_log_, - nullptr /* websocket_endpoint_lock_manager */) {} + nullptr /* websocket_endpoint_lock_manager */) { + // Set an initial delay to ensure that calls to TimeTicks::Now() do not + // return a null value. + FastForwardBy(base::TimeDelta::FromSeconds(1)); + } ~TransportConnectJobTest() override {} @@ -140,10 +150,10 @@ for (bool host_resolution_synchronous : {false, true}) { host_resolver_.set_synchronous_mode(host_resolution_synchronous); TestConnectJobDelegate test_delegate; - TransportConnectJob transport_conect_job( + TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, DefaultParams(), &test_delegate, nullptr /* net_log */); - test_delegate.StartJobExpectingResult(&transport_conect_job, + test_delegate.StartJobExpectingResult(&transport_connect_job, ERR_NAME_NOT_RESOLVED, host_resolution_synchronous); } @@ -158,18 +168,83 @@ ? MockTransportClientSocketFactory::MOCK_FAILING_CLIENT_SOCKET : MockTransportClientSocketFactory:: MOCK_PENDING_FAILING_CLIENT_SOCKET); - ClientSocketHandle handle; TestConnectJobDelegate test_delegate; - TransportConnectJob transport_conect_job( + TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, DefaultParams(), &test_delegate, nullptr /* net_log */); test_delegate.StartJobExpectingResult( - &transport_conect_job, ERR_CONNECTION_FAILED, + &transport_connect_job, ERR_CONNECTION_FAILED, host_resolution_synchronous && connection_synchronous); } } } +TEST_F(TransportConnectJobTest, HostResolutionTimeout) { + const base::TimeDelta kTinyTime = base::TimeDelta::FromMicroseconds(1); + + // Make request hang. + host_resolver_.set_ondemand_mode(true); + + TestConnectJobDelegate test_delegate; + TransportConnectJob transport_connect_job( + DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, + DefaultParams(), &test_delegate, nullptr /* net_log */); + ASSERT_THAT(transport_connect_job.Connect(), test::IsError(ERR_IO_PENDING)); + + // Right up until just before expiration, the job does not time out. + FastForwardBy(TransportConnectJob::ConnectionTimeout() - kTinyTime); + EXPECT_FALSE(test_delegate.has_result()); + + // But at the exact time of expiration, the job fails. + FastForwardBy(kTinyTime); + EXPECT_TRUE(test_delegate.has_result()); + EXPECT_THAT(test_delegate.WaitForResult(), test::IsError(ERR_TIMED_OUT)); +} + +TEST_F(TransportConnectJobTest, ConnectionTimeout) { + const base::TimeDelta kTinyTime = base::TimeDelta::FromMicroseconds(1); + + // Half the timeout time. In the async case, spend half the time waiting on + // host resolution, half on connecting. + const base::TimeDelta kFirstHalfOfTimeout = + TransportConnectJob::ConnectionTimeout() / 2; + + const base::TimeDelta kSecondHalfOfTimeout = + TransportConnectJob::ConnectionTimeout() - kFirstHalfOfTimeout; + ASSERT_LE(kTinyTime, kSecondHalfOfTimeout); + + // Make connection attempts hang. + client_socket_factory_.set_default_client_socket_type( + MockTransportClientSocketFactory::MOCK_STALLED_CLIENT_SOCKET); + + for (bool host_resolution_synchronous : {false, true}) { + host_resolver_.set_ondemand_mode(!host_resolution_synchronous); + TestConnectJobDelegate test_delegate; + TransportConnectJob transport_connect_job( + DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, + DefaultParams(), &test_delegate, nullptr /* net_log */); + EXPECT_THAT(transport_connect_job.Connect(), test::IsError(ERR_IO_PENDING)); + + // After half the timeout, connection does not timeout. + FastForwardBy(kFirstHalfOfTimeout); + EXPECT_FALSE(test_delegate.has_result()); + + // In the async case, the host resolution completes now. + if (!host_resolution_synchronous) + host_resolver_.ResolveOnlyRequestNow(); + + // After (almost) the second half of timeout, just before the full timeout + // period, the ConnectJob is still live. + FastForwardBy(kSecondHalfOfTimeout - kTinyTime); + EXPECT_FALSE(test_delegate.has_result()); + + // But at the exact timeout time, the job fails. + FastForwardBy(kTinyTime); + EXPECT_TRUE(test_delegate.has_result()); + EXPECT_THAT(test_delegate.WaitForResult(), test::IsError(ERR_TIMED_OUT)); + } +} + TEST_F(TransportConnectJobTest, ConnectionSuccess) { for (bool host_resolution_synchronous : {false, true}) { for (bool connection_synchronous : {false, true}) { @@ -178,13 +253,12 @@ connection_synchronous ? MockTransportClientSocketFactory::MOCK_CLIENT_SOCKET : MockTransportClientSocketFactory::MOCK_PENDING_CLIENT_SOCKET); - ClientSocketHandle handle; TestConnectJobDelegate test_delegate; - TransportConnectJob transport_conect_job( + TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, DefaultParams(), &test_delegate, nullptr /* net_log */); test_delegate.StartJobExpectingResult( - &transport_conect_job, OK, + &transport_connect_job, OK, host_resolution_synchronous && connection_synchronous); } } @@ -207,10 +281,10 @@ std::string()); TestConnectJobDelegate test_delegate; - TransportConnectJob transport_conect_job( + TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, DefaultParams(), &test_delegate, nullptr /* net_log */); - test_delegate.StartJobExpectingResult(&transport_conect_job, OK, + test_delegate.StartJobExpectingResult(&transport_connect_job, OK, false /* expect_sync_result */); IPEndPoint endpoint; @@ -247,10 +321,10 @@ std::string()); TestConnectJobDelegate test_delegate; - TransportConnectJob transport_conect_job( + TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, DefaultParams(), &test_delegate, nullptr /* net_log */); - test_delegate.StartJobExpectingResult(&transport_conect_job, OK, + test_delegate.StartJobExpectingResult(&transport_connect_job, OK, false /* expect_sync_result */); IPEndPoint endpoint; @@ -277,10 +351,10 @@ kHostName, "2:abcd::3:4:ff,3:abcd::3:4:ff", std::string()); TestConnectJobDelegate test_delegate; - TransportConnectJob transport_conect_job( + TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, DefaultParams(), &test_delegate, nullptr /* net_log */); - test_delegate.StartJobExpectingResult(&transport_conect_job, OK, + test_delegate.StartJobExpectingResult(&transport_connect_job, OK, false /* expect_sync_result */); IPEndPoint endpoint; @@ -300,10 +374,10 @@ host_resolver_.rules()->AddIPLiteralRule(kHostName, "1.1.1.1", std::string()); TestConnectJobDelegate test_delegate; - TransportConnectJob transport_conect_job( + TransportConnectJob transport_connect_job( DEFAULT_PRIORITY, SocketTag(), &common_connect_job_params_, DefaultParams(), &test_delegate, nullptr /* net_log */); - test_delegate.StartJobExpectingResult(&transport_conect_job, OK, + test_delegate.StartJobExpectingResult(&transport_connect_job, OK, false /* expect_sync_result */); IPEndPoint endpoint;
diff --git a/ppapi/proxy/audio_input_resource.cc b/ppapi/proxy/audio_input_resource.cc index 60db9b8..96d6cff 100644 --- a/ppapi/proxy/audio_input_resource.cc +++ b/ppapi/proxy/audio_input_resource.cc
@@ -273,9 +273,10 @@ // Convert an AudioBus from deinterleaved float to interleaved integer data. // Store the result in a preallocated |client_buffer_|. - audio_bus_->ToInterleaved(audio_bus_->frames(), - kBitsPerAudioInputSample / 8, - client_buffer_.get()); + static_assert(kBitsPerAudioInputSample == 16, + "ToInterleaved expects 2 bytes."); + audio_bus_->ToInterleaved<media::SignedInt16SampleTypeTraits>( + audio_bus_->frames(), reinterpret_cast<int16_t*>(client_buffer_.get())); // Inform other side that we have read the data from the shared memory. ++buffer_index;
diff --git a/ppapi/proxy/audio_output_resource.cc b/ppapi/proxy/audio_output_resource.cc index d8a85cd..bd11c7c 100644 --- a/ppapi/proxy/audio_output_resource.cc +++ b/ppapi/proxy/audio_output_resource.cc
@@ -253,8 +253,10 @@ } // Deinterleave the audio data into the shared memory as floats. - audio_bus_->FromInterleaved(client_buffer_.get(), audio_bus_->frames(), - kBitsPerAudioOutputSample / 8); + static_assert(kBitsPerAudioOutputSample == 16, + "FromInterleaved expects 2 bytes."); + audio_bus_->FromInterleaved<media::SignedInt16SampleTypeTraits>( + reinterpret_cast<int16_t*>(client_buffer_.get()), audio_bus_->frames()); // Inform other side that we have read the data from the shared memory. // Let the other end know which buffer we just filled. The buffer index is
diff --git a/ppapi/shared_impl/ppb_audio_shared.cc b/ppapi/shared_impl/ppb_audio_shared.cc index dc67f415..241d6ecd2 100644 --- a/ppapi/shared_impl/ppb_audio_shared.cc +++ b/ppapi/shared_impl/ppb_audio_shared.cc
@@ -236,9 +236,10 @@ } // Deinterleave the audio data into the shared memory as floats. - audio_bus_->FromInterleaved(client_buffer_.get(), - audio_bus_->frames(), - kBitsPerAudioOutputSample / 8); + static_assert(kBitsPerAudioOutputSample == 16, + "FromInterleaved expects 2 bytes."); + audio_bus_->FromInterleaved<media::SignedInt16SampleTypeTraits>( + reinterpret_cast<int16_t*>(client_buffer_.get()), audio_bus_->frames()); // Let the other end know which buffer we just filled. The buffer index is // used to ensure the other end is getting the buffer it expects. For more
diff --git a/remoting/codec/audio_encoder_opus.cc b/remoting/codec/audio_encoder_opus.cc index 536c667..3831dc1 100644 --- a/remoting/codec/audio_encoder_opus.cc +++ b/remoting/codec/audio_encoder_opus.cc
@@ -127,9 +127,10 @@ int samples_left = (resampling_data_size_ - resampling_data_pos_) / kBytesPerSample / channels_; DCHECK_LE(audio_bus->frames(), samples_left); - audio_bus->FromInterleaved( - resampling_data_ + resampling_data_pos_, - audio_bus->frames(), kBytesPerSample); + static_assert(kBytesPerSample == 2, "FromInterleaved expects 2 bytes."); + audio_bus->FromInterleaved<media::SignedInt16SampleTypeTraits>( + reinterpret_cast<const int16_t*>(resampling_data_ + resampling_data_pos_), + audio_bus->frames()); resampling_data_pos_ += audio_bus->frames() * kBytesPerSample * channels_; DCHECK_LE(resampling_data_pos_, static_cast<int>(resampling_data_size_)); } @@ -186,8 +187,9 @@ resampling_data_ = nullptr; samples_consumed = resampling_data_pos_ / channels_ / kBytesPerSample; - resampler_bus_->ToInterleaved(kFrameSamples, kBytesPerSample, - resample_buffer_.get()); + static_assert(kBytesPerSample == 2, "ToInterleaved expects 2 bytes."); + resampler_bus_->ToInterleaved<media::SignedInt16SampleTypeTraits>( + kFrameSamples, reinterpret_cast<int16_t*>(resample_buffer_.get())); pcm_buffer = reinterpret_cast<int16_t*>(resample_buffer_.get()); } else { samples_consumed = frame_size_;
diff --git a/remoting/host/chromoting_host_context.cc b/remoting/host/chromoting_host_context.cc index 6606127..c4a66d9b 100644 --- a/remoting/host/chromoting_host_context.cc +++ b/remoting/host/chromoting_host_context.cc
@@ -163,12 +163,10 @@ // static std::unique_ptr<ChromotingHostContext> ChromotingHostContext::CreateForChromeOS( - scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, ui::SystemInputInjectorFactory* system_input_injector_factory) { - DCHECK(url_request_context_getter.get()); // AutoThreadTaskRunner is a TaskRunner with the special property that it will // continue to process tasks until no references remain, at least. The @@ -193,7 +191,8 @@ io_auto_task_runner, // network_task_runner ui_auto_task_runner, // video_capture_task_runner AutoThread::Create("ChromotingEncodeThread", file_auto_task_runner), - url_request_context_getter, system_input_injector_factory)); + base::MakeRefCounted<URLRequestContextGetter>(io_auto_task_runner), + system_input_injector_factory)); } #endif // defined(OS_CHROMEOS)
diff --git a/remoting/host/chromoting_host_context.h b/remoting/host/chromoting_host_context.h index f857b98..b223f27 100644 --- a/remoting/host/chromoting_host_context.h +++ b/remoting/host/chromoting_host_context.h
@@ -54,7 +54,6 @@ // the IO Thread of the browser process). // Instead, we re-use the |url_request_context_getter| in the browser process. static std::unique_ptr<ChromotingHostContext> CreateForChromeOS( - scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
diff --git a/remoting/host/it2me/it2me_native_messaging_host_chromeos.cc b/remoting/host/it2me/it2me_native_messaging_host_chromeos.cc index 6f9a5d6b..79376bd 100644 --- a/remoting/host/it2me/it2me_native_messaging_host_chromeos.cc +++ b/remoting/host/it2me/it2me_native_messaging_host_chromeos.cc
@@ -9,7 +9,6 @@ #include "base/lazy_instance.h" #include "base/task/post_task.h" #include "base/task/task_traits.h" -#include "net/url_request/url_request_context_getter.h" #include "remoting/base/auto_thread_task_runner.h" #include "remoting/host/chromoting_host_context.h" #include "remoting/host/it2me/it2me_native_messaging_host.h" @@ -54,14 +53,13 @@ std::unique_ptr<extensions::NativeMessageHost> CreateIt2MeNativeMessagingHostForChromeOS( - net::URLRequestContextGetter* system_request_context, scoped_refptr<base::SingleThreadTaskRunner> io_runnner, scoped_refptr<base::SingleThreadTaskRunner> ui_runnner, policy::PolicyService* policy_service) { std::unique_ptr<It2MeHostFactory> host_factory(new It2MeHostFactory()); std::unique_ptr<ChromotingHostContext> context = ChromotingHostContext::CreateForChromeOS( - base::WrapRefCounted(system_request_context), io_runnner, ui_runnner, + io_runnner, ui_runnner, base::CreateSingleThreadTaskRunnerWithTraits( {base::MayBlock(), base::TaskPriority::BEST_EFFORT}), GetInputInjector());
diff --git a/remoting/host/it2me/it2me_native_messaging_host_chromeos.h b/remoting/host/it2me/it2me_native_messaging_host_chromeos.h index 91bcc19..c371e43 100644 --- a/remoting/host/it2me/it2me_native_messaging_host_chromeos.h +++ b/remoting/host/it2me/it2me_native_messaging_host_chromeos.h
@@ -14,10 +14,6 @@ class SingleThreadTaskRunner; } // namespace base -namespace net { -class URLRequestContextGetter; -} // namespace net - namespace policy { class PolicyService; } // namespace policy @@ -29,7 +25,6 @@ std::unique_ptr<extensions::NativeMessageHost> CreateIt2MeNativeMessagingHostForChromeOS( - net::URLRequestContextGetter* system_request_context, scoped_refptr<base::SingleThreadTaskRunner> io_runnner, scoped_refptr<base::SingleThreadTaskRunner> ui_runnner, policy::PolicyService* policy_service);
diff --git a/services/device/hid/hid_connection_linux.cc b/services/device/hid/hid_connection_linux.cc index ea479b09..d5c61a6 100644 --- a/services/device/hid/hid_connection_linux.cc +++ b/services/device/hid/hid_connection_linux.cc
@@ -186,10 +186,11 @@ base::ScopedFD fd, scoped_refptr<base::SequencedTaskRunner> blocking_task_runner) : HidConnection(device_info), + helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner)), blocking_task_runner_(std::move(blocking_task_runner)), weak_factory_(this) { - helper_ = std::make_unique<BlockingTaskRunnerHelper>( - std::move(fd), device_info, weak_factory_.GetWeakPtr()); + helper_.reset(new BlockingTaskRunnerHelper(std::move(fd), device_info, + weak_factory_.GetWeakPtr())); blocking_task_runner_->PostTask( FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Start, base::Unretained(helper_.get()))); @@ -202,7 +203,7 @@ // base::ScopedFD is destroyed on a thread where I/O is allowed is satisfied // and 2) any tasks posted to this task runner that refer to this file will // complete before it is closed. - blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); + helper_.reset(); } void HidConnectionLinux::PlatformWrite(
diff --git a/services/device/hid/hid_connection_linux.h b/services/device/hid/hid_connection_linux.h index b1f2e46..e0bef86c 100644 --- a/services/device/hid/hid_connection_linux.h +++ b/services/device/hid/hid_connection_linux.h
@@ -11,6 +11,7 @@ #include "base/files/scoped_file.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "base/sequenced_task_runner.h" #include "services/device/hid/hid_connection.h" namespace base { @@ -44,7 +45,7 @@ // |helper_| lives on the sequence to which |blocking_task_runner_| posts // tasks so all calls must be posted there including this object's // destruction. - std::unique_ptr<BlockingTaskRunnerHelper> helper_; + std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_; const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
diff --git a/services/device/hid/hid_service_linux.cc b/services/device/hid/hid_service_linux.cc index c1e04c0..7272f9e 100644 --- a/services/device/hid/hid_service_linux.cc +++ b/services/device/hid/hid_service_linux.cc
@@ -193,17 +193,17 @@ HidServiceLinux::HidServiceLinux() : blocking_task_runner_( base::CreateSequencedTaskRunnerWithTraits(kBlockingTaskTraits)), + helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)), weak_factory_(this) { - helper_ = - std::make_unique<BlockingTaskRunnerHelper>(weak_factory_.GetWeakPtr()); + // We need to properly initialize |blocking_task_helper_| here because we need + // |weak_factory_| to be created first. + helper_.reset(new BlockingTaskRunnerHelper(weak_factory_.GetWeakPtr())); blocking_task_runner_->PostTask( FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Start, base::Unretained(helper_.get()))); } -HidServiceLinux::~HidServiceLinux() { - blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release()); -} +HidServiceLinux::~HidServiceLinux() = default; base::WeakPtr<HidService> HidServiceLinux::GetWeakPtr() { return weak_factory_.GetWeakPtr();
diff --git a/services/device/hid/hid_service_linux.h b/services/device/hid/hid_service_linux.h index 8db9e16..adb66f1 100644 --- a/services/device/hid/hid_service_linux.h +++ b/services/device/hid/hid_service_linux.h
@@ -11,6 +11,7 @@ #include "base/files/scoped_file.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" +#include "base/sequenced_task_runner.h" #include "build/build_config.h" #include "services/device/hid/hid_device_info.h" #include "services/device/hid/hid_service.h" @@ -51,7 +52,7 @@ // |helper_| lives on the sequence |blocking_task_runner_| posts to and holds // a weak reference back to the service that owns it. - std::unique_ptr<BlockingTaskRunnerHelper> helper_; + std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_; base::WeakPtrFactory<HidServiceLinux> weak_factory_; DISALLOW_COPY_AND_ASSIGN(HidServiceLinux);
diff --git a/services/identity/public/cpp/identity_test_environment.cc b/services/identity/public/cpp/identity_test_environment.cc index 83a9075b1..0f47843 100644 --- a/services/identity/public/cpp/identity_test_environment.cc +++ b/services/identity/public/cpp/identity_test_environment.cc
@@ -236,14 +236,6 @@ : owned_identity_manager_.get(); } -FakeProfileOAuth2TokenService* IdentityTestEnvironment::fake_token_service() { - // We can't absolutely guarantee that IdentityTestEnvironment was not given an - // IdentityManager that uses a non-fake FakeProfileOAuth2TokenService. If that - // ever happens, this will blow up. There doesn't seem to be a better option. - return static_cast<FakeProfileOAuth2TokenService*>( - identity_manager()->GetTokenService()); -} - TestIdentityManagerObserver* IdentityTestEnvironment::identity_manager_observer() { return test_identity_manager_observer_.get(); @@ -452,6 +444,14 @@ run_loop.Run(); } +FakeProfileOAuth2TokenService* IdentityTestEnvironment::fake_token_service() { + // We can't absolutely guarantee that IdentityTestEnvironment was not given an + // IdentityManager that uses a non-fake FakeProfileOAuth2TokenService. If that + // ever happens, this will blow up. There doesn't seem to be a better option. + return static_cast<FakeProfileOAuth2TokenService*>( + identity_manager()->GetTokenService()); +} + void IdentityTestEnvironment::UpdateAccountInfoForAccount( AccountInfo account_info) { identity::UpdateAccountInfoForAccount(identity_manager(), account_info);
diff --git a/services/identity/public/cpp/identity_test_environment.h b/services/identity/public/cpp/identity_test_environment.h index 2c59e3a86..caedd6257 100644 --- a/services/identity/public/cpp/identity_test_environment.h +++ b/services/identity/public/cpp/identity_test_environment.h
@@ -71,9 +71,6 @@ // The IdentityManager instance associated with this instance. IdentityManager* identity_manager(); - // Returns the FakeProfileOAuth2TokenService owned by IdentityManager. - FakeProfileOAuth2TokenService* fake_token_service(); - // Returns the |TestIdentityManagerObserver| watching the IdentityManager. TestIdentityManagerObserver* identity_manager_observer(); @@ -322,6 +319,9 @@ void WaitForAccessTokenRequestIfNecessary( base::Optional<std::string> account_id); + // Returns the FakeProfileOAuth2TokenService owned by IdentityManager. + FakeProfileOAuth2TokenService* fake_token_service(); + // Owner of all dependencies that don't belong to IdentityManager. std::unique_ptr<IdentityManagerDependenciesOwner> dependencies_owner_;
diff --git a/services/network/cert_verifier_with_trust_anchors_unittest.cc b/services/network/cert_verifier_with_trust_anchors_unittest.cc index 618356d..dcead0d5 100644 --- a/services/network/cert_verifier_with_trust_anchors_unittest.cc +++ b/services/network/cert_verifier_with_trust_anchors_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> #include <string> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -76,13 +77,13 @@ protected: int VerifyTestServerCert( - const net::TestCompletionCallback& test_callback, + net::CompletionOnceCallback test_callback, net::CertVerifyResult* verify_result, std::unique_ptr<net::CertVerifier::Request>* request) { return cert_verifier_->Verify( net::CertVerifier::RequestParams(test_server_cert_.get(), "127.0.0.1", 0, std::string()), - verify_result, test_callback.callback(), request, + verify_result, std::move(test_callback), request, net::NetLogWithSource()); } @@ -138,7 +139,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); error = callback.WaitForResult(); @@ -151,7 +153,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); EXPECT_EQ(net::ERR_CERT_AUTHORITY_INVALID, error); } @@ -174,7 +177,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); error = callback.WaitForResult(); @@ -193,7 +197,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); error = callback.WaitForResult(); @@ -212,7 +217,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); error = callback.WaitForResult(); @@ -226,7 +232,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); EXPECT_EQ(net::OK, error); } EXPECT_TRUE(WasTrustAnchorUsedAndReset()); @@ -237,7 +244,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); // Note: Changing the trust anchors should flush the cache. ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); @@ -258,7 +266,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); error = callback.WaitForResult(); @@ -277,7 +286,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); error = callback.WaitForResult(); @@ -294,7 +304,8 @@ net::CertVerifyResult verify_result; net::TestCompletionCallback callback; std::unique_ptr<net::CertVerifier::Request> request; - int error = VerifyTestServerCert(callback, &verify_result, &request); + int error = + VerifyTestServerCert(callback.callback(), &verify_result, &request); ASSERT_EQ(net::ERR_IO_PENDING, error); EXPECT_TRUE(request); error = callback.WaitForResult();
diff --git a/services/tracing/BUILD.gn b/services/tracing/BUILD.gn index fde436c..f03baab 100644 --- a/services/tracing/BUILD.gn +++ b/services/tracing/BUILD.gn
@@ -2,8 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/chromecast_build.gni") - # There should be only one tracing service. It is currently # in the browser process. So, only //content/browser should link to this target. # Others modules should only need the public targets. @@ -45,10 +43,6 @@ deps = [ "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", ] - - if (is_chromecast) { - defines = [ "IS_CHROMECAST" ] - } } source_set("manifest") { @@ -123,8 +117,4 @@ "//third_party/perfetto/protos/perfetto/trace/track_event:lite", ] } - - if (is_chromecast) { - defines = [ "IS_CHROMECAST" ] - } }
diff --git a/services/tracing/perfetto/consumer_host.cc b/services/tracing/perfetto/consumer_host.cc index e72cfe8..5dca673 100644 --- a/services/tracing/perfetto/consumer_host.cc +++ b/services/tracing/perfetto/consumer_host.cc
@@ -4,6 +4,7 @@ #include "services/tracing/perfetto/consumer_host.h" +#include <algorithm> #include <cstring> #include <string> #include <tuple> @@ -18,10 +19,13 @@ #include "build/build_config.h" #include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/system/wait.h" +#include "services/tracing/perfetto/json_trace_exporter.h" #include "services/tracing/perfetto/perfetto_service.h" +#include "services/tracing/perfetto/track_event_json_exporter.h" #include "third_party/perfetto/include/perfetto/tracing/core/observable_events.h" #include "third_party/perfetto/include/perfetto/tracing/core/trace_config.h" #include "third_party/perfetto/include/perfetto/tracing/core/trace_packet.h" +#include "third_party/perfetto/include/perfetto/tracing/core/trace_stats.h" #include "third_party/perfetto/protos/perfetto/config/trace_config.pb.h" namespace tracing { @@ -84,8 +88,10 @@ tracing_session_ = std::move(tracing_session); + perfetto::TraceConfig trace_config_copy = AdjustTraceConfig(trace_config); + filtered_pids_.clear(); - for (const auto& ds_config : trace_config.data_sources()) { + for (const auto& ds_config : trace_config_copy.data_sources()) { if (ds_config.config().name() == mojom::kTraceEventDataSourceName) { for (const auto& filter : ds_config.producer_name_filter()) { base::ProcessId pid; @@ -101,10 +107,27 @@ base::EraseIf(*pending_enable_tracing_ack_pids_, [this](base::ProcessId pid) { return !IsExpectedPid(pid); }); - consumer_endpoint_->EnableTracing(trace_config); + consumer_endpoint_->EnableTracing(trace_config_copy); MaybeSendEnableTracingAck(); } +void ConsumerHost::ChangeTraceConfig( + const perfetto::TraceConfig& trace_config) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + perfetto::TraceConfig trace_config_copy = AdjustTraceConfig(trace_config); + consumer_endpoint_->ChangeTraceConfig(trace_config_copy); +} + +perfetto::TraceConfig ConsumerHost::AdjustTraceConfig( + const perfetto::TraceConfig& trace_config) { + perfetto::TraceConfig trace_config_copy(trace_config); + // Clock snapshotting is incompatible with chrome's process sandboxing. + // Telemetry uses its own way of snapshotting clocks anyway. + trace_config_copy.set_disable_clock_snapshotting(true); + return trace_config_copy; +} + void ConsumerHost::DisableTracing() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); consumer_endpoint_->DisableTracing(); @@ -135,11 +158,43 @@ consumer_endpoint_->ReadBuffers(); } +void ConsumerHost::DisableTracingAndEmitJson( + const std::string& agent_label_filter, + mojo::ScopedDataPipeProducerHandle stream, + DisableTracingAndEmitJsonCallback callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(!read_buffers_stream_ && !read_buffers_callback_ && + !json_trace_exporter_); + + read_buffers_stream_ = std::move(stream); + read_buffers_callback_ = std::move(callback); + + // TODO(eseckler): Support argument filtering. + json_trace_exporter_ = std::make_unique<TrackEventJSONExporter>( + JSONTraceExporter::ArgumentFilterPredicate(), + base::BindRepeating(&ConsumerHost::OnJSONTraceData, + base::Unretained(this))); + + json_trace_exporter_->set_label_filter(agent_label_filter); + + consumer_endpoint_->DisableTracing(); +} + void ConsumerHost::FreeBuffers() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); consumer_endpoint_->FreeBuffers(); } +void ConsumerHost::RequestBufferUsage(RequestBufferUsageCallback callback) { + if (!request_buffer_usage_callback_.is_null()) { + std::move(callback).Run(false, 0); + return; + } + + request_buffer_usage_callback_ = std::move(callback); + consumer_endpoint_->GetTraceStats(); +} + void ConsumerHost::OnConnect() {} void ConsumerHost::OnDisconnect() {} @@ -149,11 +204,23 @@ DCHECK(tracing_session_); tracing_session_.reset(); pending_enable_tracing_ack_pids_.reset(); + + if (json_trace_exporter_) { + consumer_endpoint_->ReadBuffers(); + } } void ConsumerHost::OnTraceData(std::vector<perfetto::TracePacket> packets, bool has_more) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (json_trace_exporter_) { + json_trace_exporter_->OnTraceData(std::move(packets), has_more); + if (!has_more) { + json_trace_exporter_.reset(); + } + return; + } + for (auto& packet : packets) { char* data; size_t size; @@ -239,6 +306,44 @@ return filtered_pids_.empty() || base::ContainsKey(filtered_pids_, pid); } +void ConsumerHost::OnTraceStats(bool success, + const perfetto::TraceStats& stats) { + if (!request_buffer_usage_callback_) { + return; + } + + if (!success) { + std::move(request_buffer_usage_callback_).Run(false, 0.0f); + return; + } + + DCHECK_EQ(1, stats.buffer_stats_size()); + const perfetto::TraceStats::BufferStats& buf_stats = stats.buffer_stats()[0]; + size_t bytes_in_buffer = buf_stats.bytes_written() - buf_stats.bytes_read() - + buf_stats.bytes_overwritten() + + buf_stats.padding_bytes_written() - + buf_stats.padding_bytes_cleared(); + double percent_full = + bytes_in_buffer / static_cast<double>(buf_stats.buffer_size()); + percent_full = std::min(std::max(0.0, percent_full), 1.0); + std::move(request_buffer_usage_callback_).Run(true, percent_full); +} + +void ConsumerHost::OnJSONTraceData(const std::string& json, + base::DictionaryValue* metadata, + bool has_more) { + WriteToStream(json.data(), json.size()); + + if (has_more) { + return; + } + + read_buffers_stream_.reset(); + if (read_buffers_callback_) { + std::move(read_buffers_callback_).Run(); + } +} + void ConsumerHost::WriteToStream(const void* start, size_t size) { TRACE_EVENT0("ipc", "ConsumerHost::WriteToStream"); DCHECK(read_buffers_stream_.is_valid());
diff --git a/services/tracing/perfetto/consumer_host.h b/services/tracing/perfetto/consumer_host.h index 633cacc6..3216ef8 100644 --- a/services/tracing/perfetto/consumer_host.h +++ b/services/tracing/perfetto/consumer_host.h
@@ -23,6 +23,7 @@ namespace tracing { +class JSONTraceExporter; class PerfettoService; // This is a Mojo interface which enables any client @@ -45,10 +46,16 @@ // mojom::ConsumerHost implementation. void EnableTracing(mojom::TracingSessionPtr tracing_session, const perfetto::TraceConfig& config) override; + void ChangeTraceConfig(const perfetto::TraceConfig& config) override; + void DisableTracing() override; void ReadBuffers(mojo::ScopedDataPipeProducerHandle stream, ReadBuffersCallback callback) override; + void DisableTracingAndEmitJson( + const std::string& agent_label_filter, + mojo::ScopedDataPipeProducerHandle stream, + DisableTracingAndEmitJsonCallback callback) override; + void RequestBufferUsage(RequestBufferUsageCallback callback) override; - void DisableTracing(); void Flush(uint32_t timeout, base::OnceCallback<void(bool)> callback); void FreeBuffers(); @@ -61,11 +68,11 @@ void OnTraceData(std::vector<perfetto::TracePacket> packets, bool has_more) override; void OnObservableEvents(const perfetto::ObservableEvents&) override; + void OnTraceStats(bool success, const perfetto::TraceStats&) override; // Unused in Chrome. void OnDetach(bool success) override {} void OnAttach(bool success, const perfetto::TraceConfig&) override {} - void OnTraceStats(bool success, const perfetto::TraceStats&) override {} // Called by TracingService. void OnActiveServicePidAdded(base::ProcessId pid); @@ -73,8 +80,13 @@ void OnActiveServicePidsInitialized(); private: + perfetto::TraceConfig AdjustTraceConfig( + const perfetto::TraceConfig& trace_config); void MaybeSendEnableTracingAck(); bool IsExpectedPid(base::ProcessId pid) const; + void OnJSONTraceData(const std::string& json, + base::DictionaryValue* metadata, + bool has_more); void WriteToStream(const void* start, size_t size); PerfettoService* const service_; @@ -86,6 +98,8 @@ // If set, we didn't issue OnTracingEnabled() on the session yet. If set and // empty, no more pids are pending and we should issue OnTracingEnabled(). base::Optional<std::set<base::ProcessId>> pending_enable_tracing_ack_pids_; + RequestBufferUsageCallback request_buffer_usage_callback_; + std::unique_ptr<JSONTraceExporter> json_trace_exporter_; SEQUENCE_CHECKER(sequence_checker_);
diff --git a/services/tracing/perfetto/perfetto_tracing_coordinator.cc b/services/tracing/perfetto/perfetto_tracing_coordinator.cc index f3b1f1f..408e687 100644 --- a/services/tracing/perfetto/perfetto_tracing_coordinator.cc +++ b/services/tracing/perfetto/perfetto_tracing_coordinator.cc
@@ -20,6 +20,7 @@ #include "services/tracing/perfetto/consumer_host.h" #include "services/tracing/perfetto/perfetto_service.h" #include "services/tracing/perfetto/track_event_json_exporter.h" +#include "services/tracing/public/cpp/perfetto/perfetto_config.h" #include "services/tracing/public/cpp/trace_event_args_whitelist.h" #include "services/tracing/public/mojom/constants.mojom.h" #include "services/tracing/public/mojom/perfetto_service.mojom.h" @@ -94,34 +95,11 @@ perfetto::TraceConfig CreatePerfettoConfiguration( const base::trace_event::TraceConfig& chrome_config) { - perfetto::TraceConfig perfetto_config; - size_t size_limit = chrome_config.GetTraceBufferSizeInKb(); - if (size_limit == 0) { - size_limit = 100 * 1024; - } - perfetto_config.add_buffers()->set_size_kb(size_limit); - - // Perfetto uses clock_gettime for its internal snapshotting, which gets - // blocked by the sandboxed and isn't needed for Chrome regardless. - perfetto_config.set_disable_clock_snapshotting(true); - - auto* trace_event_data_source = perfetto_config.add_data_sources(); - for (auto& enabled_pid : - chrome_config.process_filter_config().included_process_ids()) { - *trace_event_data_source->add_producer_name_filter() = base::StrCat( - {mojom::kPerfettoProducerNamePrefix, - base::NumberToString(static_cast<uint32_t>(enabled_pid))}); - } - - // We strip the process filter from the config string we send to Perfetto, - // so perfetto doesn't reject it from a future - // TracingService::ChangeTraceConfig call due to being an unsupported - // update. +#if DCHECK_IS_ON() base::trace_event::TraceConfig processfilter_stripped_config(chrome_config); processfilter_stripped_config.SetProcessFilterConfig( base::trace_event::TraceConfig::ProcessFilterConfig()); -#if DCHECK_IS_ON() // Ensure that the process filter is the only thing that gets changed // in a configuration during a tracing session. DCHECK((last_config_for_perfetto_.ToString() == @@ -131,40 +109,7 @@ last_config_for_perfetto_ = processfilter_stripped_config; #endif - auto* trace_event_config = trace_event_data_source->mutable_config(); - trace_event_config->set_name(mojom::kTraceEventDataSourceName); - trace_event_config->set_target_buffer(0); - auto* chrome_proto_config = trace_event_config->mutable_chrome_config(); - chrome_proto_config->set_trace_config( - processfilter_stripped_config.ToString()); - -// Only CrOS and Cast support system tracing. -#if defined(OS_CHROMEOS) || (defined(IS_CHROMECAST) && defined(OS_LINUX)) - auto* system_trace_config = - perfetto_config.add_data_sources()->mutable_config(); - system_trace_config->set_name(mojom::kSystemTraceDataSourceName); - system_trace_config->set_target_buffer(0); - auto* system_chrome_config = system_trace_config->mutable_chrome_config(); - system_chrome_config->set_trace_config( - processfilter_stripped_config.ToString()); -#endif - -#if defined(OS_CHROMEOS) - auto* arc_trace_config = - perfetto_config.add_data_sources()->mutable_config(); - arc_trace_config->set_name(mojom::kArcTraceDataSourceName); - arc_trace_config->set_target_buffer(0); - auto* arc_chrome_config = arc_trace_config->mutable_chrome_config(); - arc_chrome_config->set_trace_config( - processfilter_stripped_config.ToString()); -#endif - - auto* trace_metadata_config = - perfetto_config.add_data_sources()->mutable_config(); - trace_metadata_config->set_name(mojom::kMetaDataSourceName); - trace_metadata_config->set_target_buffer(0); - - return perfetto_config; + return GetDefaultPerfettoConfig(chrome_config); } void StopAndFlush(mojo::ScopedDataPipeProducerHandle stream,
diff --git a/services/tracing/perfetto/track_event_json_exporter.cc b/services/tracing/perfetto/track_event_json_exporter.cc index 9f262461..9878a95 100644 --- a/services/tracing/perfetto/track_event_json_exporter.cc +++ b/services/tracing/perfetto/track_event_json_exporter.cc
@@ -6,6 +6,7 @@ #include <cinttypes> +#include "base/json/string_escape.h" #include "base/strings/string_util.h" #include "base/trace_event/common/trace_event_common.h" #include "third_party/perfetto/protos/perfetto/trace/chrome/chrome_trace_packet.pb.h" @@ -420,13 +421,25 @@ auto iter = current_state_.interned_source_locations_.find(task.posted_from_iid()); DCHECK(iter != current_state_.interned_source_locations_.end()); + + // If source locations were turned off, only the file is provided. JSON + // expects the event to then have only an "src" attribute. + if (iter->second.second.empty()) { + auto* maybe_arg = args_builder->MaybeAddArg("src"); + if (maybe_arg) { + base::EscapeJSONString(iter->second.first, true, + maybe_arg->mutable_out()); + } + return; + } + auto* maybe_arg = args_builder->MaybeAddArg("src_file"); if (maybe_arg) { - maybe_arg->AppendF("\"%s\"", iter->second.first.c_str()); + base::EscapeJSONString(iter->second.first, true, maybe_arg->mutable_out()); } maybe_arg = args_builder->MaybeAddArg("src_func"); if (maybe_arg) { - maybe_arg->AppendF("\"%s\"", iter->second.second.c_str()); + base::EscapeJSONString(iter->second.second, true, maybe_arg->mutable_out()); } }
diff --git a/services/tracing/perfetto/track_event_json_exporter_unittest.cc b/services/tracing/perfetto/track_event_json_exporter_unittest.cc index 89ebd549..140f96c 100644 --- a/services/tracing/perfetto/track_event_json_exporter_unittest.cc +++ b/services/tracing/perfetto/track_event_json_exporter_unittest.cc
@@ -1218,6 +1218,20 @@ ASSERT_TRUE(events[0]->HasArg("src_func")); EXPECT_EQ("file_name", events[0]->GetKnownArgAsString("src_file")); EXPECT_EQ("function_name", events[0]->GetKnownArgAsString("src_func")); + + // A source location without function name converts into a single "src" arg. + trace_packet_protos[3] + .mutable_interned_data() + ->mutable_source_locations(0) + ->clear_function_name(); + FinalizePackets(trace_packet_protos); + + ASSERT_EQ( + 1u, trace_analyzer()->FindEvents( + Query(Query::EVENT_NAME) == Query::String("legacy_event_name_3"), + &events)); + ASSERT_TRUE(events[0]->HasArg("src")); + EXPECT_EQ("file_name", events[0]->GetKnownArgAsString("src")); } TEST_F(TrackEventJsonExporterTest, DebugAnnotationRequiresName) {
diff --git a/services/tracing/public/cpp/BUILD.gn b/services/tracing/public/cpp/BUILD.gn index a5bd532..30942414 100644 --- a/services/tracing/public/cpp/BUILD.gn +++ b/services/tracing/public/cpp/BUILD.gn
@@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/chromecast_build.gni") + source_set("traced_process") { sources = [ "traced_process.cc", @@ -25,6 +27,8 @@ "base_agent.cc", "base_agent.h", "perfetto/interning_index.h", + "perfetto/perfetto_config.cc", + "perfetto/perfetto_config.h", "perfetto/producer_client.cc", "perfetto/producer_client.h", "perfetto/shared_memory.cc", @@ -68,5 +72,9 @@ "//third_party/perfetto/include/perfetto/protozero:protozero", "//third_party/perfetto/protos/perfetto/trace/chrome:minimal_complete_lite", ] + + if (is_chromecast) { + defines += [ "IS_CHROMECAST" ] + } } } # !is_nacl && !is_ios
diff --git a/services/tracing/public/cpp/perfetto/perfetto_config.cc b/services/tracing/public/cpp/perfetto/perfetto_config.cc new file mode 100644 index 0000000..2d73c53 --- /dev/null +++ b/services/tracing/public/cpp/perfetto/perfetto_config.cc
@@ -0,0 +1,83 @@ +// 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 "services/tracing/public/cpp/perfetto/perfetto_config.h" + +#include <cstdint> + +#include "base/strings/strcat.h" +#include "base/strings/string_number_conversions.h" +#include "base/trace_event/trace_config.h" +#include "build/build_config.h" +#include "services/tracing/public/mojom/perfetto_service.mojom.h" + +namespace tracing { + +perfetto::TraceConfig GetDefaultPerfettoConfig( + const base::trace_event::TraceConfig& chrome_config) { + perfetto::TraceConfig perfetto_config; + + size_t size_limit = chrome_config.GetTraceBufferSizeInKb(); + if (size_limit == 0) { + size_limit = 100 * 1024; + } + perfetto_config.add_buffers()->set_size_kb(size_limit); + + // Perfetto uses clock_gettime for its internal snapshotting, which gets + // blocked by the sandboxed and isn't needed for Chrome regardless. + perfetto_config.set_disable_clock_snapshotting(true); + + // Capture actual trace events. + auto* trace_event_data_source = perfetto_config.add_data_sources(); + for (auto& enabled_pid : + chrome_config.process_filter_config().included_process_ids()) { + *trace_event_data_source->add_producer_name_filter() = base::StrCat( + {mojom::kPerfettoProducerNamePrefix, + base::NumberToString(static_cast<uint32_t>(enabled_pid))}); + } + + // We strip the process filter from the config string we send to Perfetto, + // so perfetto doesn't reject it from a future + // TracingService::ChangeTraceConfig call due to being an unsupported + // update. + base::trace_event::TraceConfig processfilter_stripped_config(chrome_config); + processfilter_stripped_config.SetProcessFilterConfig( + base::trace_event::TraceConfig::ProcessFilterConfig()); + std::string chrome_config_string = processfilter_stripped_config.ToString(); + + auto* trace_event_config = trace_event_data_source->mutable_config(); + trace_event_config->set_name(tracing::mojom::kTraceEventDataSourceName); + trace_event_config->set_target_buffer(0); + auto* chrome_proto_config = trace_event_config->mutable_chrome_config(); + chrome_proto_config->set_trace_config(chrome_config_string); + +// Capture system trace events if supported and enabled. The datasources will +// only emit events if system tracing is enabled in |chrome_config|. +#if defined(OS_CHROMEOS) || (defined(IS_CHROMECAST) && defined(OS_LINUX)) + auto* system_trace_config = + perfetto_config.add_data_sources()->mutable_config(); + system_trace_config->set_name(tracing::mojom::kSystemTraceDataSourceName); + system_trace_config->set_target_buffer(0); + auto* system_chrome_config = system_trace_config->mutable_chrome_config(); + system_chrome_config->set_trace_config(chrome_config_string); +#endif + +#if defined(OS_CHROMEOS) + auto* arc_trace_config = perfetto_config.add_data_sources()->mutable_config(); + arc_trace_config->set_name(tracing::mojom::kArcTraceDataSourceName); + arc_trace_config->set_target_buffer(0); + auto* arc_chrome_config = arc_trace_config->mutable_chrome_config(); + arc_chrome_config->set_trace_config(chrome_config_string); +#endif + + // Also capture global metadata. + auto* trace_metadata_config = + perfetto_config.add_data_sources()->mutable_config(); + trace_metadata_config->set_name(tracing::mojom::kMetaDataSourceName); + trace_metadata_config->set_target_buffer(0); + + return perfetto_config; +} + +} // namespace tracing
diff --git a/services/tracing/public/cpp/perfetto/perfetto_config.h b/services/tracing/public/cpp/perfetto/perfetto_config.h new file mode 100644 index 0000000..84fef0f --- /dev/null +++ b/services/tracing/public/cpp/perfetto/perfetto_config.h
@@ -0,0 +1,24 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SERVICES_TRACING_PUBLIC_CPP_PERFETTO_PERFETTO_CONFIG_H_ +#define SERVICES_TRACING_PUBLIC_CPP_PERFETTO_PERFETTO_CONFIG_H_ + +#include "base/component_export.h" +#include "third_party/perfetto/include/perfetto/tracing/core/trace_config.h" + +namespace base { +namespace trace_event { +class TraceConfig; +} // namespace trace_event +} // namespace base + +namespace tracing { + +perfetto::TraceConfig COMPONENT_EXPORT(TRACING_CPP) GetDefaultPerfettoConfig( + const base::trace_event::TraceConfig& chrome_config); + +} // namespace tracing + +#endif // SERVICES_TRACING_PUBLIC_CPP_PERFETTO_PERFETTO_CONFIG_H_
diff --git a/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc b/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc index 8d5544d..0110022 100644 --- a/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc +++ b/services/tracing/public/cpp/perfetto/trace_event_data_source_unittest.cc
@@ -734,6 +734,52 @@ EXPECT_EQ(annotations[1].legacy_json_value(), kArgValue2); } +TEST_F(TraceEventDataSourceTest, TaskExecutionEvent) { + CreateTraceEventDataSource(); + + INTERNAL_TRACE_EVENT_ADD( + TRACE_EVENT_PHASE_INSTANT, "toplevel", "ThreadControllerImpl::RunTask", + TRACE_EVENT_SCOPE_THREAD | TRACE_EVENT_FLAG_TYPED_PROTO_ARGS, "src_file", + "my_file", "src_func", "my_func"); + + EXPECT_EQ(producer_client()->GetFinalizedPacketCount(), 2u); + auto* e_packet = producer_client()->GetFinalizedPacket(1); + ExpectTraceEvent(e_packet, /*category_iid=*/1u, /*name_iid=*/1u, + TRACE_EVENT_PHASE_INSTANT, TRACE_EVENT_SCOPE_THREAD); + + const auto& annotations = e_packet->track_event().debug_annotations(); + EXPECT_EQ(annotations.size(), 0); + + EXPECT_EQ(e_packet->track_event().task_execution().posted_from_iid(), 1u); + const auto& locations = e_packet->interned_data().source_locations(); + EXPECT_EQ(locations.size(), 1); + EXPECT_EQ(locations[0].file_name(), "my_file"); + EXPECT_EQ(locations[0].function_name(), "my_func"); +} + +TEST_F(TraceEventDataSourceTest, TaskExecutionEventWithoutFunction) { + CreateTraceEventDataSource(); + + INTERNAL_TRACE_EVENT_ADD( + TRACE_EVENT_PHASE_INSTANT, "toplevel", "ThreadControllerImpl::RunTask", + TRACE_EVENT_SCOPE_THREAD | TRACE_EVENT_FLAG_TYPED_PROTO_ARGS, "src", + "my_file"); + + EXPECT_EQ(producer_client()->GetFinalizedPacketCount(), 2u); + auto* e_packet = producer_client()->GetFinalizedPacket(1); + ExpectTraceEvent(e_packet, /*category_iid=*/1u, /*name_iid=*/1u, + TRACE_EVENT_PHASE_INSTANT, TRACE_EVENT_SCOPE_THREAD); + + const auto& annotations = e_packet->track_event().debug_annotations(); + EXPECT_EQ(annotations.size(), 0); + + EXPECT_EQ(e_packet->track_event().task_execution().posted_from_iid(), 1u); + const auto& locations = e_packet->interned_data().source_locations(); + EXPECT_EQ(locations.size(), 1); + EXPECT_EQ(locations[0].file_name(), "my_file"); + EXPECT_FALSE(locations[0].has_function_name()); +} + TEST_F(TraceEventDataSourceTest, UpdateDurationOfCompleteEvent) { CreateTraceEventDataSource();
diff --git a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc index 6dfcd6f..ae77a77 100644 --- a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc +++ b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.cc
@@ -4,8 +4,7 @@ #include "services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h" -#include <utility> - +#include "base/stl_util.h" #include "base/trace_event/common/trace_event_common.h" #include "base/trace_event/trace_buffer.h" #include "base/trace_event/trace_log.h" @@ -46,6 +45,12 @@ : base::ThreadTicks(); } +// Names of events that should be converted into a TaskExecution event. +const char* kTaskExecutionEventCategory = "toplevel"; +const char* kTaskExecutionEventNames[3] = {"ThreadControllerImpl::RunTask", + "ThreadController::Task", + "TaskScheduler_RunTask"}; + } // namespace // static @@ -164,6 +169,7 @@ InterningIndexEntry* interned_name; const size_t kMaxSize = base::trace_event::TraceArguments::kMaxSize; InterningIndexEntry* interned_annotation_names[kMaxSize] = {nullptr}; + InterningIndexEntry* interned_source_location = nullptr; if (copy_strings) { interned_name = @@ -175,10 +181,34 @@ } } else { interned_name = interned_event_names_.LookupOrAdd(trace_event->name()); - for (size_t i = 0; i < trace_event->arg_size() && trace_event->arg_name(i); - ++i) { - interned_annotation_names[i] = - interned_annotation_names_.LookupOrAdd(trace_event->arg_name(i)); + + // TODO(eseckler): Remove special handling of typed events here once we + // support them in TRACE_EVENT macros. + if (flags & TRACE_EVENT_FLAG_TYPED_PROTO_ARGS) { + DCHECK_EQ(strcmp(category_name, kTaskExecutionEventCategory), 0); + DCHECK(strcmp(trace_event->name(), kTaskExecutionEventNames[0]) == 0 || + strcmp(trace_event->name(), kTaskExecutionEventNames[1]) == 0 || + strcmp(trace_event->name(), kTaskExecutionEventNames[2]) == 0); + + if (trace_event->arg_size() == 2u) { + DCHECK_EQ(trace_event->arg_type(0), TRACE_VALUE_TYPE_STRING); + DCHECK_EQ(trace_event->arg_type(1), TRACE_VALUE_TYPE_STRING); + interned_source_location = interned_source_locations_.LookupOrAdd( + std::make_pair(trace_event->arg_value(0).as_string, + trace_event->arg_value(1).as_string)); + } else { + DCHECK_EQ(trace_event->arg_size(), 1u); + DCHECK_EQ(trace_event->arg_type(0), TRACE_VALUE_TYPE_STRING); + interned_source_location = interned_source_locations_.LookupOrAdd( + std::make_pair(trace_event->arg_value(0).as_string, + static_cast<const char*>(nullptr))); + } + } else { + for (size_t i = 0; + i < trace_event->arg_size() && trace_event->arg_name(i); ++i) { + interned_annotation_names[i] = + interned_annotation_names_.LookupOrAdd(trace_event->arg_name(i)); + } } } @@ -221,45 +251,50 @@ // TODO(eseckler): Split comma-separated category strings. track_event->add_category_iids(interned_category->id); - for (size_t i = 0; i < trace_event->arg_size() && trace_event->arg_name(i); - ++i) { - auto type = trace_event->arg_type(i); - auto* annotation = track_event->add_debug_annotations(); + if (interned_source_location) { + track_event->set_task_execution()->set_posted_from_iid( + interned_source_location->id); + } else { + for (size_t i = 0; i < trace_event->arg_size() && trace_event->arg_name(i); + ++i) { + auto type = trace_event->arg_type(i); + auto* annotation = track_event->add_debug_annotations(); - annotation->set_name_iid(interned_annotation_names[i]->id); + annotation->set_name_iid(interned_annotation_names[i]->id); - if (type == TRACE_VALUE_TYPE_CONVERTABLE) { - AddConvertableToTraceFormat(trace_event->arg_convertible_value(i), - annotation); - continue; - } + if (type == TRACE_VALUE_TYPE_CONVERTABLE) { + AddConvertableToTraceFormat(trace_event->arg_convertible_value(i), + annotation); + continue; + } - auto& value = trace_event->arg_value(i); - switch (type) { - case TRACE_VALUE_TYPE_BOOL: - annotation->set_bool_value(value.as_bool); - break; - case TRACE_VALUE_TYPE_UINT: - annotation->set_uint_value(value.as_uint); - break; - case TRACE_VALUE_TYPE_INT: - annotation->set_int_value(value.as_int); - break; - case TRACE_VALUE_TYPE_DOUBLE: - annotation->set_double_value(value.as_double); - break; - case TRACE_VALUE_TYPE_POINTER: - annotation->set_pointer_value(static_cast<uint64_t>( - reinterpret_cast<uintptr_t>(value.as_pointer))); - break; - case TRACE_VALUE_TYPE_STRING: - case TRACE_VALUE_TYPE_COPY_STRING: - annotation->set_string_value(value.as_string ? value.as_string - : "NULL"); - break; - default: - NOTREACHED() << "Don't know how to serialize this value"; - break; + auto& value = trace_event->arg_value(i); + switch (type) { + case TRACE_VALUE_TYPE_BOOL: + annotation->set_bool_value(value.as_bool); + break; + case TRACE_VALUE_TYPE_UINT: + annotation->set_uint_value(value.as_uint); + break; + case TRACE_VALUE_TYPE_INT: + annotation->set_int_value(value.as_int); + break; + case TRACE_VALUE_TYPE_DOUBLE: + annotation->set_double_value(value.as_double); + break; + case TRACE_VALUE_TYPE_POINTER: + annotation->set_pointer_value(static_cast<uint64_t>( + reinterpret_cast<uintptr_t>(value.as_pointer))); + break; + case TRACE_VALUE_TYPE_STRING: + case TRACE_VALUE_TYPE_COPY_STRING: + annotation->set_string_value(value.as_string ? value.as_string + : "NULL"); + break; + default: + NOTREACHED() << "Don't know how to serialize this value"; + break; + } } } @@ -371,13 +406,24 @@ interned_name->was_emitted = true; } - for (size_t i = 0; i < trace_event->arg_size() && trace_event->arg_name(i); - ++i) { - if (!interned_annotation_names[i]->was_emitted) { - auto* name_entry = interned_data->add_debug_annotation_names(); - name_entry->set_iid(interned_annotation_names[i]->id); - name_entry->set_name(trace_event->arg_name(i)); - interned_annotation_names[i]->was_emitted = true; + if (interned_source_location) { + auto* source_location_entry = interned_data->add_source_locations(); + source_location_entry->set_iid(interned_source_location->id); + source_location_entry->set_file_name(trace_event->arg_value(0).as_string); + if (trace_event->arg_size() > 1) { + source_location_entry->set_function_name( + trace_event->arg_value(1).as_string); + } + } else { + for (size_t i = 0; i < trace_event->arg_size() && trace_event->arg_name(i); + ++i) { + DCHECK(interned_annotation_names[i]); + if (!interned_annotation_names[i]->was_emitted) { + auto* name_entry = interned_data->add_debug_annotation_names(); + name_entry->set_iid(interned_annotation_names[i]->id); + name_entry->set_name(trace_event->arg_name(i)); + interned_annotation_names[i]->was_emitted = true; + } } }
diff --git a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h index d059a81..0d030804 100644 --- a/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h +++ b/services/tracing/public/cpp/perfetto/track_event_thread_local_event_sink.h
@@ -8,6 +8,7 @@ #include <cstdint> #include <memory> #include <string> +#include <utility> #include "base/component_export.h" #include "base/time/time.h" @@ -58,7 +59,8 @@ InterningIndex<const char*> interned_event_categories_; InterningIndex<const char*, std::string> interned_event_names_; InterningIndex<const char*, std::string> interned_annotation_names_; - InterningIndex<void*> interned_source_locations_; + InterningIndex<std::pair<const char*, const char*>> + interned_source_locations_; bool reset_incremental_state_ = true; base::TimeTicks last_timestamp_;
diff --git a/services/tracing/public/mojom/perfetto_service.mojom b/services/tracing/public/mojom/perfetto_service.mojom index a85ce30..97b707f 100644 --- a/services/tracing/public/mojom/perfetto_service.mojom +++ b/services/tracing/public/mojom/perfetto_service.mojom
@@ -146,6 +146,7 @@ struct DataSource { DataSourceConfig config; + array<string> producer_name_filter; }; // The configuration provided by a Consumer to the Perfetto service which @@ -165,12 +166,38 @@ // Enable Perfetto tracing with the given TracingSession interface for // signaling lifespan of the tracing session, and any future callbacks. EnableTracing(TracingSession tracing_session, TraceConfig config); + + // Update the trace config for the active tracing session. Currently, only + // (additive) updates to the |producer_name_filter| of a data source are + // supported. + ChangeTraceConfig(TraceConfig config); + + // Stop tracing for the active tracing session. The host will disconnect the + // TracingSession once tracing was disabled. Note that tracing may also stop + // without an explicit call to DisableTracing(), e.g. when a tracing duration + // is specified in the TraceConfig. + DisableTracing(); + // Tell Perfetto we're ready to receive data, over the given data pipe. // The result callback will be called when there's no more data currently // available. If the TracingSession is still active after the callback, // another call to ReadBuffers() needs to be made to receive any new // tracing data. ReadBuffers(handle<data_pipe_producer> stream) => (); + + // Disables tracing and converts the collected trace data converted into the + // legacy JSON format before returning it via the data pipe. If + // |agent_label_filter| is not empty, only data pertaining to the specified + // tracing agent label (e.g. "traceEvents") will be returned. + // + // DEPRECATED: Existing usecases only; new use cases of tracing should use the + // streaming proto format via ReadBuffers. + DisableTracingAndEmitJson(string agent_label_filter, + handle<data_pipe_producer> stream) => (); + + // Request current trace buffer usage of the active session. Will be returned + // as percentage value between 0.0f and 1.0f. + RequestBufferUsage() => (bool success, float percent_full); }; // Any client connecting to ConsumerHost should implement this
diff --git a/services/tracing/public/mojom/trace_config_mojom_traits.cc b/services/tracing/public/mojom/trace_config_mojom_traits.cc index 9c95a2eb..649fbe9 100644 --- a/services/tracing/public/mojom/trace_config_mojom_traits.cc +++ b/services/tracing/public/mojom/trace_config_mojom_traits.cc
@@ -31,6 +31,16 @@ } *out->mutable_config() = std::move(config); + + std::vector<std::string> producer_name_filter; + if (!data.ReadProducerNameFilter(&producer_name_filter)) { + return false; + } + + for (auto&& filter : producer_name_filter) { + *out->add_producer_name_filter() = std::move(filter); + } + return true; }
diff --git a/services/tracing/public/mojom/trace_config_mojom_traits.h b/services/tracing/public/mojom/trace_config_mojom_traits.h index 7606ac61c..018d1bd 100644 --- a/services/tracing/public/mojom/trace_config_mojom_traits.h +++ b/services/tracing/public/mojom/trace_config_mojom_traits.h
@@ -40,6 +40,11 @@ return src.config(); } + static const std::vector<std::string>& producer_name_filter( + const perfetto::TraceConfig::DataSource& src) { + return src.producer_name_filter(); + } + static bool Read(tracing::mojom::DataSourceDataView data, perfetto::TraceConfig::DataSource* out); };
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index 5b594ea..998a4d97 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -8380,6 +8380,13 @@ } ], "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 4 }, "test": "angle_end2end_tests" @@ -8399,7 +8406,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "angle_unittests" }, @@ -8420,7 +8434,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "browser_tests" }, @@ -8439,6 +8460,13 @@ } ], "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 4 }, "test": "dawn_end2end_tests" @@ -8457,7 +8485,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gl_tests" }, @@ -8474,7 +8509,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gl_unittests" }, @@ -8491,7 +8533,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gles2_conform_test" }, @@ -8505,7 +8554,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gpu_unittests" }, @@ -8523,7 +8579,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "services_unittests" }, @@ -8537,7 +8600,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "swiftshader_unittests" } @@ -8565,7 +8635,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8590,7 +8667,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8615,7 +8699,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8640,7 +8731,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8669,7 +8767,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8701,7 +8806,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8741,7 +8853,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8767,7 +8886,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8792,7 +8918,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -8820,6 +8953,13 @@ ], "expiration": 21600, "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 20 } }, @@ -8846,6 +8986,13 @@ ], "expiration": 21600, "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 2 } } @@ -8869,6 +9016,13 @@ } ], "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 4 }, "test": "angle_end2end_tests" @@ -8888,7 +9042,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "angle_unittests" }, @@ -8909,7 +9070,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "browser_tests" }, @@ -8928,6 +9096,13 @@ } ], "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 4 }, "test": "dawn_end2end_tests" @@ -8946,7 +9121,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gl_tests" }, @@ -8963,7 +9145,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gl_unittests" }, @@ -8980,7 +9169,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gles2_conform_test" }, @@ -8994,7 +9190,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gpu_unittests" }, @@ -9012,7 +9215,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "services_unittests" }, @@ -9026,7 +9236,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "swiftshader_unittests" } @@ -9054,7 +9271,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9079,7 +9303,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9104,7 +9335,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9129,7 +9367,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9158,7 +9403,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9190,7 +9442,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9230,7 +9489,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9256,7 +9522,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9281,7 +9554,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9309,6 +9589,13 @@ ], "expiration": 21600, "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 20 } }, @@ -9335,6 +9622,13 @@ ], "expiration": 21600, "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 2 } } @@ -9358,6 +9652,13 @@ } ], "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 4 }, "test": "angle_end2end_tests" @@ -9377,7 +9678,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "angle_unittests" }, @@ -9398,7 +9706,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "browser_tests" }, @@ -9417,6 +9732,13 @@ } ], "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 4 }, "test": "dawn_end2end_tests" @@ -9435,7 +9757,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gl_tests" }, @@ -9452,7 +9781,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gl_unittests" }, @@ -9469,7 +9805,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gles2_conform_test" }, @@ -9483,7 +9826,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "gpu_unittests" }, @@ -9501,7 +9851,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "services_unittests" }, @@ -9515,7 +9872,14 @@ "pool": "Chrome-GPU" } ], - "expiration": 21600 + "expiration": 21600, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } }, "test": "swiftshader_unittests" } @@ -9543,7 +9907,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9568,7 +9939,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9593,7 +9971,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9618,7 +10003,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9647,7 +10039,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9679,7 +10078,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9719,7 +10125,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9745,7 +10158,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9770,7 +10190,14 @@ } ], "expiration": 21600, - "idempotent": false + "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + } } }, { @@ -9798,6 +10225,13 @@ ], "expiration": 21600, "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 20 } }, @@ -9824,6 +10258,13 @@ ], "expiration": 21600, "idempotent": false, + "optional_dimensions": { + "600": [ + { + "os": "Mac-10.14.4" + } + ] + }, "shards": 2 } }
diff --git a/testing/buildbot/filters/webui_polymer1_browser_tests.filter b/testing/buildbot/filters/webui_polymer1_browser_tests.filter index 52057673..d306723 100644 --- a/testing/buildbot/filters/webui_polymer1_browser_tests.filter +++ b/testing/buildbot/filters/webui_polymer1_browser_tests.filter
@@ -123,6 +123,7 @@ CrSettingsFindShortcutBehavior.* CrSettingsFingerprintListTest.* CrSettingsFingerprintProgressArcTest.* +CrSettingsFocusRowBehavior.* CrSettingsGoogleAssistantPageTest.* CrSettingsImportDataDialogTest.* CrSettingsIncompatibleApplicationsPageTest.*
diff --git a/testing/buildbot/filters/webui_polymer1_interactive_ui_tests.filter b/testing/buildbot/filters/webui_polymer1_interactive_ui_tests.filter index da96b61..9f593642 100644 --- a/testing/buildbot/filters/webui_polymer1_interactive_ui_tests.filter +++ b/testing/buildbot/filters/webui_polymer1_interactive_ui_tests.filter
@@ -10,14 +10,12 @@ BookmarksFocusTest.All CrElementsActionMenuTest.All CrElementsCheckboxTest.All -CrElementsExpandButtonTest.All -CrElementsIconButtonFocusTest.All CrElementsInputTest.All CrElementsProfileAvatarSelectorFocusTest.All CrElementsToggleTest.All CrExtensionsOptionsPageTest.All -CrFocusRowBehaviorTest.FocusTest CrSettingsAnimatedPagesTest.All +CrSettingsFocusRowBehavior.FocusTest CrSettingsSyncPageTest.All HistoryFocusTest.All PrintPreviewDestinationDialogInteractiveTest.*
diff --git a/testing/buildbot/mixins.pyl b/testing/buildbot/mixins.pyl index 4530c2e..6e3ef005 100644 --- a/testing/buildbot/mixins.pyl +++ b/testing/buildbot/mixins.pyl
@@ -333,6 +333,15 @@ 'dimensions': { 'os': 'Mac-10.14.3', }, + 'optional_dimensions': { + # Wait 10 minutes for 10.14.4, then fall back to 10.14.3. + # The format for optional dimensions is: expiration: [{key, value}, ..]. + 600: [ + { + 'os': 'Mac-10.14.4', + }, + ], + }, }, }, 'mac_10.14_beta': {
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index ec6a0cc0..3b00c95 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2011,9 +2011,11 @@ "FCMInvalidationsExperiment": [ { "platforms": [ + "android", "windows", "mac", - "chromeos" + "chromeos", + "ios" ], "experiments": [ { @@ -2920,6 +2922,21 @@ ] } ], + "NativeWindowOcclusionTrackerWin": [ + { + "platforms": [ + "windows" + ], + "experiments": [ + { + "name": "NativeWindowOcclusionTrackerWin", + "enable_features": [ + "CalculateNativeWinOcclusion" + ] + } + ] + } + ], "NaviOnboarding": [ { "platforms": [ @@ -4841,7 +4858,8 @@ "windows", "mac", "chromeos", - "ios" + "ios", + "linux" ], "experiments": [ { @@ -5694,6 +5712,21 @@ ] } ], + "WebContentsOcclusion": [ + { + "platforms": [ + "windows" + ], + "experiments": [ + { + "name": "WindowsWebContentsOcclusion", + "enable_features": [ + "WebContentsOcclusion" + ] + } + ] + } + ], "WebPaymentsPerMethodCanMakePaymentQuota": [ { "platforms": [
diff --git a/third_party/blink/common/feature_policy/feature_policy.cc b/third_party/blink/common/feature_policy/feature_policy.cc index 916cd14..9c280177 100644 --- a/third_party/blink/common/feature_policy/feature_policy.cc +++ b/third_party/blink/common/feature_policy/feature_policy.cc
@@ -441,6 +441,9 @@ {mojom::FeaturePolicyFeature::kUnoptimizedLosslessImages, FeatureDefaultValue(FeaturePolicy::FeatureDefault::EnableForAll, mojom::PolicyValueType::kDecDouble)}, + {mojom::FeaturePolicyFeature::kUnoptimizedLosslessImagesStrict, + FeatureDefaultValue(FeaturePolicy::FeatureDefault::EnableForAll, + mojom::PolicyValueType::kDecDouble)}, {mojom::FeaturePolicyFeature::kUnoptimizedLossyImages, FeatureDefaultValue(FeaturePolicy::FeatureDefault::EnableForAll, mojom::PolicyValueType::kDecDouble)},
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index fd1e9afb7..e59781c06 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -36,10 +36,6 @@ const base::Feature kScriptStreaming{"ScriptStreaming", base::FEATURE_ENABLED_BY_DEFAULT}; -// Enables user level memory pressure signal generation on Android. -const base::Feature kUserLevelMemoryPressureSignal{ - "UserLevelMemoryPressureSignal", base::FEATURE_DISABLED_BY_DEFAULT}; - // Enable FCP++ by experiment. See https://crbug.com/869924 const base::Feature kFirstContentfulPaintPlusPlus{ "FirstContentfulPaintPlusPlus", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h index 8522f6fc..097f61eb 100644 --- a/third_party/blink/public/common/features.h +++ b/third_party/blink/public/common/features.h
@@ -19,7 +19,6 @@ BLINK_COMMON_EXPORT extern const base::Feature kEnableGpuRasterizationViewportRestriction; BLINK_COMMON_EXPORT extern const base::Feature kScriptStreaming; -BLINK_COMMON_EXPORT extern const base::Feature kUserLevelMemoryPressureSignal; BLINK_COMMON_EXPORT extern const base::Feature kFirstContentfulPaintPlusPlus; BLINK_COMMON_EXPORT extern const base::Feature kFreezePurgeMemoryAllPagesFrozen; BLINK_COMMON_EXPORT extern const base::Feature kImplicitRootScroller;
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index 343679a..8aae434 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn
@@ -93,6 +93,7 @@ "reporting/reporting.mojom", "script/script_type.mojom", "selection_menu/selection_menu_behavior.mojom", + "service_worker/controller_service_worker_mode.mojom", "service_worker/dispatch_fetch_event_params.mojom", "service_worker/navigation_preload_state.mojom", "service_worker/service_worker_client.mojom",
diff --git a/third_party/blink/public/mojom/feature_policy/feature_policy.mojom b/third_party/blink/public/mojom/feature_policy/feature_policy.mojom index 41a1a86..168e083b 100644 --- a/third_party/blink/public/mojom/feature_policy/feature_policy.mojom +++ b/third_party/blink/public/mojom/feature_policy/feature_policy.mojom
@@ -124,6 +124,7 @@ // When disallowed, these policies require images to have a reasonable byte-to-pixel ratio. kUnoptimizedLossyImages = 45, kUnoptimizedLosslessImages = 46, + kUnoptimizedLosslessImagesStrict = 47, // Don't change assigned numbers of any item, and don't reuse removed slots. // Add new features at the end of the enum.
diff --git a/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom b/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom index 80951cf..faeab18 100644 --- a/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom +++ b/third_party/blink/public/mojom/service_worker/controller_service_worker.mojom
@@ -7,6 +7,7 @@ import "mojo/public/mojom/base/time.mojom"; import "mojo/public/mojom/base/unguessable_token.mojom"; import "services/network/public/mojom/url_loader.mojom"; +import "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom"; import "third_party/blink/public/mojom/service_worker/dispatch_fetch_event_params.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_event_status.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_fetch_response_callback.mojom";
diff --git a/third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom b/third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom new file mode 100644 index 0000000..402efab --- /dev/null +++ b/third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom
@@ -0,0 +1,22 @@ +// Copyright 2019 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module blink.mojom; + +// Describes whether a controller service worker exists and if it has a fetch +// handler. +// +// BEWARE: In non-NetS13nServiceWorker, the renderer often does not know which +// controller service worker a request will go to, as skipWaiting() may occur +// in the browser process at the same time the renderer makes a request. +// Therefore, non-NetS13nServiceWorker should usually treat +// kNoFetchEventHandler and kControlled as the same. +enum ControllerServiceWorkerMode { + // No controller exists. + kNoController, + // The controller exists, but it has no fetch event handler. + kNoFetchEventHandler, + // The controller exists and it has a fetch event handler. + kControlled +};
diff --git a/third_party/blink/public/mojom/service_worker/service_worker_object.mojom b/third_party/blink/public/mojom/service_worker/service_worker_object.mojom index 7d2e193..7ef6ab5 100644 --- a/third_party/blink/public/mojom/service_worker/service_worker_object.mojom +++ b/third_party/blink/public/mojom/service_worker/service_worker_object.mojom
@@ -10,26 +10,6 @@ const int64 kInvalidServiceWorkerVersionId = -1; -// Describes whether a controller service worker exists and if it has a fetch -// handler. -// -// BEWARE: In non-NetS13nServiceWorker, the renderer often does not know which -// controller service worker a request will go to, as skipWaiting() may occur -// in the browser process at the same time the renderer makes a request. -// Therefore, non-NetS13nServiceWorker should usually treat -// kNoFetchEventHandler and kControlled as the same. -// -// TODO(falken): This should be moved to controller_service_worker.mojom once -// it moves to Blink. -enum ControllerServiceWorkerMode { - // No controller exists. - kNoController, - // The controller exists, but it has no fetch event handler. - kNoFetchEventHandler, - // The controller exists and it has a fetch event handler. - kControlled -}; - // Describes a ServiceWorker object: // https://w3c.github.io/ServiceWorker/#serviceworker-interface struct ServiceWorkerObjectInfo {
diff --git a/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom b/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom index a3a1018..f86e2681 100644 --- a/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom +++ b/third_party/blink/public/mojom/service_worker/service_worker_provider.mojom
@@ -7,6 +7,7 @@ import "services/network/public/mojom/url_loader_factory.mojom"; import "services/service_manager/public/mojom/interface_provider.mojom"; import "third_party/blink/public/mojom/cache_storage/cache_storage.mojom"; +import "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_container.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_object.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_provider_type.mojom";
diff --git a/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h b/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h index 80303ed..e2b1d91 100644 --- a/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h +++ b/third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h
@@ -34,7 +34,7 @@ #include <memory> #include "base/memory/scoped_refptr.h" -#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-shared.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom-shared.h" #include "third_party/blink/public/platform/scheduler/web_resource_loading_task_runner_handle.h" #include "third_party/blink/public/platform/web_url_loader.h"
diff --git a/third_party/blink/public/platform/web_callbacks.h b/third_party/blink/public/platform/web_callbacks.h index 0bf35efe..b02fa41e 100644 --- a/third_party/blink/public/platform/web_callbacks.h +++ b/third_party/blink/public/platform/web_callbacks.h
@@ -49,14 +49,6 @@ virtual void OnError(T) {} }; -template <typename T> -class WebCallbacks<void, T> { - public: - virtual ~WebCallbacks() = default; - virtual void OnSuccess() {} - virtual void OnError(T) {} -}; - template <typename S> class WebCallbacks<S, void> { public:
diff --git a/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h b/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h index a296155..6db8689 100644 --- a/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h +++ b/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h
@@ -19,6 +19,11 @@ virtual ~WebDedicatedWorkerHostFactoryClient() = default; // Requests the creation of DedicatedWorkerHost in the browser process. + // For non-PlzDedicatedWorker. This will be removed once PlzDedicatedWorker is + // enabled by default. + virtual void CreateWorkerHostDeprecated( + const blink::WebSecurityOrigin& script_origin) = 0; + // For PlzDedicatedWorker. virtual void CreateWorkerHost( const blink::WebURL& script_url, const blink::WebSecurityOrigin& script_origin,
diff --git a/third_party/blink/public/platform/web_worker_fetch_context.h b/third_party/blink/public/platform/web_worker_fetch_context.h index 96400c2..3f0c3d4 100644 --- a/third_party/blink/public/platform/web_worker_fetch_context.h +++ b/third_party/blink/public/platform/web_worker_fetch_context.h
@@ -10,7 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h" -#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-shared.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom-shared.h" #include "third_party/blink/public/platform/code_cache_loader.h" #include "third_party/blink/public/platform/web_application_cache_host.h" #include "third_party/blink/public/platform/web_document_subresource_filter.h"
diff --git a/third_party/blink/public/web/web_embedded_worker.h b/third_party/blink/public/web/web_embedded_worker.h index b91eb48..2b23e961 100644 --- a/third_party/blink/public/web/web_embedded_worker.h +++ b/third_party/blink/public/web/web_embedded_worker.h
@@ -40,7 +40,6 @@ namespace blink { -class WebContentSettingsClient; class WebServiceWorkerContextClient; class WebURL; struct WebConsoleMessage; @@ -61,11 +60,10 @@ class BLINK_EXPORT WebEmbeddedWorker { public: // Invoked on the main thread to instantiate a WebEmbeddedWorker. - // The given WebWorkerContextClient and WebContentSettingsClient are going to - // be passed on to the worker thread and is held by a newly created - // WorkerGlobalScope. + // WebServiceWorkerContextClient is owned by caller and must survive the + // instance of WebEmbeddedWorker. static std::unique_ptr<WebEmbeddedWorker> Create( - std::unique_ptr<WebServiceWorkerContextClient>, + WebServiceWorkerContextClient*, std::unique_ptr<WebServiceWorkerInstalledScriptsManagerParams>, mojo::ScopedMessagePipeHandle content_settings_handle, mojo::ScopedMessagePipeHandle cache_storage,
diff --git a/third_party/blink/public/web/web_view.h b/third_party/blink/public/web/web_view.h index 36d767e5..bff5b23 100644 --- a/third_party/blink/public/web/web_view.h +++ b/third_party/blink/public/web/web_view.h
@@ -177,7 +177,7 @@ virtual void ClearFocusedElement() = 0; // Smooth scroll the root layer to |targetX|, |targetY| in |durationMs|. - virtual void SmoothScroll(int target_x, int target_y, long duration_ms) {} + virtual void SmoothScroll(int target_x, int target_y, uint64_t duration_ms) {} // Advance the focus of the WebView forward to the next element or to the // previous element in the tab sequence (if reverse is true).
diff --git a/third_party/blink/public/web/web_widget.h b/third_party/blink/public/web/web_widget.h index cc22795..84299699 100644 --- a/third_party/blink/public/web/web_widget.h +++ b/third_party/blink/public/web/web_widget.h
@@ -120,6 +120,20 @@ virtual void BeginRafAlignedInput() {} virtual void EndRafAlignedInput() {} + // Methods called to mark the beginning and end of the + // LayerTreeHost::UpdateLayers method. Only called when gathering main frame + // UMA and UKM. That is, when RecordStartOfFrameMetrics has been called, and + // before RecordEndOfFrameMetrics has been called. + virtual void BeginUpdateLayers() {} + virtual void EndUpdateLayers() {} + + // Methods called to mark the beginning and end of a commit to the impl + // thread for a frame. Only called when gathering main frame + // UMA and UKM. That is, when RecordStartOfFrameMetrics has been called, and + // before RecordEndOfFrameMetrics has been called. + virtual void BeginCommitCompositorFrame() {} + virtual void EndCommitCompositorFrame() {} + // Called to run through the entire set of document lifecycle phases needed // to render a frame of the web widget. This MUST be called before Paint, // and it may result in calls to WebViewClient::DidInvalidateRect (for
diff --git a/third_party/blink/renderer/bindings/bindings.gni b/third_party/blink/renderer/bindings/bindings.gni index fc4c7df..070bdbd 100644 --- a/third_party/blink/renderer/bindings/bindings.gni +++ b/third_party/blink/renderer/bindings/bindings.gni
@@ -200,7 +200,6 @@ "core/v8/script_streamer_test.cc", "core/v8/script_wrappable_v8_gc_integration_test.cc", "core/v8/to_v8_test.cc", - "core/v8/trace_wrapper_member_test.cc", "core/v8/v8_binding_for_testing.cc", "core/v8/v8_binding_for_testing.h", "core/v8/window_proxy_test.cc",
diff --git a/third_party/blink/renderer/bindings/core/v8/js_event_handler.h b/third_party/blink/renderer/bindings/core/v8/js_event_handler.h index 891b866..fa8cf9c 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_event_handler.h +++ b/third_party/blink/renderer/bindings/core/v8/js_event_handler.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h" #include "third_party/blink/renderer/bindings/core/v8/v8_event_handler_non_null.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -104,7 +103,7 @@ Event&, v8::Local<v8::Value> js_event) override; - TraceWrapperMember<V8EventHandlerNonNull> event_handler_; + Member<V8EventHandlerNonNull> event_handler_; const HandlerType type_; };
diff --git a/third_party/blink/renderer/bindings/core/v8/js_event_listener.h b/third_party/blink/renderer/bindings/core/v8/js_event_listener.h index fb95090..13d6aa4 100644 --- a/third_party/blink/renderer/bindings/core/v8/js_event_listener.h +++ b/third_party/blink/renderer/bindings/core/v8/js_event_listener.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/bindings/core/v8/js_based_event_listener.h" #include "third_party/blink/renderer/bindings/core/v8/v8_event_listener.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -71,7 +70,7 @@ Event&, v8::Local<v8::Value> js_event) override; - const TraceWrapperMember<V8EventListener> event_listener_; + const Member<V8EventListener> event_listener_; }; template <>
diff --git a/third_party/blink/renderer/bindings/core/v8/scheduled_action.h b/third_party/blink/renderer/bindings/core/v8/scheduled_action.h index 1aa48763..5c6de14 100644 --- a/third_party/blink/renderer/bindings/core/v8/scheduled_action.h +++ b/third_party/blink/renderer/bindings/core/v8/scheduled_action.h
@@ -32,7 +32,6 @@ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_SCHEDULED_ACTION_H_ #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -83,7 +82,7 @@ void Execute(WorkerGlobalScope*); Member<ScriptStateProtectingContext> script_state_; - TraceWrapperMember<V8Function> function_; + Member<V8Function> function_; Vector<ScriptValue> arguments_; String code_; };
diff --git a/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.h b/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.h index 7fe8c4d..bde1fca 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.h +++ b/third_party/blink/renderer/bindings/core/v8/script_custom_element_definition.h
@@ -90,19 +90,16 @@ ExceptionState&); Member<ScriptState> script_state_; - TraceWrapperMember<V8CustomElementConstructor> constructor_; - TraceWrapperMember<V8VoidFunction> connected_callback_; - TraceWrapperMember<V8VoidFunction> disconnected_callback_; - TraceWrapperMember<V8CustomElementAdoptedCallback> adopted_callback_; - TraceWrapperMember<V8CustomElementAttributeChangedCallback> - attribute_changed_callback_; - TraceWrapperMember<V8CustomElementFormAssociatedCallback> - form_associated_callback_; - TraceWrapperMember<V8VoidFunction> form_reset_callback_; - TraceWrapperMember<V8CustomElementDisabledStateChangedCallback> + Member<V8CustomElementConstructor> constructor_; + Member<V8VoidFunction> connected_callback_; + Member<V8VoidFunction> disconnected_callback_; + Member<V8CustomElementAdoptedCallback> adopted_callback_; + Member<V8CustomElementAttributeChangedCallback> attribute_changed_callback_; + Member<V8CustomElementFormAssociatedCallback> form_associated_callback_; + Member<V8VoidFunction> form_reset_callback_; + Member<V8CustomElementDisabledStateChangedCallback> disabled_state_changed_callback_; - TraceWrapperMember<V8CustomElementRestoreStateCallback> - restore_state_callback_; + Member<V8CustomElementRestoreStateCallback> restore_state_callback_; DISALLOW_COPY_AND_ASSIGN(ScriptCustomElementDefinition); };
diff --git a/third_party/blink/renderer/bindings/core/v8/script_promise.cc b/third_party/blink/renderer/bindings/core/v8/script_promise.cc index 186a97f3..db9fa2d9 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_promise.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_promise.cc
@@ -37,7 +37,6 @@ #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h" #include "third_party/blink/renderer/platform/instance_counters.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "v8/include/v8.h" namespace blink {
diff --git a/third_party/blink/renderer/bindings/core/v8/script_promise_property_base.h b/third_party/blink/renderer/bindings/core/v8/script_promise_property_base.h index 742269a..cf1785b 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_promise_property_base.h +++ b/third_party/blink/renderer/bindings/core/v8/script_promise_property_base.h
@@ -13,7 +13,6 @@ #include "third_party/blink/renderer/platform/bindings/scoped_persistent.h" #include "third_party/blink/renderer/platform/bindings/script_promise_properties.h" #include "third_party/blink/renderer/platform/bindings/v8_private_property.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/vector.h" #include "v8/include/v8.h"
diff --git a/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.cc b/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.cc index c31e8b58..b947474 100644 --- a/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.cc +++ b/third_party/blink/renderer/bindings/core/v8/script_promise_resolver.cc
@@ -7,6 +7,7 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/probe/core_probes.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" #if DCHECK_IS_ON() #include "base/debug/alias.h"
diff --git a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_test.cc b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_test.cc index a9b7cf0..85216d06 100644 --- a/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value_test.cc
@@ -13,6 +13,7 @@ #include "third_party/blink/renderer/core/fileapi/file.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/string_view.h" namespace blink { @@ -122,10 +123,9 @@ TEST(SerializedScriptValueTest, UserSelectedFile) { V8TestingScope scope; - String file_path = test::BlinkRootDir(); - file_path.append( - "/renderer/bindings/core/v8/serialization/" - "serialized_script_value_test.cc"); + String file_path = test::BlinkRootDir() + + "/renderer/bindings/core/v8/serialization/" + "serialized_script_value_test.cc"; File* original_file = File::Create(file_path); ASSERT_TRUE(original_file->HasBackingFile()); ASSERT_EQ(File::kIsUserVisible, original_file->GetUserVisibility());
diff --git a/third_party/blink/renderer/bindings/core/v8/trace_wrapper_member_test.cc b/third_party/blink/renderer/bindings/core/v8/trace_wrapper_member_test.cc deleted file mode 100644 index 7e215c0..0000000 --- a/third_party/blink/renderer/bindings/core/v8/trace_wrapper_member_test.cc +++ /dev/null
@@ -1,84 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" - -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/renderer/core/testing/death_aware_script_wrappable.h" - -namespace blink { - -namespace { - -using Wrapper = TraceWrapperMember<DeathAwareScriptWrappable>; - -} // namespace - -// These tests just ensure that entries are actually swapped. For write barrier -// testing see bindings/core/v8/ScriptWrappableVisitorTest.cpp. - -TEST(TraceWrapperMemberTest, HeapVectorSwap) { - HeapVector<Wrapper> vector1; - DeathAwareScriptWrappable* entry1 = DeathAwareScriptWrappable::Create(); - vector1.push_back(entry1); - - HeapVector<Wrapper> vector2; - DeathAwareScriptWrappable* entry2 = DeathAwareScriptWrappable::Create(); - vector2.push_back(entry2); - - swap(vector1, vector2); - EXPECT_EQ(entry1, vector2.front()); - EXPECT_EQ(entry2, vector1.front()); -} - -TEST(TraceWrapperMemberTest, HeapVectorSwap2) { - HeapVector<Wrapper> vector1; - DeathAwareScriptWrappable* entry1 = DeathAwareScriptWrappable::Create(); - vector1.push_back(entry1); - - HeapVector<Member<DeathAwareScriptWrappable>> vector2; - DeathAwareScriptWrappable* entry2 = DeathAwareScriptWrappable::Create(); - vector2.push_back(entry2); - - swap(vector1, vector2); - EXPECT_EQ(entry1, vector2.front()); - EXPECT_EQ(entry2, vector1.front()); -} - -TEST(TraceWrapperMemberTest, HeapHashSet) { - const wtf_size_t kContainerSize = 10000; - HeapHashSet<Wrapper> set; - // Loop enough so that underlying HashTable will rehash several times. - for (wtf_size_t i = 1; i <= kContainerSize; ++i) { - DeathAwareScriptWrappable* entry = DeathAwareScriptWrappable::Create(); - set.insert(entry); - } - EXPECT_EQ(kContainerSize, set.size()); - - HeapHashSet<Wrapper> set2; - swap(set, set2); - EXPECT_EQ(0u, set.size()); - EXPECT_EQ(kContainerSize, set2.size()); -} - -TEST(TraceWrapperMemberTest, HeapHashMapValue) { - const wtf_size_t kContainerSize = 10000; - HeapHashMap<uint32_t, Wrapper> map; - HeapVector<Wrapper> verification_vector; - // Loop enough so that underlying HashTable will rehash several times. - for (wtf_size_t i = 1; i <= kContainerSize; ++i) { - DeathAwareScriptWrappable* entry = DeathAwareScriptWrappable::Create(); - map.insert(i, entry); - verification_vector.push_back(entry); - } - EXPECT_EQ(kContainerSize, map.size()); - - for (wtf_size_t i = 1; i <= kContainerSize; ++i) { - auto wrapper = map.Take(i); - EXPECT_EQ(verification_vector[i - 1], wrapper.Get()); - } - EXPECT_EQ(0u, map.size()); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc b/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc index 17303185..3d10cec 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_embedder_graph_builder.cc
@@ -172,7 +172,6 @@ TraceDescriptor desc) final; // Unused Visitor overrides. - void VisitWithWrappers(void* object, TraceDescriptor desc) final {} void VisitWeak(void* object, void** object_slot, TraceDescriptor desc,
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_delegate.h b/third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_delegate.h index b9028887..37f79c5 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_delegate.h +++ b/third_party/blink/renderer/bindings/core/v8/v8_intersection_observer_delegate.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/core/intersection_observer/intersection_observer_delegate.h" #include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h" #include "third_party/blink/renderer/platform/bindings/scoped_persistent.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -39,7 +38,7 @@ IntersectionObserver&) override; private: - TraceWrapperMember<V8IntersectionObserverCallback> callback_; + Member<V8IntersectionObserverCallback> callback_; }; } // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc b/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc index 1e673b2..eab38972 100644 --- a/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc +++ b/third_party/blink/renderer/bindings/core/v8/v8_wasm_response_extensions.cc
@@ -18,7 +18,6 @@ #include "third_party/blink/renderer/core/frame/local_frame.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/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
diff --git a/third_party/blink/renderer/bindings/scripts/v8_types.py b/third_party/blink/renderer/bindings/scripts/v8_types.py index 5b572099..af00809 100644 --- a/third_party/blink/renderer/bindings/scripts/v8_types.py +++ b/third_party/blink/renderer/bindings/scripts/v8_types.py
@@ -277,7 +277,7 @@ return v8_type_name if not used_in_cpp_sequence: return v8_type_name + '*' - return cpp_template_type('TraceWrapperMember', v8_type_name) + return cpp_template_type('Member', v8_type_name) if base_idl_type == 'void': return base_idl_type @@ -514,8 +514,7 @@ includes_for_type.add('platform/wtf/text/wtf_string.h') if idl_type.is_callback_function: component = IdlType.callback_functions[base_idl_type]['component_dir'] - return set(['bindings/%s/v8/%s' % (component, binding_header_filename(base_idl_type)), - 'platform/bindings/trace_wrapper_member.h']) + return set(['bindings/%s/v8/%s' % (component, binding_header_filename(base_idl_type))]) if base_idl_type in interfaces_info: interface_info = interfaces_info[base_idl_type] includes_for_type.add(interface_info['include_path'])
diff --git a/third_party/blink/renderer/bindings/tests/results/core/test_dictionary.h b/third_party/blink/renderer/bindings/tests/results/core/test_dictionary.h index 7557e84..3a16af6 100644 --- a/third_party/blink/renderer/bindings/tests/results/core/test_dictionary.h +++ b/third_party/blink/renderer/bindings/tests/results/core/test_dictionary.h
@@ -30,7 +30,6 @@ #include "third_party/blink/renderer/core/testing/internal_dictionary.h" #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -498,7 +497,7 @@ int32_t applicable_to_type_long_member_; String applicable_to_type_string_member_; bool boolean_member_; - TraceWrapperMember<V8VoidCallbackFunction> callback_function_member_; + Member<V8VoidCallbackFunction> callback_function_member_; bool create_member_; Dictionary dictionary_member_; String dom_string_treat_null_as_empty_string_member_; @@ -526,7 +525,7 @@ bool origin_trial_second_member_; DoubleOrString other_double_or_string_member_; Vector<std::pair<String, int8_t>> record_member_; - TraceWrapperMember<V8VoidCallbackFunction> required_callback_function_member_; + Member<V8VoidCallbackFunction> required_callback_function_member_; double restricted_double_member_; bool runtime_member_; bool runtime_second_member_; @@ -543,7 +542,7 @@ Member<TestInterfaceImplementation> test_interface_or_null_member_; HeapVector<Member<TestInterfaceImplementation>> test_interface_sequence_member_; HeapVector<Member<TestObject>> test_object_sequence_member_; - TraceWrapperMember<V8TreatNonObjectAsNullVoidFunction> treat_non_null_obj_member_; + Member<V8TreatNonObjectAsNullVoidFunction> treat_non_null_obj_member_; Vector<String> treat_null_as_string_sequence_member_; Member<DOMUint8Array> uint8_array_member_; HeapVector<std::pair<String, LongOrBoolean>> union_in_record_member_;
diff --git a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl index e8e6925..a6748255 100644 --- a/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl +++ b/third_party/blink/renderer/build/scripts/core/css/properties/templates/css_property_subclass.h.tmpl
@@ -49,6 +49,9 @@ {% if property.valid_for_visited_link %} | kValidForVisitedLink {% endif %} + {% if property.inherited %} + | kInherited + {% endif %} , {% if property.separator != None %} '{{property.separator}}' @@ -81,9 +84,6 @@ {% for property_method in property.property_methods %} {{property_method.return_type}} {{property_method.name}}{{property_method.parameters}} const override; {% endfor %} - {% if property.inherited %} - bool IsInherited() const override { return true; } - {% endif %} {% if property.separator != None %} {% endif %} {% if not property.affected_by_all %}
diff --git a/third_party/blink/renderer/controller/BUILD.gn b/third_party/blink/renderer/controller/BUILD.gn index 10d082ea..a52bb9d 100644 --- a/third_party/blink/renderer/controller/BUILD.gn +++ b/third_party/blink/renderer/controller/BUILD.gn
@@ -56,8 +56,6 @@ "memory_usage_monitor_android.h", "oom_intervention_impl.cc", "oom_intervention_impl.h", - "user_level_memory_pressure_signal_generator.cc", - "user_level_memory_pressure_signal_generator.h", ] } if (is_mac) { @@ -102,7 +100,6 @@ ] if (is_android) { - enable_multidex = true deps += [ "//base:base_java", "//content/public/android:content_java", @@ -156,7 +153,6 @@ "memory_usage_monitor_android_test.cc", "memory_usage_monitor_test.cc", "oom_intervention_impl_test.cc", - "user_level_memory_pressure_signal_generator_test.cc", ] }
diff --git a/third_party/blink/renderer/controller/blink_initializer.cc b/third_party/blink/renderer/controller/blink_initializer.cc index 747405c..78dcd897 100644 --- a/third_party/blink/renderer/controller/blink_initializer.cc +++ b/third_party/blink/renderer/controller/blink_initializer.cc
@@ -59,7 +59,6 @@ #if defined(OS_ANDROID) #include "third_party/blink/renderer/controller/crash_memory_metrics_reporter_impl.h" #include "third_party/blink/renderer/controller/oom_intervention_impl.h" -#include "third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h" #endif namespace blink { @@ -134,9 +133,6 @@ MemoryAblationExperiment::MaybeStartForRenderer(task_runner); #if defined(OS_ANDROID) - // Initialize UserLevelMemoryPressureSignalGenerator so it starts monitoring. - UserLevelMemoryPressureSignalGenerator::Instance(); - // Initialize CrashMemoryMetricsReporterImpl in order to assure that memory // allocation does not happen in OnOOMCallback. CrashMemoryMetricsReporterImpl::Instance();
diff --git a/third_party/blink/renderer/controller/memory_usage_monitor.h b/third_party/blink/renderer/controller/memory_usage_monitor.h index 68ebf79..7b8e120 100644 --- a/third_party/blink/renderer/controller/memory_usage_monitor.h +++ b/third_party/blink/renderer/controller/memory_usage_monitor.h
@@ -29,7 +29,6 @@ public: static MemoryUsageMonitor& Instance(); - static void SetInstanceForTesting(MemoryUsageMonitor*); class Observer : public base::CheckedObserver { public:
diff --git a/third_party/blink/renderer/controller/memory_usage_monitor_android.cc b/third_party/blink/renderer/controller/memory_usage_monitor_android.cc index f82ce3c..beb9b1b 100644 --- a/third_party/blink/renderer/controller/memory_usage_monitor_android.cc +++ b/third_party/blink/renderer/controller/memory_usage_monitor_android.cc
@@ -23,19 +23,12 @@ return true; } -static MemoryUsageMonitor* g_instance_for_testing = nullptr; - } // namespace // static MemoryUsageMonitor& MemoryUsageMonitor::Instance() { DEFINE_STATIC_LOCAL(MemoryUsageMonitorAndroid, monitor, ()); - return g_instance_for_testing ? *g_instance_for_testing : monitor; -} - -// static -void MemoryUsageMonitor::SetInstanceForTesting(MemoryUsageMonitor* instance) { - g_instance_for_testing = instance; + return monitor; } // Since the measurement is done every second in background, optimizations are
diff --git a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc b/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc deleted file mode 100644 index b5c8df3a..0000000 --- a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc +++ /dev/null
@@ -1,139 +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 "third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h" - -#include <limits> -#include "base/memory/memory_pressure_listener.h" -#include "base/metrics/field_trial_params.h" -#include "base/metrics/histogram_macros.h" -#include "base/system/sys_info.h" -#include "third_party/blink/public/common/features.h" -#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.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/wtf/allocator/partitions.h" - -namespace blink { - -namespace { - -constexpr double kDefaultMemoryThresholdMB = - std::numeric_limits<double>::infinity(); - -constexpr base::FeatureParam<double> k512MBDeviceMemoryThresholdParam{ - &blink::features::kUserLevelMemoryPressureSignal, - "param_512mb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; - -constexpr base::FeatureParam<double> k1GBDeviceMemoryThresholdParam{ - &blink::features::kUserLevelMemoryPressureSignal, - "param_1gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; - -constexpr base::FeatureParam<double> k2GBDeviceMemoryThresholdParam{ - &blink::features::kUserLevelMemoryPressureSignal, - "param_2gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; - -constexpr base::FeatureParam<double> k3GBDeviceMemoryThresholdParam{ - &blink::features::kUserLevelMemoryPressureSignal, - "param_3gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; - -constexpr base::FeatureParam<double> k4GBDeviceMemoryThresholdParam{ - &blink::features::kUserLevelMemoryPressureSignal, - "param_4gb_device_memory_threshold_mb", kDefaultMemoryThresholdMB}; - -// Minimum time interval between generated memory pressure signals. -constexpr double kDefaultMinimumIntervalSeconds = 10 * 60; - -constexpr base::FeatureParam<double> kMinimumIntervalSeconds{ - &blink::features::kUserLevelMemoryPressureSignal, "minimum_interval_s", - kDefaultMinimumIntervalSeconds}; - -} // namespace - -// static -UserLevelMemoryPressureSignalGenerator& -UserLevelMemoryPressureSignalGenerator::Instance() { - DEFINE_STATIC_LOCAL(UserLevelMemoryPressureSignalGenerator, generator, ()); - return generator; -} - -UserLevelMemoryPressureSignalGenerator::UserLevelMemoryPressureSignalGenerator() - : delayed_report_timer_( - Thread::MainThread()->GetTaskRunner(), - this, - &UserLevelMemoryPressureSignalGenerator::OnTimerFired) { - int64_t physical_memory = base::SysInfo::AmountOfPhysicalMemory(); - if (physical_memory > 3.1 * 1024 * 1024 * 1024) - memory_threshold_mb_ = k4GBDeviceMemoryThresholdParam.Get(); - else if (physical_memory > 2.1 * 1024 * 1024 * 1024) - memory_threshold_mb_ = k3GBDeviceMemoryThresholdParam.Get(); - else if (physical_memory > 1.1 * 1024 * 1024 * 1024) - memory_threshold_mb_ = k2GBDeviceMemoryThresholdParam.Get(); - else if (physical_memory > 600 * 1024 * 1024) - memory_threshold_mb_ = k1GBDeviceMemoryThresholdParam.Get(); - else - memory_threshold_mb_ = k512MBDeviceMemoryThresholdParam.Get(); - - minimum_interval_ = - WTF::TimeDelta::FromSeconds(kMinimumIntervalSeconds.Get()); - - // Can be disabled for certain device classes by setting the field param to an - // empty string. - bool enabled = base::FeatureList::IsEnabled( - blink::features::kUserLevelMemoryPressureSignal) && - !std::isinf(memory_threshold_mb_); - if (enabled) { - monitoring_ = true; - MemoryUsageMonitor::Instance().AddObserver(this); - ThreadScheduler::Current()->AddRAILModeObserver(this); - } -} - -UserLevelMemoryPressureSignalGenerator:: - ~UserLevelMemoryPressureSignalGenerator() { - MemoryUsageMonitor::Instance().RemoveObserver(this); - ThreadScheduler::Current()->RemoveRAILModeObserver(this); -} - -void UserLevelMemoryPressureSignalGenerator::OnRAILModeChanged( - RAILMode rail_mode) { - is_loading_ = rail_mode == RAILMode::kLoad; -} - -void UserLevelMemoryPressureSignalGenerator::OnMemoryPing(MemoryUsage usage) { - // Disabled during loading as we don't want to purge caches that has just been - // created. - if (is_loading_) - return; - if (usage.private_footprint_bytes / 1024 / 1024 < memory_threshold_mb_) - return; - base::TimeDelta elapsed = WTF::CurrentTimeTicks() - last_generated_; - if (elapsed >= WTF::TimeDelta::FromSeconds(kMinimumIntervalSeconds.Get())) - Generate(usage); -} - -void UserLevelMemoryPressureSignalGenerator::Generate(MemoryUsage usage) { - UMA_HISTOGRAM_MEMORY_LARGE_MB( - "Memory.Experimental.UserLevelMemoryPressureSignal." - "RendererPrivateMemoryFootprintBefore", - base::saturated_cast<base::Histogram::Sample>( - usage.private_footprint_bytes / 1024 / 1024)); - - base::MemoryPressureListener::NotifyMemoryPressure( - base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL); - last_generated_ = WTF::CurrentTimeTicks(); - - delayed_report_timer_.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); -} - -void UserLevelMemoryPressureSignalGenerator::OnTimerFired(TimerBase*) { - MemoryUsage usage = MemoryUsageMonitor::Instance().GetCurrentMemoryUsage(); - UMA_HISTOGRAM_MEMORY_LARGE_MB( - "Memory.Experimental.UserLevelMemoryPressureSignal." - "RendererPrivateMemoryFootprintAfter", - base::saturated_cast<base::Histogram::Sample>( - usage.private_footprint_bytes / 1024 / 1024)); -} - -} // namespace blink
diff --git a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h b/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h deleted file mode 100644 index 91bd2c3..0000000 --- a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h +++ /dev/null
@@ -1,59 +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 THIRD_PARTY_BLINK_RENDERER_CONTROLLER_USER_LEVEL_MEMORY_PRESSURE_SIGNAL_GENERATOR_H_ -#define THIRD_PARTY_BLINK_RENDERER_CONTROLLER_USER_LEVEL_MEMORY_PRESSURE_SIGNAL_GENERATOR_H_ - -#include "third_party/blink/renderer/controller/controller_export.h" -#include "third_party/blink/renderer/controller/memory_usage_monitor.h" -#include "third_party/blink/renderer/platform/scheduler/public/rail_mode_observer.h" -#include "third_party/blink/renderer/platform/timer.h" -#include "third_party/blink/renderer/platform/wtf/allocator.h" - -namespace blink { - -// Generates extra memory pressure signals (on top of the OS generated ones) -// when the memory usage goes over a threshold. -class CONTROLLER_EXPORT UserLevelMemoryPressureSignalGenerator - : public RAILModeObserver, - public MemoryUsageMonitor::Observer { - USING_FAST_MALLOC(UserLevelMemoryPressureSignalGenerator); - - public: - // Returns the shared instance. - static UserLevelMemoryPressureSignalGenerator& Instance(); - - UserLevelMemoryPressureSignalGenerator(); - ~UserLevelMemoryPressureSignalGenerator() override; - - protected: - // This is only virtual to override in tests. - virtual void Generate(MemoryUsage); - - private: - FRIEND_TEST_ALL_PREFIXES(UserLevelMemoryPressureSignalGeneratorTest, - GeneratesWhenOverThreshold); - FRIEND_TEST_ALL_PREFIXES(UserLevelMemoryPressureSignalGeneratorTest, - GenerationPauses); - - // Called by delayed_report_timer_ to report metrics. - void OnTimerFired(TimerBase*); - - // RAILModeObserver: - void OnRAILModeChanged(RAILMode rail_mode) override; - - // MemoryUsageMonitor::Observer: - void OnMemoryPing(MemoryUsage) override; - - bool monitoring_ = false; - bool is_loading_ = false; - WTF::TimeTicks last_generated_; - double memory_threshold_mb_; - WTF::TimeDelta minimum_interval_; - TaskRunnerTimer<UserLevelMemoryPressureSignalGenerator> delayed_report_timer_; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CONTROLLER_USER_LEVEL_MEMORY_PRESSURE_SIGNAL_GENERATOR_H_
diff --git a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator_test.cc b/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator_test.cc deleted file mode 100644 index b68f064a..0000000 --- a/third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator_test.cc +++ /dev/null
@@ -1,173 +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 "third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h" - -#include "base/test/scoped_feature_list.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/common/features.h" -#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" -#include "third_party/blink/renderer/platform/testing/wtf/scoped_mock_clock.h" - -namespace blink { - -using testing::_; - -namespace { - -// Mock that allows setting mock memory usage. -class MockMemoryUsageMonitor : public MemoryUsageMonitor { - public: - MockMemoryUsageMonitor() = default; - ~MockMemoryUsageMonitor() override = default; - - MemoryUsage GetCurrentMemoryUsage() override { return mock_memory_usage_; } - - // MemoryUsageMonitor will report the current memory usage as this value. - void SetMockMemoryUsage(MemoryUsage usage) { mock_memory_usage_ = usage; } - - private: - MemoryUsage mock_memory_usage_; -}; - -class MockUserLevelMemoryPressureSignalGenerator - : public UserLevelMemoryPressureSignalGenerator { - public: - MockUserLevelMemoryPressureSignalGenerator() { - ON_CALL(*this, Generate(_)) - .WillByDefault(testing::Invoke( - this, &MockUserLevelMemoryPressureSignalGenerator::RealGenerate)); - } - ~MockUserLevelMemoryPressureSignalGenerator() override = default; - - MOCK_METHOD1(Generate, void(MemoryUsage)); - - void RealGenerate(MemoryUsage usage) { - UserLevelMemoryPressureSignalGenerator::Generate(usage); - } -}; - -class ScopedMockMemoryUsageMonitor { - public: - ScopedMockMemoryUsageMonitor(MemoryUsageMonitor* monitor) { - MemoryUsageMonitor::SetInstanceForTesting(monitor); - } - ~ScopedMockMemoryUsageMonitor() { - MemoryUsageMonitor::SetInstanceForTesting(nullptr); - } -}; - -class UserLevelMemoryPressureSignalGeneratorTest : public testing::Test { - public: - UserLevelMemoryPressureSignalGeneratorTest() = default; - - void SetUp() override { - std::map<std::string, std::string> feature_parameters; - feature_parameters["param_512mb_device_memory_threshold_mb"] = "1024.0"; - feature_parameters["param_1gb_device_memory_threshold_mb"] = "1024.0"; - feature_parameters["param_2gb_device_memory_threshold_mb"] = "1024.0"; - feature_parameters["param_3gb_device_memory_threshold_mb"] = "1024.0"; - feature_parameters["param_4gb_device_memory_threshold_mb"] = "1024.0"; - feature_parameters["minimum_interval_s"] = "600.0"; - - scoped_feature_list_.InitAndEnableFeatureWithParameters( - blink::features::kUserLevelMemoryPressureSignal, feature_parameters); - } - - protected: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -constexpr double kMemoryThresholdBytes = 1024 * 1024 * 1024; - -} // namespace - -TEST_F(UserLevelMemoryPressureSignalGeneratorTest, GeneratesWhenOverThreshold) { - { - WTF::ScopedMockClock clock; - std::unique_ptr<MockMemoryUsageMonitor> mock_memory_usage_monitor = - std::make_unique<MockMemoryUsageMonitor>(); - ScopedMockMemoryUsageMonitor mock_memory_usage_scope( - mock_memory_usage_monitor.get()); - MockUserLevelMemoryPressureSignalGenerator generator; - { - EXPECT_CALL(generator, Generate(_)).Times(0); - MemoryUsage usage; - usage.v8_bytes = 0; - usage.blink_gc_bytes = 0; - usage.partition_alloc_bytes = 0; - usage.private_footprint_bytes = kMemoryThresholdBytes - 1024 * 1024; - usage.swap_bytes = 0; - usage.vm_size_bytes = 0; - mock_memory_usage_monitor->SetMockMemoryUsage(usage); - clock.Advance(TimeDelta::FromSeconds(1)); - test::RunDelayedTasks(TimeDelta::FromSeconds(1)); - } - { - EXPECT_CALL(generator, Generate(_)).Times(1); - MemoryUsage usage; - usage.v8_bytes = 0; - usage.blink_gc_bytes = 0; - usage.partition_alloc_bytes = 0; - usage.private_footprint_bytes = kMemoryThresholdBytes + 1024 * 1024; - usage.swap_bytes = 0; - usage.vm_size_bytes = 0; - mock_memory_usage_monitor->SetMockMemoryUsage(usage); - clock.Advance(TimeDelta::FromMinutes(10)); - test::RunDelayedTasks(TimeDelta::FromSeconds(1)); - } - } -} - -TEST_F(UserLevelMemoryPressureSignalGeneratorTest, GenerationPauses) { - { - WTF::ScopedMockClock clock; - std::unique_ptr<MockMemoryUsageMonitor> mock_memory_usage_monitor = - std::make_unique<MockMemoryUsageMonitor>(); - ScopedMockMemoryUsageMonitor mock_memory_usage_scope( - mock_memory_usage_monitor.get()); - MockUserLevelMemoryPressureSignalGenerator generator; - { - MemoryUsage usage; - usage.v8_bytes = 0; - usage.blink_gc_bytes = 0; - usage.partition_alloc_bytes = 0; - usage.private_footprint_bytes = kMemoryThresholdBytes + 1024 * 1024; - usage.swap_bytes = 0; - usage.vm_size_bytes = 0; - mock_memory_usage_monitor->SetMockMemoryUsage(usage); - clock.Advance(TimeDelta::FromMinutes(10)); - // Generated - { - EXPECT_CALL(generator, Generate(_)).Times(1); - test::RunDelayedTasks(TimeDelta::FromSeconds(1)); - } - - clock.Advance(TimeDelta::FromMinutes(1)); - // Not generated because too soon - { - EXPECT_CALL(generator, Generate(_)).Times(0); - test::RunDelayedTasks(TimeDelta::FromSeconds(1)); - } - - clock.Advance(TimeDelta::FromMinutes(10)); - generator.OnRAILModeChanged(RAILMode::kLoad); - // Not generated because loading - { - EXPECT_CALL(generator, Generate(_)).Times(0); - test::RunDelayedTasks(TimeDelta::FromSeconds(1)); - } - - generator.OnRAILModeChanged(RAILMode::kAnimation); - // Generated - { - EXPECT_CALL(generator, Generate(_)).Times(1); - test::RunDelayedTasks(TimeDelta::FromSeconds(1)); - } - } - } -} - -} // namespace blink
diff --git a/third_party/blink/renderer/core/animation/compositor_animations_test.cc b/third_party/blink/renderer/core/animation/compositor_animations_test.cc index 20bf5b9..ced8569 100644 --- a/third_party/blink/renderer/core/animation/compositor_animations_test.cc +++ b/third_party/blink/renderer/core/animation/compositor_animations_test.cc
@@ -458,8 +458,8 @@ } void LoadTestData(const std::string& file_name) { - String testing_path = test::BlinkRootDir(); - testing_path.append("/renderer/core/animation/test_data/"); + String testing_path = + test::BlinkRootDir() + "/renderer/core/animation/test_data/"; WebURL url = url_test_helpers::RegisterMockedURLLoadFromBase( WebString::FromUTF8(base_url_), testing_path, WebString::FromUTF8(file_name));
diff --git a/third_party/blink/renderer/core/clipboard/data_object_test.cc b/third_party/blink/renderer/core/clipboard/data_object_test.cc index f523b21..f1a313a1 100644 --- a/third_party/blink/renderer/core/clipboard/data_object_test.cc +++ b/third_party/blink/renderer/core/clipboard/data_object_test.cc
@@ -65,8 +65,8 @@ DataObjectObserver* observer2 = MakeGarbageCollected<DataObjectObserver>(); data_object_->AddObserver(observer2); - String file_path = test::BlinkRootDir(); - file_path.append("/renderer/core/clipboard/dat_aobject_test.cc"); + String file_path = + test::BlinkRootDir() + "/renderer/core/clipboard/dat_aobject_test.cc"; data_object_->AddFilename(file_path, String(), String()); EXPECT_EQ(2U, data_object_->length()); EXPECT_EQ(4U, observer->call_count()); @@ -84,8 +84,8 @@ } TEST_F(DataObjectTest, addItemWithFilenameAndNoTitle) { - String file_path = test::BlinkRootDir(); - file_path.append("/renderer/core/clipboard/data_object_test.cc"); + String file_path = + test::BlinkRootDir() + "/renderer/core/clipboard/data_object_test.cc"; data_object_->AddFilename(file_path, String(), String()); EXPECT_EQ(1U, data_object_->length()); @@ -103,8 +103,8 @@ } TEST_F(DataObjectTest, addItemWithFilenameAndTitle) { - String file_path = test::BlinkRootDir(); - file_path.append("/renderer/core/clipboard/data_object_test.cc"); + String file_path = + test::BlinkRootDir() + "/renderer/core/clipboard/data_object_test.cc"; data_object_->AddFilename(file_path, "name.cpp", String()); EXPECT_EQ(1U, data_object_->length()); @@ -122,8 +122,8 @@ } TEST_F(DataObjectTest, fileSystemId) { - String file_path = test::BlinkRootDir(); - file_path.append("/renderer/core/clipboard/data_object_test.cpp"); + String file_path = + test::BlinkRootDir() + "/renderer/core/clipboard/data_object_test.cpp"; KURL url; data_object_->AddFilename(file_path, String(), String());
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item.cc b/third_party/blink/renderer/core/clipboard/data_transfer_item.cc index f108ecb..76e02205 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item.cc
@@ -37,6 +37,7 @@ #include "third_party/blink/renderer/core/clipboard/data_transfer.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/probe/core_probes.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/wtf_string.h"
diff --git a/third_party/blink/renderer/core/css/css_custom_font_data.h b/third_party/blink/renderer/core/css/css_custom_font_data.h index 854ac3d7..697046e 100644 --- a/third_party/blink/renderer/core/css/css_custom_font_data.h +++ b/third_party/blink/renderer/core/css/css_custom_font_data.h
@@ -32,7 +32,7 @@ enum FallbackVisibility { kInvisibleFallback, kVisibleFallback }; static scoped_refptr<CSSCustomFontData> Create( - RemoteFontFaceSource* source, + CSSFontFaceSource* source, FallbackVisibility visibility) { return base::AdoptRef(new CSSCustomFontData(source, visibility)); } @@ -57,7 +57,7 @@ void ClearFontFaceSource() override { font_face_source_ = nullptr; } private: - CSSCustomFontData(RemoteFontFaceSource* source, FallbackVisibility visibility) + CSSCustomFontData(CSSFontFaceSource* source, FallbackVisibility visibility) : font_face_source_(source), fallback_visibility_(visibility), is_loading_(false) { @@ -67,7 +67,7 @@ // TODO(Oilpan): consider moving (Custom)FontFace hierarchy to the heap, // thereby making this reference a Member<>. - WeakPersistent<RemoteFontFaceSource> font_face_source_; + WeakPersistent<CSSFontFaceSource> font_face_source_; FallbackVisibility fallback_visibility_; mutable bool is_loading_; };
diff --git a/third_party/blink/renderer/core/css/css_font_face.cc b/third_party/blink/renderer/core/css/css_font_face.cc index 841fc12..4cfafe2 100644 --- a/third_party/blink/renderer/core/css/css_font_face.cc +++ b/third_party/blink/renderer/core/css/css_font_face.cc
@@ -60,7 +60,7 @@ SetLoadStatus(FontFace::kLoading); } -bool CSSFontFace::FontLoaded(RemoteFontFaceSource* source) { +bool CSSFontFace::FontLoaded(CSSFontFaceSource* source) { if (!IsValid() || source != sources_.front()) return false; @@ -186,7 +186,7 @@ while (!sources_.IsEmpty()) { Member<CSSFontFaceSource>& source = sources_.front(); if (source->IsValid()) { - if (source->IsLocal()) { + if (source->IsLocalNonBlocking()) { if (source->IsLocalFontAvailable(font_description)) { SetLoadStatus(FontFace::kLoaded); return;
diff --git a/third_party/blink/renderer/core/css/css_font_face.h b/third_party/blink/renderer/core/css/css_font_face.h index 94a98ee..e76d47b 100644 --- a/third_party/blink/renderer/core/css/css_font_face.h +++ b/third_party/blink/renderer/core/css/css_font_face.h
@@ -69,7 +69,7 @@ void SetDisplay(FontDisplay); void DidBeginLoad(); - bool FontLoaded(RemoteFontFaceSource*); + bool FontLoaded(CSSFontFaceSource*); bool FallbackVisibilityChanged(RemoteFontFaceSource*); scoped_refptr<SimpleFontData> GetFontData(const FontDescription&);
diff --git a/third_party/blink/renderer/core/css/css_font_face_source.cc b/third_party/blink/renderer/core/css/css_font_face_source.cc index 331efc1e..b89ad04 100644 --- a/third_party/blink/renderer/core/css/css_font_face_source.cc +++ b/third_party/blink/renderer/core/css/css_font_face_source.cc
@@ -53,7 +53,7 @@ if (!IsValid()) return nullptr; - if (IsLocal()) { + if (IsLocalNonBlocking()) { // We're local. Just return a SimpleFontData from the normal cache. return CreateFontData(font_description, font_selection_capabilities); }
diff --git a/third_party/blink/renderer/core/css/css_font_face_source.h b/third_party/blink/renderer/core/css/css_font_face_source.h index cfb07ee..8f0b38b 100644 --- a/third_party/blink/renderer/core/css/css_font_face_source.h +++ b/third_party/blink/renderer/core/css/css_font_face_source.h
@@ -46,7 +46,12 @@ public: virtual ~CSSFontFaceSource(); - virtual bool IsLocal() const { return false; } + // Describes whether this a LocalFontFaceSource can be retrieved locally + // without blocking. If the local lookup needs to be done asynchronously + // because it takes longer or requires preparation steps, this return false. + // Allows for LocalFontFaceSource to operate in two modes: synchronous and + // asynchronously. + virtual bool IsLocalNonBlocking() const { return false; } virtual bool IsLoading() const { return false; } virtual bool IsLoaded() const { return true; } virtual bool IsValid() const { return true; } @@ -54,7 +59,11 @@ scoped_refptr<SimpleFontData> GetFontData(const FontDescription&, const FontSelectionCapabilities&); - virtual bool IsLocalFontAvailable(const FontDescription&) { return false; } + // TODO(https://crbug.com/947461): IsLocalFontAvailable must not have a + // FontDescription argument. + virtual bool IsLocalFontAvailable(const FontDescription&) const { + return false; + } virtual void BeginLoadIfNeeded() {} virtual void SetDisplay(FontDisplay) {} @@ -63,6 +72,7 @@ // For UMA reporting virtual bool HadBlankText() { return false; } + virtual void PaintRequested() {} virtual void Trace(blink::Visitor* visitor) {}
diff --git a/third_party/blink/renderer/core/css/css_keyframe_rule.h b/third_party/blink/renderer/core/css/css_keyframe_rule.h index 4d101915..70e5fcb 100644 --- a/third_party/blink/renderer/core/css/css_keyframe_rule.h +++ b/third_party/blink/renderer/core/css/css_keyframe_rule.h
@@ -57,8 +57,8 @@ private: CSSRule::Type type() const override { return kKeyframeRule; } - TraceWrapperMember<StyleRuleKeyframe> keyframe_; - mutable TraceWrapperMember<KeyframeStyleRuleCSSStyleDeclaration> + Member<StyleRuleKeyframe> keyframe_; + mutable Member<KeyframeStyleRuleCSSStyleDeclaration> properties_cssom_wrapper_; friend class CSSKeyframesRule;
diff --git a/third_party/blink/renderer/core/css/css_keyframes_rule.h b/third_party/blink/renderer/core/css/css_keyframes_rule.h index 252b8f54..a17f15ef 100644 --- a/third_party/blink/renderer/core/css/css_keyframes_rule.h +++ b/third_party/blink/renderer/core/css/css_keyframes_rule.h
@@ -119,10 +119,9 @@ private: CSSRule::Type type() const override { return kKeyframesRule; } - TraceWrapperMember<StyleRuleKeyframes> keyframes_rule_; - mutable HeapVector<TraceWrapperMember<CSSKeyframeRule>> - child_rule_cssom_wrappers_; - mutable TraceWrapperMember<CSSRuleList> rule_list_cssom_wrapper_; + Member<StyleRuleKeyframes> keyframes_rule_; + mutable HeapVector<Member<CSSKeyframeRule>> child_rule_cssom_wrappers_; + mutable Member<CSSRuleList> rule_list_cssom_wrapper_; bool is_prefixed_; };
diff --git a/third_party/blink/renderer/core/css/css_paint_value_test.cc b/third_party/blink/renderer/core/css/css_paint_value_test.cc index 17c6856..13944c83 100644 --- a/third_party/blink/renderer/core/css/css_paint_value_test.cc +++ b/third_party/blink/renderer/core/css/css_paint_value_test.cc
@@ -21,8 +21,8 @@ class CSSPaintValueTest : public RenderingTest { public: void LoadTestData(const std::string& file_name) { - String testing_path = test::BlinkRootDir(); - testing_path.append("/renderer/core/css/test_data/"); + String testing_path = + test::BlinkRootDir() + "/renderer/core/css/test_data/"; WebURL url = url_test_helpers::RegisterMockedURLLoadFromBase( WebString::FromUTF8(base_url_), testing_path, WebString::FromUTF8(file_name));
diff --git a/third_party/blink/renderer/core/css/css_rule.cc b/third_party/blink/renderer/core/css/css_rule.cc index 31c53afc..ccbe58b 100644 --- a/third_party/blink/renderer/core/css/css_rule.cc +++ b/third_party/blink/renderer/core/css/css_rule.cc
@@ -61,9 +61,9 @@ // pre-oilpan world, where the parent link is mysteriously zeroed under // some circumstances. if (parent_is_rule_) - visitor->TraceWithWrappers(parent_rule_); + visitor->Trace(parent_rule_); else - visitor->TraceWithWrappers(parent_style_sheet_); + visitor->Trace(parent_style_sheet_); ScriptWrappable::Trace(visitor); }
diff --git a/third_party/blink/renderer/core/css/css_style_sheet.cc b/third_party/blink/renderer/core/css/css_style_sheet.cc index dd5ef53..e011bff 100644 --- a/third_party/blink/renderer/core/css/css_style_sheet.cc +++ b/third_party/blink/renderer/core/css/css_style_sheet.cc
@@ -69,7 +69,7 @@ CSSStyleSheet* GetStyleSheet() const override { return style_sheet_; } - TraceWrapperMember<CSSStyleSheet> style_sheet_; + Member<CSSStyleSheet> style_sheet_; }; #if DCHECK_IS_ON() @@ -308,7 +308,7 @@ child_rule_cssom_wrappers_.Grow(rule_count); DCHECK_EQ(child_rule_cssom_wrappers_.size(), rule_count); - TraceWrapperMember<CSSRule>& css_rule = child_rule_cssom_wrappers_[index]; + Member<CSSRule>& css_rule = child_rule_cssom_wrappers_[index]; if (!css_rule) css_rule = contents_->RuleAt(index)->CreateCSSOMWrapper(this); return css_rule.Get();
diff --git a/third_party/blink/renderer/core/css/css_style_sheet.h b/third_party/blink/renderer/core/css/css_style_sheet.h index e76ff05..07295923 100644 --- a/third_party/blink/renderer/core/css/css_style_sheet.h +++ b/third_party/blink/renderer/core/css/css_style_sheet.h
@@ -28,7 +28,6 @@ #include "third_party/blink/renderer/core/css/media_query_evaluator.h" #include "third_party/blink/renderer/core/css/style_sheet.h" #include "third_party/blink/renderer/core/dom/tree_scope.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding.h" @@ -262,8 +261,8 @@ TextPosition start_position_; Member<MediaList> media_cssom_wrapper_; - mutable HeapVector<TraceWrapperMember<CSSRule>> child_rule_cssom_wrappers_; - mutable TraceWrapperMember<CSSRuleList> rule_list_cssom_wrapper_; + mutable HeapVector<Member<CSSRule>> child_rule_cssom_wrappers_; + mutable Member<CSSRuleList> rule_list_cssom_wrapper_; DISALLOW_COPY_AND_ASSIGN(CSSStyleSheet); };
diff --git a/third_party/blink/renderer/core/css/document_style_sheet_collector.h b/third_party/blink/renderer/core/css/document_style_sheet_collector.h index d50133c..7bd33f73 100644 --- a/third_party/blink/renderer/core/css/document_style_sheet_collector.h +++ b/third_party/blink/renderer/core/css/document_style_sheet_collector.h
@@ -28,7 +28,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_DOCUMENT_STYLE_SHEET_COLLECTOR_H_ #include "third_party/blink/renderer/core/css/active_style_sheets.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/css/font_face.cc b/third_party/blink/renderer/core/css/font_face.cc index 271b35a..4127521e 100644 --- a/third_party/blink/renderer/core/css/font_face.cc +++ b/third_party/blink/renderer/core/css/font_face.cc
@@ -701,16 +701,16 @@ // (remote font to download). const CSSFontFaceSrcValue& item = To<CSSFontFaceSrcValue>(src_list.Item(i)); + FontSelector* font_selector = nullptr; + if (auto* document = DynamicTo<Document>(context)) { + font_selector = document->GetStyleEngine().GetFontSelector(); + } else if (auto* scope = DynamicTo<WorkerGlobalScope>(context)) { + font_selector = scope->GetFontSelector(); + } else { + NOTREACHED(); + } if (!item.IsLocal()) { if (ContextAllowsDownload(context) && item.IsSupportedFormat()) { - FontSelector* font_selector = nullptr; - if (auto* document = DynamicTo<Document>(context)) { - font_selector = document->GetStyleEngine().GetFontSelector(); - } else if (auto* scope = DynamicTo<WorkerGlobalScope>(context)) { - font_selector = scope->GetFontSelector(); - } else { - NOTREACHED(); - } RemoteFontFaceSource* source = MakeGarbageCollected<RemoteFontFaceSource>( css_font_face_, font_selector, @@ -719,8 +719,8 @@ css_font_face_->AddSource(source); } } else { - css_font_face_->AddSource( - MakeGarbageCollected<LocalFontFaceSource>(item.GetResource())); + css_font_face_->AddSource(MakeGarbageCollected<LocalFontFaceSource>( + css_font_face_, font_selector, item.GetResource())); } }
diff --git a/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc b/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc index 10b68e71..483c6be 100644 --- a/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc +++ b/third_party/blink/renderer/core/css/invalidation/invalidation_set.cc
@@ -37,7 +37,6 @@ #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/inspector/inspector_trace_events.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/traced_value.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink {
diff --git a/third_party/blink/renderer/core/css/local_font_face_source.cc b/third_party/blink/renderer/core/css/local_font_face_source.cc index cfc1839..e576513 100644 --- a/third_party/blink/renderer/core/css/local_font_face_source.cc +++ b/third_party/blink/renderer/core/css/local_font_face_source.cc
@@ -4,22 +4,85 @@ #include "third_party/blink/renderer/core/css/local_font_face_source.h" +#include "build/build_config.h" +#include "third_party/blink/renderer/core/css/css_custom_font_data.h" +#include "third_party/blink/renderer/core/css/css_font_face.h" #include "third_party/blink/renderer/platform/fonts/font_cache.h" #include "third_party/blink/renderer/platform/fonts/font_description.h" +#include "third_party/blink/renderer/platform/fonts/font_global_context.h" +#include "third_party/blink/renderer/platform/fonts/font_selector.h" +#include "third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h" #include "third_party/blink/renderer/platform/fonts/simple_font_data.h" #include "third_party/blink/renderer/platform/histogram.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink { +namespace { + +void NotifyFontUniqueNameLookupReadyWeakPtr( + base::WeakPtr<LocalFontFaceSource> local_font_face_source) { + if (local_font_face_source) + local_font_face_source->NotifyFontUniqueNameLookupReady(); +} + +} // namespace + +LocalFontFaceSource::LocalFontFaceSource(CSSFontFace* css_font_face, + FontSelector* font_selector, + const String& font_name) + : face_(css_font_face), + font_selector_(font_selector), + font_name_(font_name), + weak_factory_(this) { + was_resolved_ = IsLocalNonBlocking(); +} + +LocalFontFaceSource::~LocalFontFaceSource() {} + +bool LocalFontFaceSource::IsLocalNonBlocking() const { +#if defined(OS_MACOSX) + return true; +#else + FontUniqueNameLookup* unique_name_lookup = + FontGlobalContext::Get()->GetFontUniqueNameLookup(); + return unique_name_lookup->IsFontUniqueNameLookupReadyForSyncLookup(); +#endif +} + bool LocalFontFaceSource::IsLocalFontAvailable( - const FontDescription& font_description) { + const FontDescription& font_description) const { return FontCache::GetFontCache()->IsPlatformFontUniqueNameMatchAvailable( font_description, font_name_); } +scoped_refptr<SimpleFontData> +LocalFontFaceSource::CreateLoadingFallbackFontData( + const FontDescription& font_description) { + FontCachePurgePreventer font_cache_purge_preventer; + scoped_refptr<SimpleFontData> temporary_font = + FontCache::GetFontCache()->GetLastResortFallbackFont(font_description, + kDoNotRetain); + if (!temporary_font) { + NOTREACHED(); + return nullptr; + } + scoped_refptr<CSSCustomFontData> css_font_data = + CSSCustomFontData::Create(this, CSSCustomFontData::kVisibleFallback); + return SimpleFontData::Create(temporary_font->PlatformData(), css_font_data); +} + scoped_refptr<SimpleFontData> LocalFontFaceSource::CreateFontData( const FontDescription& font_description, const FontSelectionCapabilities&) { + if (!IsValid()) + return nullptr; + + if (IsValid() && IsLoading()) { + return CreateLoadingFallbackFontData(font_description); + } + + DCHECK(was_resolved_); // FIXME(drott) crbug.com/627143: We still have the issue of matching // family name instead of postscript name for local fonts. However, we // should definitely not try to take into account the full requested @@ -45,6 +108,44 @@ return font_data; } +void LocalFontFaceSource::BeginLoadIfNeeded() { + if (IsLoaded()) + return; + + FontUniqueNameLookup* unique_name_lookup = + FontGlobalContext::Get()->GetFontUniqueNameLookup(); + DCHECK(unique_name_lookup); + unique_name_lookup->PrepareFontUniqueNameLookup( + WTF::Bind(&NotifyFontUniqueNameLookupReadyWeakPtr, GetWeakPtr())); + face_->DidBeginLoad(); +} + +void LocalFontFaceSource::NotifyFontUniqueNameLookupReady() { + was_resolved_ = IsLocalFontAvailable(FontDescription()); + + PruneTable(); + + if (face_->FontLoaded(this)) { + font_selector_->FontFaceInvalidated(); + } +} + +base::WeakPtr<LocalFontFaceSource> LocalFontFaceSource::GetWeakPtr() { + return weak_factory_.GetWeakPtr(); +} + +bool LocalFontFaceSource::IsLoaded() const { + return IsLocalNonBlocking(); +} + +bool LocalFontFaceSource::IsLoading() const { + return !IsLocalNonBlocking(); +} + +bool LocalFontFaceSource::IsValid() const { + return IsLoading() || was_resolved_; +} + void LocalFontFaceSource::LocalFontHistograms::Record(bool load_success) { if (reported_) return; @@ -54,4 +155,10 @@ local_font_used_histogram.Count(load_success ? 1 : 0); } +void LocalFontFaceSource::Trace(blink::Visitor* visitor) { + visitor->Trace(face_); + visitor->Trace(font_selector_); + CSSFontFaceSource::Trace(visitor); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/css/local_font_face_source.h b/third_party/blink/renderer/core/css/local_font_face_source.h index ceb5fa6a..04ba160 100644 --- a/third_party/blink/renderer/core/css/local_font_face_source.h +++ b/third_party/blink/renderer/core/css/local_font_face_source.h
@@ -5,17 +5,54 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_LOCAL_FONT_FACE_SOURCE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_LOCAL_FONT_FACE_SOURCE_H_ +#include "base/memory/weak_ptr.h" #include "third_party/blink/renderer/core/css/css_font_face_source.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink { -class LocalFontFaceSource final : public CSSFontFaceSource { +class CSSFontFace; +class FontSelector; + +// LocalFontFaceSource represents a src: local(<unique_name>) font face +// source. It operates in one of two ways: Synchronous or asynchronous, +// depending on what the platform implementation of FontUniqueNameLookup +// supports. If it operates in synchronous mode, IsLocalNonBlocking() return +// true and lookups are performed immediately. If IsLocalNonBlocking() returns +// false, a fallback font is returned from GetFontData() until +// FontUniqueNameLookup is ready (which is signalled by a callback). When +// FontUniqueNameLookup becomes ready, LocalFontFaceSource can lookup fonts +// synchronously and a relayout is triggered. +class LocalFontFaceSource final : public CSSFontFaceSource, + public GarbageCollectedMixin { + USING_GARBAGE_COLLECTED_MIXIN(LocalFontFaceSource); + public: - LocalFontFaceSource(const String& font_name) : font_name_(font_name) {} - bool IsLocal() const override { return true; } - bool IsLocalFontAvailable(const FontDescription&) override; + LocalFontFaceSource(CSSFontFace*, FontSelector*, const String& font_name); + ~LocalFontFaceSource() override; + + // Returns whether this font can be immediately retrieved using a non-blocking + // font lookup, or whether it may need to be retrieved asynchronously, + // behaving similar to a RemoteFontFaceSource. This is needed on Windows 7 and + // 8 where the font lookup map needs to be built first. + bool IsLocalNonBlocking() const override; + bool IsLocalFontAvailable(const FontDescription&) const override; + bool IsLoaded() const override; + bool IsLoading() const override; + bool IsValid() const override; + + void BeginLoadIfNeeded() override; + + void Trace(blink::Visitor* visitor) override; + + void NotifyFontUniqueNameLookupReady(); + + base::WeakPtr<LocalFontFaceSource> GetWeakPtr(); + + protected: + scoped_refptr<SimpleFontData> CreateLoadingFallbackFontData( + const FontDescription&); private: scoped_refptr<SimpleFontData> CreateFontData( @@ -33,8 +70,13 @@ bool reported_; }; + Member<CSSFontFace> face_; + Member<FontSelector> font_selector_; + + bool was_resolved_ = false; AtomicString font_name_; LocalFontHistograms histograms_; + base::WeakPtrFactory<LocalFontFaceSource> weak_factory_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/css/parser/css_parser_token_stream_test.cc b/third_party/blink/renderer/core/css/parser/css_parser_token_stream_test.cc index 89ef4e3f..2ca146e7 100644 --- a/third_party/blink/renderer/core/css/parser/css_parser_token_stream_test.cc +++ b/third_party/blink/renderer/core/css/parser/css_parser_token_stream_test.cc
@@ -6,6 +6,8 @@ #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" + namespace blink { namespace { @@ -93,11 +95,12 @@ } TEST(CSSParserTokenStreamTest, RangesDoNotGetInvalidatedWhenConsuming) { - String s = "1 "; + StringBuilder s; + s.Append("1 "); for (int i = 0; i < 100; i++) - s.append("A "); + s.Append("A "); - CSSTokenizer tokenizer(s); + CSSTokenizer tokenizer(s.ToString()); CSSParserTokenStream stream(tokenizer); // Consume a single token range.
diff --git a/third_party/blink/renderer/core/css/properties/css_property.h b/third_party/blink/renderer/core/css/properties/css_property.h index dafda03..33fd538 100644 --- a/third_party/blink/renderer/core/css/properties/css_property.h +++ b/third_party/blink/renderer/core/css/properties/css_property.h
@@ -48,12 +48,11 @@ bool IsValidForVisitedLink() const { return flags_ & kValidForVisitedLink; } bool IsShorthand() const { return flags_ & kShorthand; } bool IsLonghand() const { return flags_ & kLonghand; } + bool IsInherited() const { return flags_ & kInherited; } bool IsRepeated() const { return repetition_separator_ != '\0'; } char RepetitionSeparator() const { return repetition_separator_; } - virtual bool IsInherited() const { return false; } - virtual bool IsAffectedByAll() const { return IsEnabled() && IsProperty(); } virtual bool IsLayoutDependentProperty() const { return false; } virtual bool IsLayoutDependent(const ComputedStyle* style, @@ -89,7 +88,7 @@ Vector<const CSSProperty*>&); protected: - enum Flag : uint8_t { + enum Flag : uint16_t { kInterpolable = 1 << 0, kCompositableProperty = 1 << 1, kDescriptor = 1 << 2, @@ -97,11 +96,12 @@ kProperty = 1 << 4, kValidForVisitedLink = 1 << 5, kShorthand = 1 << 6, - kLonghand = 1 << 7 + kLonghand = 1 << 7, + kInherited = 1 << 8 }; constexpr CSSProperty(CSSPropertyID property_id, - uint8_t flags, + uint16_t flags, char repetition_separator) : CSSUnresolvedProperty(), property_id_(property_id), @@ -128,7 +128,7 @@ private: CSSPropertyID property_id_; - uint8_t flags_; + uint16_t flags_; char repetition_separator_; };
diff --git a/third_party/blink/renderer/core/css/properties/longhand.h b/third_party/blink/renderer/core/css/properties/longhand.h index 1697d6f6..6bdebb7b 100644 --- a/third_party/blink/renderer/core/css/properties/longhand.h +++ b/third_party/blink/renderer/core/css/properties/longhand.h
@@ -43,7 +43,9 @@ } protected: - constexpr Longhand(CSSPropertyID id, uint8_t flags, char repetition_separator) + constexpr Longhand(CSSPropertyID id, + uint16_t flags, + char repetition_separator) : CSSProperty(id, flags | kLonghand, repetition_separator) {} };
diff --git a/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc b/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc index 6b79a63..8a52ebd 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc +++ b/third_party/blink/renderer/core/css/properties/longhands/custom_property.cc
@@ -15,16 +15,17 @@ CustomProperty::CustomProperty(const AtomicString& name, const Document& document) - : name_(name), registration_(PropertyRegistration::From(&document, name)) {} + : CustomProperty(name, PropertyRegistration::From(&document, name)) {} CustomProperty::CustomProperty(const AtomicString& name, const PropertyRegistry* registry) - : name_(name), - registration_(registry ? registry->Registration(name) : nullptr) {} + : CustomProperty(name, registry ? registry->Registration(name) : nullptr) {} -bool CustomProperty::IsInherited() const { - return !registration_ || registration_->Inherits(); -} +CustomProperty::CustomProperty(const AtomicString& name, + const PropertyRegistration* registration) + : Variable(!registration || registration->Inherits()), + name_(name), + registration_(registration) {} const AtomicString& CustomProperty::GetPropertyNameAtomicString() const { return name_;
diff --git a/third_party/blink/renderer/core/css/properties/longhands/custom_property.h b/third_party/blink/renderer/core/css/properties/longhands/custom_property.h index 0cbabc05..30ab365 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/custom_property.h +++ b/third_party/blink/renderer/core/css/properties/longhands/custom_property.h
@@ -24,11 +24,12 @@ DISALLOW_NEW(); public: - CustomProperty() = default; + CustomProperty() + : CustomProperty(AtomicString(), + static_cast<const PropertyRegistration*>(nullptr)) {} CustomProperty(const AtomicString& name, const Document&); CustomProperty(const AtomicString& name, const PropertyRegistry*); - bool IsInherited() const override; const AtomicString& GetPropertyNameAtomicString() const override; CSSPropertyName GetCSSPropertyName() const override; @@ -50,6 +51,9 @@ void Trace(blink::Visitor* visitor) { visitor->Trace(registration_); } private: + CustomProperty(const AtomicString& name, + const PropertyRegistration* registration); + const CSSValue* ParseUntyped(CSSParserTokenRange, const CSSParserContext&, const CSSParserLocalContext&) const;
diff --git a/third_party/blink/renderer/core/css/properties/longhands/variable.h b/third_party/blink/renderer/core/css/properties/longhands/variable.h index 63ad728..2f41573 100644 --- a/third_party/blink/renderer/core/css/properties/longhands/variable.h +++ b/third_party/blink/renderer/core/css/properties/longhands/variable.h
@@ -17,9 +17,8 @@ // (as returned by GetCSSPropertyVariable()) has been removed. class CORE_EXPORT Variable : public Longhand { public: - constexpr Variable() : Longhand(CSSPropertyID::kVariable, kProperty, '\0') {} + constexpr Variable() : Variable(true) {} - bool IsInherited() const override { return true; } bool IsAffectedByAll() const override { return false; } CSSPropertyName GetCSSPropertyName() const override { NOTREACHED(); @@ -32,6 +31,12 @@ } static bool IsStaticInstance(const CSSProperty&); + + protected: + constexpr Variable(bool inherited) + : Longhand(CSSPropertyID::kVariable, + kProperty | (inherited ? kInherited : 0), + '\0') {} }; } // namespace blink
diff --git a/third_party/blink/renderer/core/css/properties/shorthand.h b/third_party/blink/renderer/core/css/properties/shorthand.h index c794986..a4743b27 100644 --- a/third_party/blink/renderer/core/css/properties/shorthand.h +++ b/third_party/blink/renderer/core/css/properties/shorthand.h
@@ -32,7 +32,7 @@ protected: constexpr Shorthand(CSSPropertyID id, - uint8_t flags, + uint16_t flags, char repetition_separator) : CSSProperty(id, flags | kShorthand, repetition_separator) {} };
diff --git a/third_party/blink/renderer/core/css/property_set_css_style_declaration.h b/third_party/blink/renderer/core/css/property_set_css_style_declaration.h index c93dd24..c0eef99 100644 --- a/third_party/blink/renderer/core/css/property_set_css_style_declaration.h +++ b/third_party/blink/renderer/core/css/property_set_css_style_declaration.h
@@ -27,7 +27,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_PROPERTY_SET_CSS_STYLE_DECLARATION_H_ #include "third_party/blink/renderer/core/css/abstract_property_set_css_style_declaration.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" namespace blink {
diff --git a/third_party/blink/renderer/core/css/remote_font_face_source.h b/third_party/blink/renderer/core/css/remote_font_face_source.h index aa8cc95..3d7eafe93 100644 --- a/third_party/blink/renderer/core/css/remote_font_face_source.h +++ b/third_party/blink/renderer/core/css/remote_font_face_source.h
@@ -48,7 +48,7 @@ // For UMA reporting bool HadBlankText() override { return histograms_.HadBlankText(); } - void PaintRequested() { histograms_.FallbackFontPainted(period_); } + void PaintRequested() override { histograms_.FallbackFontPainted(period_); } void Trace(blink::Visitor*) override;
diff --git a/third_party/blink/renderer/core/css/style_engine.cc b/third_party/blink/renderer/core/css/style_engine.cc index 79f90bb4..74ac3a1 100644 --- a/third_party/blink/renderer/core/css/style_engine.cc +++ b/third_party/blink/renderer/core/css/style_engine.cc
@@ -134,8 +134,8 @@ return it->value.Get(); } -const HeapVector<TraceWrapperMember<StyleSheet>>& -StyleEngine::StyleSheetsForStyleSheetList(TreeScope& tree_scope) { +const HeapVector<Member<StyleSheet>>& StyleEngine::StyleSheetsForStyleSheetList( + TreeScope& tree_scope) { DCHECK(Master()); TreeScopeStyleSheetCollection& collection = EnsureStyleSheetCollectionFor(tree_scope); @@ -157,10 +157,10 @@ void StyleEngine::InjectSheet(const StyleSheetKey& key, StyleSheetContents* sheet, WebDocument::CSSOrigin origin) { - HeapVector<std::pair<StyleSheetKey, TraceWrapperMember<CSSStyleSheet>>>& - injected_style_sheets = origin == WebDocument::kUserOrigin - ? injected_user_style_sheets_ - : injected_author_style_sheets_; + HeapVector<std::pair<StyleSheetKey, Member<CSSStyleSheet>>>& + injected_style_sheets = + origin == WebDocument::kUserOrigin ? injected_user_style_sheets_ + : injected_author_style_sheets_; injected_style_sheets.push_back( std::make_pair(key, CSSStyleSheet::Create(sheet, *document_))); if (origin == WebDocument::kUserOrigin) @@ -171,10 +171,10 @@ void StyleEngine::RemoveInjectedSheet(const StyleSheetKey& key, WebDocument::CSSOrigin origin) { - HeapVector<std::pair<StyleSheetKey, TraceWrapperMember<CSSStyleSheet>>>& - injected_style_sheets = origin == WebDocument::kUserOrigin - ? injected_user_style_sheets_ - : injected_author_style_sheets_; + HeapVector<std::pair<StyleSheetKey, Member<CSSStyleSheet>>>& + injected_style_sheets = + origin == WebDocument::kUserOrigin ? injected_user_style_sheets_ + : injected_author_style_sheets_; // Remove the last sheet that matches. const auto& it = std::find_if(injected_style_sheets.rbegin(), injected_style_sheets.rend(),
diff --git a/third_party/blink/renderer/core/css/style_engine.h b/third_party/blink/renderer/core/css/style_engine.h index ce70b61..5ce9adc 100644 --- a/third_party/blink/renderer/core/css/style_engine.h +++ b/third_party/blink/renderer/core/css/style_engine.h
@@ -51,7 +51,6 @@ #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/tree_ordered_list.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/fonts/font_selector_client.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" @@ -103,11 +102,10 @@ explicit StyleEngine(Document&); ~StyleEngine() override; - const HeapVector<TraceWrapperMember<StyleSheet>>& - StyleSheetsForStyleSheetList(TreeScope&); + const HeapVector<Member<StyleSheet>>& StyleSheetsForStyleSheetList( + TreeScope&); - const HeapVector< - std::pair<StyleSheetKey, TraceWrapperMember<CSSStyleSheet>>>& + const HeapVector<std::pair<StyleSheetKey, Member<CSSStyleSheet>>>& InjectedAuthorStyleSheets() const { return injected_author_style_sheets_; } @@ -463,8 +461,7 @@ Member<CSSStyleSheet> inspector_style_sheet_; - TraceWrapperMember<DocumentStyleSheetCollection> - document_style_sheet_collection_; + Member<DocumentStyleSheetCollection> document_style_sheet_collection_; Member<StyleRuleUsageTracker> tracker_; @@ -514,9 +511,9 @@ std::unique_ptr<StyleResolverStats> style_resolver_stats_; unsigned style_for_element_count_ = 0; - HeapVector<std::pair<StyleSheetKey, TraceWrapperMember<CSSStyleSheet>>> + HeapVector<std::pair<StyleSheetKey, Member<CSSStyleSheet>>> injected_user_style_sheets_; - HeapVector<std::pair<StyleSheetKey, TraceWrapperMember<CSSStyleSheet>>> + HeapVector<std::pair<StyleSheetKey, Member<CSSStyleSheet>>> injected_author_style_sheets_; ActiveStyleSheetVector active_user_style_sheets_;
diff --git a/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h b/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h index 5404c969..00f0d29 100644 --- a/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h +++ b/third_party/blink/renderer/core/css/style_rule_css_style_declaration.h
@@ -27,7 +27,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_STYLE_RULE_CSS_STYLE_DECLARATION_H_ #include "third_party/blink/renderer/core/css/property_set_css_style_declaration.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -52,7 +51,7 @@ void DidMutate(MutationType) override; PropertyRegistry* GetPropertyRegistry() const final; - TraceWrapperMember<CSSRule> parent_rule_; + Member<CSSRule> parent_rule_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/css/style_sheet_collection.cc b/third_party/blink/renderer/core/css/style_sheet_collection.cc index 73fc14c..0b30462 100644 --- a/third_party/blink/renderer/core/css/style_sheet_collection.cc +++ b/third_party/blink/renderer/core/css/style_sheet_collection.cc
@@ -49,7 +49,7 @@ void StyleSheetCollection::SwapSheetsForSheetList( HeapVector<Member<StyleSheet>>& sheets) { - ::blink::swap(style_sheets_for_style_sheet_list_, sheets); + swap(style_sheets_for_style_sheet_list_, sheets); sheet_list_dirty_ = false; }
diff --git a/third_party/blink/renderer/core/css/style_sheet_collection.h b/third_party/blink/renderer/core/css/style_sheet_collection.h index 140c4b0..801a537a6 100644 --- a/third_party/blink/renderer/core/css/style_sheet_collection.h +++ b/third_party/blink/renderer/core/css/style_sheet_collection.h
@@ -34,7 +34,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css/active_style_sheets.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -55,8 +54,7 @@ const ActiveStyleSheetVector& ActiveAuthorStyleSheets() const { return active_author_style_sheets_; } - const HeapVector<TraceWrapperMember<StyleSheet>>& - StyleSheetsForStyleSheetList() const { + const HeapVector<Member<StyleSheet>>& StyleSheetsForStyleSheetList() const { return style_sheets_for_style_sheet_list_; } @@ -74,7 +72,7 @@ void Dispose(); protected: - HeapVector<TraceWrapperMember<StyleSheet>> style_sheets_for_style_sheet_list_; + HeapVector<Member<StyleSheet>> style_sheets_for_style_sheet_list_; ActiveStyleSheetVector active_author_style_sheets_; bool sheet_list_dirty_ = true;
diff --git a/third_party/blink/renderer/core/css/style_sheet_list.cc b/third_party/blink/renderer/core/css/style_sheet_list.cc index 62cf8c1..afca618 100644 --- a/third_party/blink/renderer/core/css/style_sheet_list.cc +++ b/third_party/blink/renderer/core/css/style_sheet_list.cc
@@ -34,8 +34,8 @@ CHECK(tree_scope); } -inline const HeapVector<TraceWrapperMember<StyleSheet>>& -StyleSheetList::StyleSheets() const { +inline const HeapVector<Member<StyleSheet>>& StyleSheetList::StyleSheets() + const { return GetDocument()->GetStyleEngine().StyleSheetsForStyleSheetList( *tree_scope_); } @@ -51,7 +51,7 @@ return index < style_sheet_vector_.size() ? style_sheet_vector_[index].Get() : nullptr; } - const HeapVector<TraceWrapperMember<StyleSheet>>& sheets = StyleSheets(); + const HeapVector<Member<StyleSheet>>& sheets = StyleSheets(); return index < sheets.size() ? sheets[index].Get() : nullptr; }
diff --git a/third_party/blink/renderer/core/css/style_sheet_list.h b/third_party/blink/renderer/core/css/style_sheet_list.h index bb9c7efc..dd80ae61 100644 --- a/third_party/blink/renderer/core/css/style_sheet_list.h +++ b/third_party/blink/renderer/core/css/style_sheet_list.h
@@ -23,7 +23,6 @@ #include "third_party/blink/renderer/core/css/css_style_sheet.h" #include "third_party/blink/renderer/core/dom/tree_scope.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/forward.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -54,7 +53,7 @@ void Trace(blink::Visitor*) override; private: - const HeapVector<TraceWrapperMember<StyleSheet>>& StyleSheets() const; + const HeapVector<Member<StyleSheet>>& StyleSheets() const; Member<TreeScope> tree_scope_; HeapVector<Member<CSSStyleSheet>> style_sheet_vector_;
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.h b/third_party/blink/renderer/core/display_lock/display_lock_context.h index ee878c3..d8b7dbe 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context.h +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.h
@@ -12,7 +12,6 @@ #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/core/dom/attr.h b/third_party/blink/renderer/core/dom/attr.h index 67c7f8ff..b932c98 100644 --- a/third_party/blink/renderer/core/dom/attr.h +++ b/third_party/blink/renderer/core/dom/attr.h
@@ -29,7 +29,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/node.h" #include "third_party/blink/renderer/core/dom/qualified_name.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -76,7 +75,7 @@ // standalone Node.) // Note that name_ is always set, but element_ / // standalone_value_or_attached_local_name_ may be null. - TraceWrapperMember<Element> element_; + Member<Element> element_; QualifiedName name_; // Holds the value if it is a standalone Node, or the local name of the // attribute it is attached to on an Element. The latter may (letter case)
diff --git a/third_party/blink/renderer/core/dom/container_node.h b/third_party/blink/renderer/core/dom/container_node.h index d4258d6..55a91288 100644 --- a/third_party/blink/renderer/core/dom/container_node.h +++ b/third_party/blink/renderer/core/dom/container_node.h
@@ -30,7 +30,6 @@ #include "third_party/blink/renderer/core/css/style_recalc.h" #include "third_party/blink/renderer/core/dom/node.h" #include "third_party/blink/renderer/core/html/collection_type.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { @@ -456,8 +455,8 @@ ExceptionState&) const; inline bool IsChildTypeAllowed(const Node& child) const; - TraceWrapperMember<Node> first_child_; - TraceWrapperMember<Node> last_child_; + Member<Node> first_child_; + Member<Node> last_child_; }; DEFINE_NODE_TYPE_CASTS(ContainerNode, IsContainerNode());
diff --git a/third_party/blink/renderer/core/dom/document.h b/third_party/blink/renderer/core/dom/document.h index 443523f..4b3f578 100644 --- a/third_party/blink/renderer/core/dom/document.h +++ b/third_party/blink/renderer/core/dom/document.h
@@ -65,7 +65,6 @@ #include "third_party/blink/renderer/core/html/parser/parser_synchronization_policy.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" #include "third_party/blink/renderer/platform/timer.h" @@ -1673,15 +1672,15 @@ PendingSheetLayout pending_sheet_layout_; Member<LocalFrame> frame_; - TraceWrapperMember<LocalDOMWindow> dom_window_; - TraceWrapperMember<HTMLImportsController> imports_controller_; + Member<LocalDOMWindow> dom_window_; + Member<HTMLImportsController> imports_controller_; // The document of creator browsing context for frame-less documents such as // documents created by DOMParser and DOMImplementation. WeakMember<Document> context_document_; Member<ResourceFetcher> fetcher_; - TraceWrapperMember<DocumentParser> parser_; + Member<DocumentParser> parser_; Member<ContextFeatures> context_features_; bool well_formed_; @@ -1706,7 +1705,7 @@ AtomicString mime_type_; Member<DocumentType> doc_type_; - TraceWrapperMember<DOMImplementation> implementation_; + Member<DOMImplementation> implementation_; Member<CSSStyleSheet> elem_sheet_; @@ -1754,8 +1753,8 @@ MutationObserverOptions mutation_observer_types_; - TraceWrapperMember<StyleEngine> style_engine_; - TraceWrapperMember<StyleSheetList> style_sheet_list_; + Member<StyleEngine> style_engine_; + Member<StyleSheetList> style_sheet_list_; Member<FormController> form_controller_; @@ -1803,7 +1802,7 @@ double start_time_; - TraceWrapperMember<ScriptRunner> script_runner_; + Member<ScriptRunner> script_runner_; HeapVector<Member<ScriptElementBase>> current_script_stack_; @@ -1866,9 +1865,8 @@ bool write_recursion_is_too_deep_; unsigned write_recursion_depth_; - TraceWrapperMember<ScriptedAnimationController> - scripted_animation_controller_; - TraceWrapperMember<ScriptedIdleTaskController> scripted_idle_task_controller_; + Member<ScriptedAnimationController> scripted_animation_controller_; + Member<ScriptedIdleTaskController> scripted_idle_task_controller_; Member<TextAutosizer> text_autosizer_; Member<V0CustomElementRegistrationContext> registration_context_; @@ -1904,8 +1902,7 @@ Member<CanvasFontCache> canvas_font_cache_; - TraceWrapperMember<IntersectionObserverController> - intersection_observer_controller_; + Member<IntersectionObserverController> intersection_observer_controller_; Member<ResizeObserverController> resize_observer_controller_; int node_count_;
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index b7acae9b..b10ee7c 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -3859,14 +3859,14 @@ return false; } -HeapHashMap<TraceWrapperMember<ResizeObserver>, Member<ResizeObservation>>* +HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>* Element::ResizeObserverData() const { if (HasRareData()) return GetElementRareData()->ResizeObserverData(); return nullptr; } -HeapHashMap<TraceWrapperMember<ResizeObserver>, Member<ResizeObservation>>& +HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>& Element::EnsureResizeObserverData() { return EnsureElementRareData().EnsureResizeObserverData(); } @@ -5391,7 +5391,7 @@ void Element::Trace(Visitor* visitor) { if (HasRareData()) - visitor->TraceWithWrappers(GetElementRareData()); + visitor->Trace(GetElementRareData()); visitor->Trace(element_data_); ContainerNode::Trace(visitor); }
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index 76bc9ed..bf59e7b 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -42,7 +42,6 @@ #include "third_party/blink/renderer/core/resize_observer/resize_observer.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" @@ -150,7 +149,7 @@ Member<const FocusOptions> options; }; -typedef HeapVector<TraceWrapperMember<Attr>> AttrNodeList; +typedef HeapVector<Member<Attr>> AttrNodeList; typedef HashMap<AtomicString, SpecificTrustedType> AttrNameToTrustedType; @@ -901,9 +900,9 @@ // for which trackVisibility() is true. bool NeedsOcclusionTracking() const; - HeapHashMap<TraceWrapperMember<ResizeObserver>, Member<ResizeObservation>>* + HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>* ResizeObserverData() const; - HeapHashMap<TraceWrapperMember<ResizeObserver>, Member<ResizeObservation>>& + HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>& EnsureResizeObserverData(); void SetNeedsResizeObserverUpdate();
diff --git a/third_party/blink/renderer/core/dom/element_rare_data.cc b/third_party/blink/renderer/core/dom/element_rare_data.cc index ce508fa..ca9b48e 100644 --- a/third_party/blink/renderer/core/dom/element_rare_data.cc +++ b/third_party/blink/renderer/core/dom/element_rare_data.cc
@@ -82,9 +82,8 @@ ElementRareData::ResizeObserverDataMap& ElementRareData::EnsureResizeObserverData() { if (!resize_observer_data_) { - resize_observer_data_ = - MakeGarbageCollected<HeapHashMap<TraceWrapperMember<ResizeObserver>, - Member<ResizeObservation>>>(); + resize_observer_data_ = MakeGarbageCollected< + HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>>(); } return *resize_observer_data_; }
diff --git a/third_party/blink/renderer/core/dom/element_rare_data.h b/third_party/blink/renderer/core/dom/element_rare_data.h index 88dcd7c..1bcb03e 100644 --- a/third_party/blink/renderer/core/dom/element_rare_data.h +++ b/third_party/blink/renderer/core/dom/element_rare_data.h
@@ -41,7 +41,6 @@ #include "third_party/blink/renderer/core/html/custom/custom_element_definition.h" #include "third_party/blink/renderer/core/html/custom/v0_custom_element_definition.h" #include "third_party/blink/renderer/core/intersection_observer/element_intersection_observer_data.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" @@ -188,8 +187,8 @@ return *intersection_observer_data_; } - using ResizeObserverDataMap = HeapHashMap<TraceWrapperMember<ResizeObserver>, - Member<ResizeObservation>>; + using ResizeObserverDataMap = + HeapHashMap<Member<ResizeObserver>, Member<ResizeObservation>>; ResizeObserverDataMap* ResizeObserverData() const { return resize_observer_data_; @@ -217,30 +216,29 @@ ScrollOffset saved_layer_scroll_offset_; AtomicString nonce_; - TraceWrapperMember<DatasetDOMStringMap> dataset_; - TraceWrapperMember<ShadowRoot> shadow_root_; - TraceWrapperMember<DOMTokenList> class_list_; - TraceWrapperMember<DOMTokenList> part_; + Member<DatasetDOMStringMap> dataset_; + Member<ShadowRoot> shadow_root_; + Member<DOMTokenList> class_list_; + Member<DOMTokenList> part_; std::unique_ptr<NamesMap> part_names_map_; - TraceWrapperMember<NamedNodeMap> attribute_map_; - TraceWrapperMember<AttrNodeList> attr_node_list_; - TraceWrapperMember<InlineCSSStyleDeclaration> cssom_wrapper_; - TraceWrapperMember<InlineStylePropertyMap> cssom_map_wrapper_; + Member<NamedNodeMap> attribute_map_; + Member<AttrNodeList> attr_node_list_; + Member<InlineCSSStyleDeclaration> cssom_wrapper_; + Member<InlineStylePropertyMap> cssom_map_wrapper_; Member<ElementAnimations> element_animations_; - TraceWrapperMember<ElementIntersectionObserverData> - intersection_observer_data_; - TraceWrapperMember<ResizeObserverDataMap> resize_observer_data_; + Member<ElementIntersectionObserverData> intersection_observer_data_; + Member<ResizeObserverDataMap> resize_observer_data_; // TODO(davaajav):remove this field when v0 custom elements are deprecated Member<V0CustomElementDefinition> v0_custom_element_definition_; Member<CustomElementDefinition> custom_element_definition_; AtomicString is_value_; - TraceWrapperMember<ElementInternals> element_internals_; + Member<ElementInternals> element_internals_; Member<PseudoElementData> pseudo_element_data_; - TraceWrapperMember<AccessibleNode> accessible_node_; + Member<AccessibleNode> accessible_node_; WeakMember<DisplayLockContext> display_lock_context_; bool did_attach_internals_ = false;
diff --git a/third_party/blink/renderer/core/dom/events/event_listener_map.h b/third_party/blink/renderer/core/dom/events/event_listener_map.h index 681e698..228cbfc2 100644 --- a/third_party/blink/renderer/core/dom/events/event_listener_map.h +++ b/third_party/blink/renderer/core/dom/events/event_listener_map.h
@@ -82,9 +82,7 @@ // - HeapVector is much more space efficient than HeapHashMap. // - An EventTarget rarely has event listeners for many event types, and // HeapVector is faster in such cases. - HeapVector<std::pair<AtomicString, TraceWrapperMember<EventListenerVector>>, - 2> - entries_; + HeapVector<std::pair<AtomicString, Member<EventListenerVector>>, 2> entries_; #if DCHECK_IS_ON() int active_iterator_count_ = 0;
diff --git a/third_party/blink/renderer/core/dom/events/event_queue.cc b/third_party/blink/renderer/core/dom/events/event_queue.cc index ad2a3b7..89c80e0 100644 --- a/third_party/blink/renderer/core/dom/events/event_queue.cc +++ b/third_party/blink/renderer/core/dom/events/event_queue.cc
@@ -31,6 +31,7 @@ #include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/probe/core_probes.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/dom/events/event_target.cc b/third_party/blink/renderer/core/dom/events/event_target.cc index cbc1ab9..09f4e9f 100644 --- a/third_party/blink/renderer/core/dom/events/event_target.cc +++ b/third_party/blink/renderer/core/dom/events/event_target.cc
@@ -57,6 +57,7 @@ #include "third_party/blink/renderer/platform/bindings/v8_dom_activity_logger.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/blink/renderer/platform/wtf/assertions.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/threading.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/dom/events/registered_event_listener.h b/third_party/blink/renderer/core/dom/events/registered_event_listener.h index 1cb068a..baeea9d 100644 --- a/third_party/blink/renderer/core/dom/events/registered_event_listener.h +++ b/third_party/blink/renderer/core/dom/events/registered_event_listener.h
@@ -26,7 +26,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_REGISTERED_EVENT_LISTENER_H_ #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -83,7 +82,7 @@ bool ShouldFire(const Event&) const; private: - TraceWrapperMember<EventListener> callback_; + Member<EventListener> callback_; unsigned use_capture_ : 1; unsigned passive_ : 1; unsigned once_ : 1;
diff --git a/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc b/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc index 060df26d..8abef86 100644 --- a/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc +++ b/third_party/blink/renderer/core/dom/flat_tree_traversal_test.cc
@@ -18,7 +18,6 @@ #include "third_party/blink/renderer/platform/geometry/int_size.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/core/dom/frame_request_callback_collection.h b/third_party/blink/renderer/core/dom/frame_request_callback_collection.h index 2a3a65c7..87f35b2 100644 --- a/third_party/blink/renderer/core/dom/frame_request_callback_collection.h +++ b/third_party/blink/renderer/core/dom/frame_request_callback_collection.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/dom_high_res_time_stamp.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -69,7 +68,7 @@ void Invoke(double) override; private: - TraceWrapperMember<V8FrameRequestCallback> callback_; + Member<V8FrameRequestCallback> callback_; }; CallbackId RegisterCallback(FrameCallback*); @@ -84,7 +83,7 @@ } private: - using CallbackList = HeapVector<TraceWrapperMember<FrameCallback>>; + using CallbackList = HeapVector<Member<FrameCallback>>; CallbackList callbacks_; CallbackList callbacks_to_invoke_; // only non-empty while inside executeCallbacks
diff --git a/third_party/blink/renderer/core/dom/mutation_observer.cc b/third_party/blink/renderer/core/dom/mutation_observer.cc index e15b9e3..3318e630 100644 --- a/third_party/blink/renderer/core/dom/mutation_observer.cc +++ b/third_party/blink/renderer/core/dom/mutation_observer.cc
@@ -80,7 +80,7 @@ } private: - TraceWrapperMember<V8MutationCallback> callback_; + Member<V8MutationCallback> callback_; }; static unsigned g_observer_priority = 0;
diff --git a/third_party/blink/renderer/core/dom/mutation_observer.h b/third_party/blink/renderer/core/dom/mutation_observer.h index fb80573..eaa2b38c 100644 --- a/third_party/blink/renderer/core/dom/mutation_observer.h +++ b/third_party/blink/renderer/core/dom/mutation_observer.h
@@ -39,7 +39,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -126,8 +125,8 @@ bool ShouldBeSuspended() const; void CancelInspectorAsyncTasks(); - TraceWrapperMember<Delegate> delegate_; - HeapVector<TraceWrapperMember<MutationRecord>> records_; + Member<Delegate> delegate_; + HeapVector<Member<MutationRecord>> records_; MutationObserverRegistrationSet registrations_; unsigned priority_;
diff --git a/third_party/blink/renderer/core/dom/mutation_observer_registration.h b/third_party/blink/renderer/core/dom/mutation_observer_registration.h index 57ee473..a535ac48 100644 --- a/third_party/blink/renderer/core/dom/mutation_observer_registration.h +++ b/third_party/blink/renderer/core/dom/mutation_observer_registration.h
@@ -34,7 +34,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/mutation_observer.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" @@ -94,7 +93,7 @@ } private: - TraceWrapperMember<MutationObserver> observer_; + Member<MutationObserver> observer_; WeakMember<Node> registration_node_; Member<Node> registration_node_keep_alive_; typedef HeapHashSet<Member<Node>> NodeHashSet;
diff --git a/third_party/blink/renderer/core/dom/mutation_record.cc b/third_party/blink/renderer/core/dom/mutation_record.cc index 14dc6a4..15ab3519 100644 --- a/third_party/blink/renderer/core/dom/mutation_record.cc +++ b/third_party/blink/renderer/core/dom/mutation_record.cc
@@ -70,9 +70,9 @@ Node* previousSibling() override { return previous_sibling_.Get(); } Node* nextSibling() override { return next_sibling_.Get(); } - TraceWrapperMember<Node> target_; - TraceWrapperMember<StaticNodeList> added_nodes_; - TraceWrapperMember<StaticNodeList> removed_nodes_; + Member<Node> target_; + Member<StaticNodeList> added_nodes_; + Member<StaticNodeList> removed_nodes_; Member<Node> previous_sibling_; Member<Node> next_sibling_; }; @@ -106,10 +106,10 @@ return node_list.Get(); } - TraceWrapperMember<Node> target_; + Member<Node> target_; String old_value_; - TraceWrapperMember<StaticNodeList> added_nodes_; - TraceWrapperMember<StaticNodeList> removed_nodes_; + Member<StaticNodeList> added_nodes_; + Member<StaticNodeList> removed_nodes_; }; class AttributesRecord : public RecordWithEmptyNodeLists { @@ -166,7 +166,7 @@ String oldValue() override { return String(); } - TraceWrapperMember<MutationRecord> record_; + Member<MutationRecord> record_; }; const AtomicString& ChildListRecord::type() {
diff --git a/third_party/blink/renderer/core/dom/node.cc b/third_party/blink/renderer/core/dom/node.cc index 05d8449..5d45605 100644 --- a/third_party/blink/renderer/core/dom/node.cc +++ b/third_party/blink/renderer/core/dom/node.cc
@@ -2364,8 +2364,8 @@ GetDocument().GetFrame()->GetEventHandlerRegistry().DidMoveIntoPage(*this); } - if (const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* - registry = MutationObserverRegistry()) { + if (const HeapVector<Member<MutationObserverRegistration>>* registry = + MutationObserverRegistry()) { for (const auto& registration : *registry) { GetDocument().AddMutationObserverTypes(registration->MutationTypes()); } @@ -2420,7 +2420,7 @@ } using EventTargetDataMap = - HeapHashMap<WeakMember<Node>, TraceWrapperMember<EventTargetData>>; + HeapHashMap<WeakMember<Node>, Member<EventTargetData>>; static EventTargetDataMap& GetEventTargetDataMap() { DEFINE_STATIC_LOCAL(Persistent<EventTargetDataMap>, map, (MakeGarbageCollected<EventTargetDataMap>())); @@ -2441,7 +2441,7 @@ return *data; } -const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* +const HeapVector<Member<MutationObserverRegistration>>* Node::MutationObserverRegistry() { if (!HasRareData()) return nullptr; @@ -2451,7 +2451,7 @@ return &data->Registry(); } -const HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>* +const HeapHashSet<Member<MutationObserverRegistration>>* Node::TransientMutationObserverRegistry() { if (!HasRareData()) return nullptr; @@ -2532,7 +2532,7 @@ void Node::UnregisterMutationObserver( MutationObserverRegistration* registration) { - const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* registry = + const HeapVector<Member<MutationObserverRegistration>>* registry = MutationObserverRegistry(); DCHECK(registry); if (!registry) @@ -2554,8 +2554,8 @@ void Node::UnregisterTransientMutationObserver( MutationObserverRegistration* registration) { - const HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>* - transient_registry = TransientMutationObserverRegistry(); + const HeapHashSet<Member<MutationObserverRegistration>>* transient_registry = + TransientMutationObserverRegistry(); DCHECK(transient_registry); if (!transient_registry) return; @@ -2570,13 +2570,13 @@ ScriptForbiddenScope forbid_script_during_raw_iteration; for (Node* node = parentNode(); node; node = node->parentNode()) { - if (const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* - registry = node->MutationObserverRegistry()) { + if (const HeapVector<Member<MutationObserverRegistration>>* registry = + node->MutationObserverRegistry()) { for (const auto& registration : *registry) registration->ObservedSubtreeNodeWillDetach(*this); } - if (const HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>* + if (const HeapHashSet<Member<MutationObserverRegistration>>* transient_registry = node->TransientMutationObserverRegistry()) { for (auto& registration : *transient_registry) registration->ObservedSubtreeNodeWillDetach(*this); @@ -3082,8 +3082,8 @@ // rareData() and data_.node_layout_data_ share their storage. We have to // trace only one of them. if (HasRareData()) - visitor->TraceWithWrappers(RareData()); - visitor->TraceWithWrappers(GetEventTargetData()); + visitor->Trace(RareData()); + visitor->Trace(GetEventTargetData()); visitor->Trace(tree_scope_); EventTarget::Trace(visitor); }
diff --git a/third_party/blink/renderer/core/dom/node.h b/third_party/blink/renderer/core/dom/node.h index fbf3b372..d84c646a 100644 --- a/third_party/blink/renderer/core/dom/node.h +++ b/third_party/blink/renderer/core/dom/node.h
@@ -36,7 +36,6 @@ #include "third_party/blink/renderer/core/dom/tree_scope.h" #include "third_party/blink/renderer/core/scroll/scroll_customization.h" #include "third_party/blink/renderer/core/style/computed_style_constants.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/geometry/layout_rect.h" // This needs to be here because element.cc also depends on it. @@ -1048,16 +1047,16 @@ NodeRareData& CreateRareData(); - const HeapVector<TraceWrapperMember<MutationObserverRegistration>>* + const HeapVector<Member<MutationObserverRegistration>>* MutationObserverRegistry(); - const HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>* + const HeapHashSet<Member<MutationObserverRegistration>>* TransientMutationObserverRegistry(); uint32_t node_flags_; - TraceWrapperMember<Node> parent_or_shadow_host_node_; + Member<Node> parent_or_shadow_host_node_; Member<TreeScope> tree_scope_; - TraceWrapperMember<Node> previous_; - TraceWrapperMember<Node> next_; + Member<Node> previous_; + Member<Node> next_; // When a node has rare data we move the layoutObject into the rare data. union DataUnion { DataUnion() : node_layout_data_(&NodeRenderingData::SharedEmptyData()) {}
diff --git a/third_party/blink/renderer/core/dom/node_iterator_base.h b/third_party/blink/renderer/core/dom/node_iterator_base.h index f90d919..f2791240 100644 --- a/third_party/blink/renderer/core/dom/node_iterator_base.h +++ b/third_party/blink/renderer/core/dom/node_iterator_base.h
@@ -25,7 +25,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_ITERATOR_BASE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_ITERATOR_BASE_H_ -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -51,7 +50,7 @@ private: Member<Node> root_; unsigned what_to_show_; - TraceWrapperMember<V8NodeFilter> filter_; + Member<V8NodeFilter> filter_; bool active_flag_ = false; };
diff --git a/third_party/blink/renderer/core/dom/node_lists_node_data.h b/third_party/blink/renderer/core/dom/node_lists_node_data.h index e30dd00..18c6c3c2 100644 --- a/third_party/blink/renderer/core/dom/node_lists_node_data.h +++ b/third_party/blink/renderer/core/dom/node_lists_node_data.h
@@ -77,10 +77,10 @@ }; typedef HeapHashMap<NamedNodeListKey, - TraceWrapperMember<LiveNodeListBase>, + Member<LiveNodeListBase>, NodeListAtomicCacheMapEntryHash> NodeListAtomicNameCacheMap; - typedef HeapHashMap<QualifiedName, TraceWrapperMember<TagCollectionNS>> + typedef HeapHashMap<QualifiedName, Member<TagCollectionNS>> TagCollectionNSCache; template <typename T> @@ -174,7 +174,7 @@ private: // Can be a ChildNodeList or an EmptyNodeList. - TraceWrapperMember<NodeList> child_node_list_; + Member<NodeList> child_node_list_; NodeListAtomicNameCacheMap atomic_name_caches_; TagCollectionNSCache tag_collection_ns_caches_; DISALLOW_COPY_AND_ASSIGN(NodeListsNodeData);
diff --git a/third_party/blink/renderer/core/dom/node_rare_data.h b/third_party/blink/renderer/core/dom/node_rare_data.h index 8c9be81..7abf29b 100644 --- a/third_party/blink/renderer/core/dom/node_rare_data.h +++ b/third_party/blink/renderer/core/dom/node_rare_data.h
@@ -23,7 +23,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_RARE_DATA_H_ #include "base/macros.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" @@ -44,13 +43,11 @@ NodeMutationObserverData() = default; - const HeapVector<TraceWrapperMember<MutationObserverRegistration>>& - Registry() { + const HeapVector<Member<MutationObserverRegistration>>& Registry() { return registry_; } - const HeapHashSet<TraceWrapperMember<MutationObserverRegistration>>& - TransientRegistry() { + const HeapHashSet<Member<MutationObserverRegistration>>& TransientRegistry() { return transient_registry_; } @@ -62,9 +59,8 @@ void Trace(Visitor* visitor); private: - HeapVector<TraceWrapperMember<MutationObserverRegistration>> registry_; - HeapHashSet<TraceWrapperMember<MutationObserverRegistration>> - transient_registry_; + HeapVector<Member<MutationObserverRegistration>> registry_; + HeapHashSet<Member<MutationObserverRegistration>> transient_registry_; DISALLOW_COPY_AND_ASSIGN(NodeMutationObserverData); }; @@ -196,8 +192,8 @@ private: NodeListsNodeData& CreateNodeLists(); - TraceWrapperMember<NodeListsNodeData> node_lists_; - TraceWrapperMember<NodeMutationObserverData> mutation_observer_data_; + Member<NodeListsNodeData> node_lists_; + Member<NodeMutationObserverData> mutation_observer_data_; Member<FlatTreeNodeData> flat_tree_node_data_; unsigned connected_frame_count_ : kConnectedFrameCountBits;
diff --git a/third_party/blink/renderer/core/dom/range_test.cc b/third_party/blink/renderer/core/dom/range_test.cc index 3564642..fb43a038 100644 --- a/third_party/blink/renderer/core/dom/range_test.cc +++ b/third_party/blink/renderer/core/dom/range_test.cc
@@ -29,7 +29,6 @@ #include "third_party/blink/renderer/platform/geometry/float_quad.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink {
diff --git a/third_party/blink/renderer/core/dom/scripted_animation_controller.h b/third_party/blink/renderer/core/dom/scripted_animation_controller.h index abf8a27e..0800779c 100644 --- a/third_party/blink/renderer/core/dom/scripted_animation_controller.h +++ b/third_party/blink/renderer/core/dom/scripted_animation_controller.h
@@ -29,7 +29,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/frame_request_callback_collection.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/string_impl.h"
diff --git a/third_party/blink/renderer/core/dom/scripted_idle_task_controller.h b/third_party/blink/renderer/core/dom/scripted_idle_task_controller.h index 45d89f6..b5803ff 100644 --- a/third_party/blink/renderer/core/dom/scripted_idle_task_controller.h +++ b/third_party/blink/renderer/core/dom/scripted_idle_task_controller.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/dom/idle_deadline.h" #include "third_party/blink/renderer/core/execution_context/context_lifecycle_state_observer.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -73,7 +72,7 @@ void Trace(Visitor*) override; private: - TraceWrapperMember<V8IdleRequestCallback> callback_; + Member<V8IdleRequestCallback> callback_; }; int RegisterCallback(IdleTask*, const IdleRequestOptions*); @@ -102,7 +101,7 @@ uint32_t timeout_millis() const { return timeout_millis_; } private: - TraceWrapperMember<IdleTask> task_; + Member<IdleTask> task_; TimeTicks queue_timestamp_; uint32_t timeout_millis_; };
diff --git a/third_party/blink/renderer/core/dom/scripted_task_queue.cc b/third_party/blink/renderer/core/dom/scripted_task_queue.cc index 54a3473..f4cfc3c 100644 --- a/third_party/blink/renderer/core/dom/scripted_task_queue.cc +++ b/third_party/blink/renderer/core/dom/scripted_task_queue.cc
@@ -40,7 +40,7 @@ void Reject() { resolver_->Reject(); } private: - TraceWrapperMember<V8TaskQueuePostCallback> callback_; + Member<V8TaskQueuePostCallback> callback_; Member<ScriptPromiseResolver> resolver_; TaskHandle task_handle_;
diff --git a/third_party/blink/renderer/core/dom/scripted_task_queue.h b/third_party/blink/renderer/core/dom/scripted_task_queue.h index bea56ace..98bebb59 100644 --- a/third_party/blink/renderer/core/dom/scripted_task_queue.h +++ b/third_party/blink/renderer/core/dom/scripted_task_queue.h
@@ -47,7 +47,7 @@ void AbortTask(CallbackId id); class WrappedCallback; - HeapHashMap<CallbackId, TraceWrapperMember<WrappedCallback>> pending_tasks_; + HeapHashMap<CallbackId, Member<WrappedCallback>> pending_tasks_; CallbackId next_callback_id_ = 1; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; };
diff --git a/third_party/blink/renderer/core/dom/scripted_task_queue_controller.h b/third_party/blink/renderer/core/dom/scripted_task_queue_controller.h index efc5a112..07446c9 100644 --- a/third_party/blink/renderer/core/dom/scripted_task_queue_controller.h +++ b/third_party/blink/renderer/core/dom/scripted_task_queue_controller.h
@@ -39,7 +39,7 @@ void Trace(Visitor*) override; private: - HeapHashMap<String, TraceWrapperMember<ScriptedTaskQueue>> task_queues_; + HeapHashMap<String, Member<ScriptedTaskQueue>> task_queues_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/dom/shadow_root.h b/third_party/blink/renderer/core/dom/shadow_root.h index c34d91b..18f7759 100644 --- a/third_party/blink/renderer/core/dom/shadow_root.h +++ b/third_party/blink/renderer/core/dom/shadow_root.h
@@ -34,7 +34,6 @@ #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/tree_scope.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/casting.h" namespace blink { @@ -182,7 +181,7 @@ } void Distribute(); - TraceWrapperMember<StyleSheetList> style_sheet_list_; + Member<StyleSheetList> style_sheet_list_; Member<SlotAssignment> slot_assignment_; Member<ShadowRootV0> shadow_root_v0_; unsigned child_shadow_root_count_ : 16;
diff --git a/third_party/blink/renderer/core/dom/shadow_root_v0.h b/third_party/blink/renderer/core/dom/shadow_root_v0.h index c95f0d8..cc637bc 100644 --- a/third_party/blink/renderer/core/dom/shadow_root_v0.h +++ b/third_party/blink/renderer/core/dom/shadow_root_v0.h
@@ -89,7 +89,7 @@ private: ShadowRoot& GetShadowRoot() const { return *shadow_root_; } - TraceWrapperMember<ShadowRoot> shadow_root_; + Member<ShadowRoot> shadow_root_; unsigned descendant_shadow_element_count_ = 0; unsigned descendant_content_element_count_ = 0; HeapVector<Member<V0InsertionPoint>> descendant_insertion_points_;
diff --git a/third_party/blink/renderer/core/dom/static_node_list.h b/third_party/blink/renderer/core/dom/static_node_list.h index f09143b..93e41e8 100644 --- a/third_party/blink/renderer/core/dom/static_node_list.h +++ b/third_party/blink/renderer/core/dom/static_node_list.h
@@ -32,7 +32,6 @@ #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/node_child_removal_tracker.h" #include "third_party/blink/renderer/core/dom/node_list.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { @@ -52,7 +51,7 @@ void Trace(Visitor*) override; private: - HeapVector<TraceWrapperMember<NodeType>> nodes_; + HeapVector<Member<NodeType>> nodes_; }; using StaticNodeList = StaticNodeTypeList<Node>;
diff --git a/third_party/blink/renderer/core/dom/static_range_test.cc b/third_party/blink/renderer/core/dom/static_range_test.cc index c12c6b5..4d5b675 100644 --- a/third_party/blink/renderer/core/dom/static_range_test.cc +++ b/third_party/blink/renderer/core/dom/static_range_test.cc
@@ -17,7 +17,6 @@ #include "third_party/blink/renderer/core/html/html_html_element.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace blink {
diff --git a/third_party/blink/renderer/core/dom/tree_scope_adopter.cc b/third_party/blink/renderer/core/dom/tree_scope_adopter.cc index be34678..bd94af51 100644 --- a/third_party/blink/renderer/core/dom/tree_scope_adopter.cc +++ b/third_party/blink/renderer/core/dom/tree_scope_adopter.cc
@@ -34,7 +34,6 @@ #include "third_party/blink/renderer/core/dom/node_traversal.h" #include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/html/custom/custom_element.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -74,8 +73,7 @@ continue; Element& element = ToElement(node); - if (HeapVector<TraceWrapperMember<Attr>>* attrs = - element.GetAttrNodeList()) { + if (HeapVector<Member<Attr>>* attrs = element.GetAttrNodeList()) { for (const auto& attr : *attrs) MoveTreeToNewScope(*attr); } @@ -115,8 +113,7 @@ continue; Element& element = ToElement(node); - if (HeapVector<TraceWrapperMember<Attr>>* attrs = - element.GetAttrNodeList()) { + if (HeapVector<Member<Attr>>* attrs = element.GetAttrNodeList()) { for (const auto& attr : *attrs) MoveTreeToNewDocument(*attr, old_document, new_document); }
diff --git a/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc b/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc index 75330a8..2add728 100644 --- a/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc +++ b/third_party/blink/renderer/core/editing/iterators/text_iterator_test.cc
@@ -37,6 +37,7 @@ #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/html/forms/text_control_element.h" #include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { namespace text_iterator_test { @@ -141,13 +142,13 @@ template <typename Tree> std::string TextIteratorTest::IterateWithIterator( typename Tree::TextIteratorType& iterator) { - String text_chunks; + StringBuilder text_chunks; for (; !iterator.AtEnd(); iterator.Advance()) { - text_chunks.append('['); - text_chunks.append(iterator.GetText().GetTextForTesting()); - text_chunks.append(']'); + text_chunks.Append('['); + text_chunks.Append(iterator.GetText().GetTextForTesting()); + text_chunks.Append(']'); } - return std::string(text_chunks.Utf8().data()); + return std::string(text_chunks.ToString().Utf8().data()); } Range* TextIteratorTest::GetBodyRange() const {
diff --git a/third_party/blink/renderer/core/events/message_event.h b/third_party/blink/renderer/core/events/message_event.h index 6f177c8..c38e56d 100644 --- a/third_party/blink/renderer/core/events/message_event.h +++ b/third_party/blink/renderer/core/events/message_event.h
@@ -42,7 +42,6 @@ #include "third_party/blink/renderer/core/messaging/message_port.h" #include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/core/events/web_input_event_conversion.h b/third_party/blink/renderer/core/events/web_input_event_conversion.h index bd1ec72..18d1681 100644 --- a/third_party/blink/renderer/core/events/web_input_event_conversion.h +++ b/third_party/blink/renderer/core/events/web_input_event_conversion.h
@@ -40,7 +40,6 @@ #include "third_party/blink/public/platform/web_touch_event.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/core/exported/web_form_element_observer_impl.h b/third_party/blink/renderer/core/exported/web_form_element_observer_impl.h index 186397f2..10bee7a 100644 --- a/third_party/blink/renderer/core/exported/web_form_element_observer_impl.h +++ b/third_party/blink/renderer/core/exported/web_form_element_observer_impl.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "third_party/blink/renderer/platform/heap/member.h" #include "third_party/blink/renderer/platform/heap/self_keep_alive.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc b/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc index 2dd6a1c9..143562e2 100644 --- a/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc +++ b/third_party/blink/renderer/core/exported/web_plugin_container_impl.cc
@@ -178,7 +178,6 @@ gfx::Vector2dF(frame_rect_.X(), frame_rect_.Y())); layer_->SetBounds(gfx::Size(frame_rect_.Size())); layer_->SetIsDrawable(true); - layer_->SetHitTestable(true); // When compositing is after paint, composited plugins should have their // layers inserted rather than invoking WebPlugin::paint. RecordForeignLayer(context, DisplayItem::kForeignLayerPlugin, layer_);
diff --git a/third_party/blink/renderer/core/exported/web_plugin_container_impl.h b/third_party/blink/renderer/core/exported/web_plugin_container_impl.h index d9e7d98c..df3a710 100644 --- a/third_party/blink/renderer/core/exported/web_plugin_container_impl.h +++ b/third_party/blink/renderer/core/exported/web_plugin_container_impl.h
@@ -41,7 +41,6 @@ #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/core/frame/embedded_content_view.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace cc {
diff --git a/third_party/blink/renderer/core/exported/web_remote_frame_impl.h b/third_party/blink/renderer/core/exported/web_remote_frame_impl.h index 5261407..9a469a3e0 100644 --- a/third_party/blink/renderer/core/exported/web_remote_frame_impl.h +++ b/third_party/blink/renderer/core/exported/web_remote_frame_impl.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/frame/remote_frame.h" #include "third_party/blink/renderer/platform/heap/self_keep_alive.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace cc { class Layer;
diff --git a/third_party/blink/renderer/core/exported/web_settings_impl.h b/third_party/blink/renderer/core/exported/web_settings_impl.h index b2db629..238ce3c 100644 --- a/third_party/blink/renderer/core/exported/web_settings_impl.h +++ b/third_party/blink/renderer/core/exported/web_settings_impl.h
@@ -34,7 +34,6 @@ #include "third_party/blink/public/web/web_settings.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index c69decea..3e85939 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -1518,15 +1518,51 @@ } void WebViewImpl::BeginRafAlignedInput() { - raf_aligned_input_start_time_ = CurrentTimeTicks(); + if (MainFrameImpl()) { + raf_aligned_input_start_time_.emplace(CurrentTimeTicks()); + } } void WebViewImpl::EndRafAlignedInput() { if (MainFrameImpl()) { + DCHECK(raf_aligned_input_start_time_); MainFrameImpl()->GetFrame()->View()->EnsureUkmAggregator().RecordSample( LocalFrameUkmAggregator::kHandleInputEvents, - raf_aligned_input_start_time_, CurrentTimeTicks()); + raf_aligned_input_start_time_.value(), CurrentTimeTicks()); } + raf_aligned_input_start_time_.reset(); +} + +void WebViewImpl::BeginUpdateLayers() { + if (MainFrameImpl()) { + update_layers_start_time_.emplace(CurrentTimeTicks()); + } +} + +void WebViewImpl::EndUpdateLayers() { + if (MainFrameImpl()) { + DCHECK(update_layers_start_time_); + MainFrameImpl()->GetFrame()->View()->EnsureUkmAggregator().RecordSample( + LocalFrameUkmAggregator::kUpdateLayers, + update_layers_start_time_.value(), CurrentTimeTicks()); + } + update_layers_start_time_.reset(); +} + +void WebViewImpl::BeginCommitCompositorFrame() { + if (MainFrameImpl()) { + commit_compositor_frame_start_time_.emplace(CurrentTimeTicks()); + } +} + +void WebViewImpl::EndCommitCompositorFrame() { + // Some tests call this without ever beginning a frame. + if (MainFrameImpl() && commit_compositor_frame_start_time_) { + MainFrameImpl()->GetFrame()->View()->EnsureUkmAggregator().RecordSample( + LocalFrameUkmAggregator::kProxyCommit, + commit_compositor_frame_start_time_.value(), CurrentTimeTicks()); + } + commit_compositor_frame_start_time_.reset(); } void WebViewImpl::RecordStartOfFrameMetrics() { @@ -2150,7 +2186,9 @@ } } -void WebViewImpl::SmoothScroll(int target_x, int target_y, long duration_ms) { +void WebViewImpl::SmoothScroll(int target_x, + int target_y, + uint64_t duration_ms) { IntPoint target_position(target_x, target_y); StartPageScaleAnimation(target_position, false, PageScaleFactor(), (double)duration_ms / 1000);
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index 68d633f..0243b305d6 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -64,7 +64,6 @@ #include "third_party/blink/renderer/platform/graphics/graphics_layer.h" #include "third_party/blink/renderer/platform/graphics/touch_action.h" #include "third_party/blink/renderer/platform/heap/member.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -133,7 +132,7 @@ void FocusDocumentView(WebFrame*) override; void SetInitialFocus(bool reverse) override; void ClearFocusedElement() override; - void SmoothScroll(int target_x, int target_y, long duration_ms) override; + void SmoothScroll(int target_x, int target_y, uint64_t duration_ms) override; void AdvanceFocus(bool reverse) override; void AdvanceFocusAcrossFrames(WebFocusType, WebRemoteFrame* from, @@ -439,6 +438,10 @@ void DidBeginFrame() override; void BeginRafAlignedInput() override; void EndRafAlignedInput() override; + void BeginUpdateLayers() override; + void EndUpdateLayers() override; + void BeginCommitCompositorFrame() override; + void EndCommitCompositorFrame() override; void RecordStartOfFrameMetrics() override; void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) override; void UpdateLifecycle(LifecycleUpdate requested_update, @@ -702,7 +705,10 @@ Persistent<ResizeViewportAnchor> resize_viewport_anchor_; - base::TimeTicks raf_aligned_input_start_time_; + // Set when a measurement begins, reset when the measurement is taken. + base::Optional<base::TimeTicks> raf_aligned_input_start_time_; + base::Optional<base::TimeTicks> update_layers_start_time_; + base::Optional<base::TimeTicks> commit_compositor_frame_start_time_; }; // We have no ways to check if the specified WebView is an instance of
diff --git a/third_party/blink/renderer/core/feature_policy/feature_policy.cc b/third_party/blink/renderer/core/feature_policy/feature_policy.cc index 225f7dc..bbfcf65 100644 --- a/third_party/blink/renderer/core/feature_policy/feature_policy.cc +++ b/third_party/blink/renderer/core/feature_policy/feature_policy.cc
@@ -35,7 +35,9 @@ // Lossy images default to at most 0.5 bytes per pixel. return PolicyValue(0.5); } - if (feature == mojom::FeaturePolicyFeature::kUnoptimizedLosslessImages) { + if (feature == mojom::FeaturePolicyFeature::kUnoptimizedLosslessImages || + feature == + mojom::FeaturePolicyFeature::kUnoptimizedLosslessImagesStrict) { // Lossless images default to at most 1 byte per pixel. return PolicyValue(1.0); }
diff --git a/third_party/blink/renderer/core/feature_policy/feature_policy_features.json5 b/third_party/blink/renderer/core/feature_policy/feature_policy_features.json5 index 12ea924..8df7b83 100644 --- a/third_party/blink/renderer/core/feature_policy/feature_policy_features.json5 +++ b/third_party/blink/renderer/core/feature_policy/feature_policy_features.json5
@@ -190,7 +190,12 @@ { name: "UnoptimizedLosslessImages", feature_policy_name: "unoptimized-lossless-images", - depends_on: ["ExperimentalProductivityFeatures"], + depends_on: ["UnoptimizedImagePolicies"], + }, + { + name: "UnoptimizedLosslessImagesStrict", + feature_policy_name: "unoptimized-lossless-images-strict", + depends_on: ["UnoptimizedImagePolicies"], }, { name: "UnoptimizedLossyImages",
diff --git a/third_party/blink/renderer/core/fetch/blob_bytes_consumer.h b/third_party/blink/renderer/core/fetch/blob_bytes_consumer.h index 3ea115ff..98b967f 100644 --- a/third_party/blink/renderer/core/fetch/blob_bytes_consumer.h +++ b/third_party/blink/renderer/core/fetch/blob_bytes_consumer.h
@@ -8,7 +8,6 @@ #include <memory> #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" @@ -43,7 +42,7 @@ private: Member<ExecutionContext> execution_context_; scoped_refptr<BlobDataHandle> blob_data_handle_; - TraceWrapperMember<BytesConsumer> nested_consumer_; + Member<BytesConsumer> nested_consumer_; Member<BytesConsumer::Client> client_; };
diff --git a/third_party/blink/renderer/core/fetch/body_stream_buffer.h b/third_party/blink/renderer/core/fetch/body_stream_buffer.h index 3cc3bb86..a4789ada 100644 --- a/third_party/blink/renderer/core/fetch/body_stream_buffer.h +++ b/third_party/blink/renderer/core/fetch/body_stream_buffer.h
@@ -97,10 +97,10 @@ ExceptionState& exception_state); Member<ScriptState> script_state_; - TraceWrapperMember<ReadableStream> stream_; - TraceWrapperMember<BytesConsumer> consumer_; + Member<ReadableStream> stream_; + Member<BytesConsumer> consumer_; // We need this member to keep it alive while loading. - TraceWrapperMember<FetchDataLoader> loader_; + Member<FetchDataLoader> loader_; // We need this to ensure that we detect that abort has been signalled // correctly. Member<AbortSignal> signal_;
diff --git a/third_party/blink/renderer/core/fetch/bytes_consumer_tee.cc b/third_party/blink/renderer/core/fetch/bytes_consumer_tee.cc index d64ee3f7..74a77e9 100644 --- a/third_party/blink/renderer/core/fetch/bytes_consumer_tee.cc +++ b/third_party/blink/renderer/core/fetch/bytes_consumer_tee.cc
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/fetch/blob_bytes_consumer.h" #include "third_party/blink/renderer/core/fetch/form_data_bytes_consumer.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/blob/blob_data.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" @@ -312,7 +311,7 @@ destination2_->Notify(); } - TraceWrapperMember<BytesConsumer> src_; + Member<BytesConsumer> src_; Member<Destination> destination1_; Member<Destination> destination2_; };
diff --git a/third_party/blink/renderer/core/fetch/fetch_data_loader.cc b/third_party/blink/renderer/core/fetch/fetch_data_loader.cc index 474348b..da787fe 100644 --- a/third_party/blink/renderer/core/fetch/fetch_data_loader.cc +++ b/third_party/blink/renderer/core/fetch/fetch_data_loader.cc
@@ -108,7 +108,7 @@ } private: - TraceWrapperMember<BytesConsumer> consumer_; + Member<BytesConsumer> consumer_; Member<FetchDataLoader::Client> client_; String mime_type_; @@ -253,7 +253,7 @@ return true; } - TraceWrapperMember<BytesConsumer> consumer_; + Member<BytesConsumer> consumer_; Member<FetchDataLoader::Client> client_; unsigned bytes_used_; @@ -310,7 +310,7 @@ } private: - TraceWrapperMember<BytesConsumer> consumer_; + Member<BytesConsumer> consumer_; Member<FetchDataLoader::Client> client_; }; @@ -480,7 +480,7 @@ std::unique_ptr<TextResourceDecoder> string_decoder_; }; - TraceWrapperMember<BytesConsumer> consumer_; + Member<BytesConsumer> consumer_; Member<FetchDataLoader::Client> client_; Member<FormData> form_data_; Member<MultipartParser> multipart_parser_; @@ -548,7 +548,7 @@ } private: - TraceWrapperMember<BytesConsumer> consumer_; + Member<BytesConsumer> consumer_; Member<FetchDataLoader::Client> client_; std::unique_ptr<TextResourceDecoder> decoder_; @@ -692,7 +692,7 @@ void Dispose() { data_pipe_watcher_.Cancel(); } - TraceWrapperMember<BytesConsumer> consumer_; + Member<BytesConsumer> consumer_; Member<FetchDataLoader::Client> client_; mojo::ScopedDataPipeProducerHandle out_data_pipe_;
diff --git a/third_party/blink/renderer/core/fetch/fetch_request_data.h b/third_party/blink/renderer/core/fetch/fetch_request_data.h index 6d147925..6d5b47f 100644 --- a/third_party/blink/renderer/core/fetch/fetch_request_data.h +++ b/third_party/blink/renderer/core/fetch/fetch_request_data.h
@@ -144,7 +144,7 @@ // FIXME: Support m_useURLCredentialsFlag; // FIXME: Support m_redirectCount; Tainting response_tainting_; - TraceWrapperMember<BodyStreamBuffer> buffer_; + Member<BodyStreamBuffer> buffer_; String mime_type_; String integrity_; ResourceLoadPriority priority_;
diff --git a/third_party/blink/renderer/core/fetch/fetch_response_data.h b/third_party/blink/renderer/core/fetch/fetch_response_data.h index 3c0354f..0f1cef4 100644 --- a/third_party/blink/renderer/core/fetch/fetch_response_data.h +++ b/third_party/blink/renderer/core/fetch/fetch_response_data.h
@@ -123,8 +123,8 @@ uint16_t status_; AtomicString status_message_; Member<FetchHeaderList> header_list_; - TraceWrapperMember<FetchResponseData> internal_response_; - TraceWrapperMember<BodyStreamBuffer> buffer_; + Member<FetchResponseData> internal_response_; + Member<BodyStreamBuffer> buffer_; String mime_type_; Time response_time_; String cache_storage_cache_name_;
diff --git a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc index 7ede271..e37cea211 100644 --- a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc +++ b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.cc
@@ -486,7 +486,7 @@ private: scoped_refptr<EncodedFormData> form_data_; - TraceWrapperMember<BytesConsumer> blob_bytes_consumer_; + Member<BytesConsumer> blob_bytes_consumer_; }; } // namespace
diff --git a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.h b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.h index 803ef357..ddbafeca0 100644 --- a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.h +++ b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer.h
@@ -7,7 +7,6 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -73,7 +72,7 @@ scoped_refptr<EncodedFormData>, BytesConsumer* consumer_for_testing); - const TraceWrapperMember<BytesConsumer> impl_; + const Member<BytesConsumer> impl_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/fetch/place_holder_bytes_consumer.h b/third_party/blink/renderer/core/fetch/place_holder_bytes_consumer.h index 0cd4c2fc..0d244ad 100644 --- a/third_party/blink/renderer/core/fetch/place_holder_bytes_consumer.h +++ b/third_party/blink/renderer/core/fetch/place_holder_bytes_consumer.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_FETCH_PLACE_HOLDER_BYTES_CONSUMER_H_ #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" namespace blink { @@ -35,7 +34,7 @@ void Trace(blink::Visitor* visitor) override; private: - TraceWrapperMember<BytesConsumer> underlying_; + Member<BytesConsumer> underlying_; Member<Client> client_; bool is_cancelled_ = false; };
diff --git a/third_party/blink/renderer/core/fetch/readable_stream_bytes_consumer.h b/third_party/blink/renderer/core/fetch/readable_stream_bytes_consumer.h index 21a54ccb..9c79c6272 100644 --- a/third_party/blink/renderer/core/fetch/readable_stream_bytes_consumer.h +++ b/third_party/blink/renderer/core/fetch/readable_stream_bytes_consumer.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/streams/readable_stream.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -52,7 +51,7 @@ void OnRejected(); void Notify(); - TraceWrapperMember<ReadableStream::ReadHandle> read_handle_; + Member<ReadableStream::ReadHandle> read_handle_; Member<ScriptState> script_state_; Member<BytesConsumer::Client> client_; Member<DOMUint8Array> pending_buffer_;
diff --git a/third_party/blink/renderer/core/fetch/request.h b/third_party/blink/renderer/core/fetch/request.h index acb74c1..cb51267 100644 --- a/third_party/blink/renderer/core/fetch/request.h +++ b/third_party/blink/renderer/core/fetch/request.h
@@ -104,7 +104,7 @@ String ContentType() const override; String MimeType() const override; - const TraceWrapperMember<FetchRequestData> request_; + const Member<FetchRequestData> request_; const Member<Headers> headers_; const Member<AbortSignal> signal_; DISALLOW_COPY_AND_ASSIGN(Request);
diff --git a/third_party/blink/renderer/core/fetch/response.h b/third_party/blink/renderer/core/fetch/response.h index afd8b25..00e2071 100644 --- a/third_party/blink/renderer/core/fetch/response.h +++ b/third_party/blink/renderer/core/fetch/response.h
@@ -112,7 +112,7 @@ bool IsBodyUsedForDCheck(ExceptionState&) override; private: - const TraceWrapperMember<FetchResponseData> response_; + const Member<FetchResponseData> response_; const Member<Headers> headers_; DISALLOW_COPY_AND_ASSIGN(Response); };
diff --git a/third_party/blink/renderer/core/frame/dom_timer.h b/third_party/blink/renderer/core/frame/dom_timer.h index d6d2adcb..58da7f4 100644 --- a/third_party/blink/renderer/core/frame/dom_timer.h +++ b/third_party/blink/renderer/core/frame/dom_timer.h
@@ -32,7 +32,6 @@ #include "third_party/blink/renderer/core/dom/user_gesture_indicator.h" #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/timer.h" @@ -85,7 +84,7 @@ int timeout_id_; int nesting_level_; - TraceWrapperMember<ScheduledAction> action_; + Member<ScheduledAction> action_; scoped_refptr<UserGestureToken> user_gesture_token_; };
diff --git a/third_party/blink/renderer/core/frame/dom_timer_coordinator.h b/third_party/blink/renderer/core/frame/dom_timer_coordinator.h index 645fee38..c5597af 100644 --- a/third_party/blink/renderer/core/frame/dom_timer_coordinator.h +++ b/third_party/blink/renderer/core/frame/dom_timer_coordinator.h
@@ -9,7 +9,6 @@ #include "base/macros.h" #include "base/single_thread_task_runner.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/time.h" @@ -60,7 +59,7 @@ private: int NextID(); - using TimeoutMap = HeapHashMap<int, TraceWrapperMember<DOMTimer>>; + using TimeoutMap = HeapHashMap<int, Member<DOMTimer>>; TimeoutMap timers_; int circular_sequential_id_;
diff --git a/third_party/blink/renderer/core/frame/dom_window.h b/third_party/blink/renderer/core/frame/dom_window.h index bbac21f..b13487c1 100644 --- a/third_party/blink/renderer/core/frame/dom_window.h +++ b/third_party/blink/renderer/core/frame/dom_window.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" #include "third_party/blink/renderer/core/frame/frame.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -153,7 +152,7 @@ // of this object. const Member<WindowProxyManager> window_proxy_manager_; Member<InputDeviceCapabilitiesConstants> input_capabilities_; - mutable TraceWrapperMember<Location> location_; + mutable Member<Location> location_; // Set to true when close() has been called. Needed for // |window.closed| determinism; having it return 'true'
diff --git a/third_party/blink/renderer/core/frame/frame_overlay.cc b/third_party/blink/renderer/core/frame/frame_overlay.cc index a4c344f7..68080a59 100644 --- a/third_party/blink/renderer/core/frame/frame_overlay.cc +++ b/third_party/blink/renderer/core/frame/frame_overlay.cc
@@ -71,7 +71,6 @@ if (!layer_) { layer_ = std::make_unique<GraphicsLayer>(*this); layer_->SetDrawsContent(true); - layer_->SetHitTestable(true); if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) { // This is required for contents of overlay to stay in sync with the page
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.h b/third_party/blink/renderer/core/frame/local_dom_window.h index 43cf474..ca0c7af8 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.h +++ b/third_party/blink/renderer/core/frame/local_dom_window.h
@@ -32,7 +32,6 @@ #include "third_party/blink/renderer/core/frame/dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/scroll/scrollable_area.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/supplementable.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" @@ -342,7 +341,7 @@ // Return the viewport size including scrollbars. IntSize GetViewportSize() const; - TraceWrapperMember<Document> document_; + Member<Document> document_; Member<DOMVisualViewport> visualViewport_; TaskRunnerTimer<LocalDOMWindow> unused_preloads_timer_; @@ -357,14 +356,14 @@ mutable Member<BarProp> scrollbars_; mutable Member<BarProp> statusbar_; mutable Member<BarProp> toolbar_; - mutable TraceWrapperMember<Navigator> navigator_; + mutable Member<Navigator> navigator_; mutable Member<StyleMedia> media_; - mutable TraceWrapperMember<CustomElementRegistry> custom_elements_; + mutable Member<CustomElementRegistry> custom_elements_; // We store reference to Modulator here to have it TraceWrapper-ed. // This is wrong, as Modulator is per-context, where as LocalDOMWindow is // shared among context. However, this *works* as Modulator is currently only // enabled in the main world, - TraceWrapperMember<Modulator> modulator_; + Member<Modulator> modulator_; Member<External> external_; String status_;
diff --git a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc index 12608d6..1150714 100644 --- a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc +++ b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.cc
@@ -76,7 +76,7 @@ absolute_metric_records_.ReserveInitialCapacity(kCount); main_frame_percentage_records_.ReserveInitialCapacity(kCount); for (unsigned i = 0; i < (unsigned)kCount; ++i) { - const auto& metric_name = metric_strings()[i]; + const MetricInitializationData& metric_data = metrics_data()[i]; // Absolute records report the absolute time for each metric, both // average and worst case. They have an associated UMA too that we @@ -84,15 +84,21 @@ auto& absolute_record = absolute_metric_records_.emplace_back(); absolute_record.reset(); String uma_name = uma_preamble; - uma_name.append(metric_name); + uma_name.append(metric_data.name); uma_name.append(uma_postscript); - absolute_record.uma_counter.reset( - new CustomCountHistogram(uma_name.Utf8().data(), 0, 10000000, 50)); + if (metric_data.has_uma) { + absolute_record.uma_counter.reset( + new CustomCountHistogram(uma_name.Utf8().data(), 0, 10000000, 50)); + } + + // Percentage records report the ratio of each metric to the primary metric, + // average and worst case. UMA counters are also associated with the + // ratios and we allocate and own them here. auto& percentage_record = main_frame_percentage_records_.emplace_back(); percentage_record.reset(); for (auto bucket_substring : threshold_substrings) { String uma_percentage_name = uma_percentage_preamble; - uma_percentage_name.append(metric_name); + uma_percentage_name.append(metric_data.name); uma_percentage_name.append(uma_percentage_postscript); uma_percentage_name.append(bucket_substring); percentage_record.uma_counters_per_bucket.push_back( @@ -121,7 +127,9 @@ DCHECK_LT(metric_index, absolute_metric_records_.size()); auto& record = absolute_metric_records_[metric_index]; record.interval_duration += duration; - record.uma_counter->CountMicroseconds(duration); + // Record the UMA + if (record.uma_counter) + record.uma_counter->CountMicroseconds(duration); // Only record ratios when inside a main frame. if (in_main_frame_update_) { @@ -253,6 +261,16 @@ builder.SetAnimate(absolute_record.interval_duration.InMicroseconds()) .SetAnimatePercentage(percentage); break; + case kUpdateLayers: + builder + .SetUpdateLayers(absolute_record.interval_duration.InMicroseconds()) + .SetUpdateLayersPercentage(percentage); + break; + case kProxyCommit: + builder + .SetProxyCommit(absolute_record.interval_duration.InMicroseconds()) + .SetProxyCommitPercentage(percentage); + break; case kCount: case kMainFrame: NOTREACHED();
diff --git a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h index e9bc0d8..a8370e6 100644 --- a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h +++ b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator.h
@@ -130,10 +130,17 @@ kScrollingCoordinator, kHandleInputEvents, kAnimate, + kUpdateLayers, + kProxyCommit, kCount, kMainFrame }; + typedef struct MetricInitializationData { + String name; + bool has_uma; + } MetricInitializationData; + private: friend class LocalFrameUkmAggregatorTest; @@ -144,20 +151,22 @@ } // Add an entry in this arrray every time a new metric is added. - static const Vector<String>& metric_strings() { + static const Vector<MetricInitializationData>& metrics_data() { // Leaky construction to avoid exit-time destruction. - static const Vector<String>* strings = - new Vector<String>{"Compositing", - "CompositingCommit", - "IntersectionObservation", - "Paint", - "PrePaint", - "StyleAndLayout", - "ForcedStyleAndLayout", - "ScrollingCoordinator", - "HandleInputEvents", - "Animate"}; - return *strings; + static const Vector<MetricInitializationData>* data = + new Vector<MetricInitializationData>{{"Compositing", true}, + {"CompositingCommit", true}, + {"IntersectionObservation", true}, + {"Paint", true}, + {"PrePaint", true}, + {"StyleAndLayout", true}, + {"ForcedStyleAndLayout", true}, + {"ScrollingCoordinator", true}, + {"HandleInputEvents", true}, + {"Animate", true}, + {"UpdateLayers", false}, + {"ProxyCommit", true}}; + return *data; } // Modify this array if the UMA ratio metrics should be bucketed in a
diff --git a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator_test.cc b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator_test.cc index a8dd3362..5280e25 100644 --- a/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator_test.cc +++ b/third_party/blink/renderer/core/frame/local_frame_ukm_aggregator_test.cc
@@ -44,12 +44,13 @@ std::string GetMetricName(int index) { return std::string( - LocalFrameUkmAggregator::metric_strings()[index].Utf8().data()); + LocalFrameUkmAggregator::metrics_data()[index].name.Utf8().data()); } std::string GetPercentageMetricName(int index) { - return std::string( - LocalFrameUkmAggregator::metric_strings()[index].Utf8().data()) + + return std::string(LocalFrameUkmAggregator::metrics_data()[index] + .name.Utf8() + .data()) + "Percentage"; }
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index d9cff98..ef9869a 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -2589,8 +2589,10 @@ // that don't for the purposes of hit testing. For example, an empty div // will not draw content but needs to create a layer to ensure scroll events // do not pass through it. - if (layer->PaintsContentOrHitTest() || layer->GetHitTestable()) + if (layer->PaintsContentOrHitTest() || + layer->GetHitTestableWithoutDrawsContent()) { RecordGraphicsLayerAsForeignLayer(context, layer); + } if (auto* contents_layer = layer->ContentsLayer()) { RecordForeignLayer(context, DisplayItem::kForeignLayerContentsWrapper,
diff --git a/third_party/blink/renderer/core/frame/reporting_observer.h b/third_party/blink/renderer/core/frame/reporting_observer.h index d0b3722..19182c3 100644 --- a/third_party/blink/renderer/core/frame/reporting_observer.h +++ b/third_party/blink/renderer/core/frame/reporting_observer.h
@@ -61,7 +61,7 @@ private: Member<ExecutionContext> execution_context_; - TraceWrapperMember<V8ReportingObserverCallback> callback_; + Member<V8ReportingObserverCallback> callback_; Member<ReportingObserverOptions> options_; HeapVector<Member<Report>> report_queue_; bool registered_;
diff --git a/third_party/blink/renderer/core/frame/visual_viewport.cc b/third_party/blink/renderer/core/frame/visual_viewport.cc index 38ba9c8c..3c5fc32b 100644 --- a/third_party/blink/renderer/core/frame/visual_viewport.cc +++ b/third_party/blink/renderer/core/frame/visual_viewport.cc
@@ -704,7 +704,6 @@ scrollbar_layer_group->layer.get(), /*prevent_contents_opaque_changes=*/false); scrollbar_graphics_layer->SetDrawsContent(false); - scrollbar_graphics_layer->SetHitTestable(false); scrollbar_layer_group->scrollbar_layer->SetScrollElementId( inner_viewport_scroll_layer_->CcLayer()->element_id()); }
diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc index d723824..a33d2fb 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.cc
@@ -308,15 +308,52 @@ } void WebFrameWidgetImpl::BeginRafAlignedInput() { - raf_aligned_input_start_time_ = CurrentTimeTicks(); + if (LocalRootImpl()) { + raf_aligned_input_start_time_.emplace(CurrentTimeTicks()); + } } void WebFrameWidgetImpl::EndRafAlignedInput() { if (LocalRootImpl()) { + DCHECK(raf_aligned_input_start_time_); LocalRootImpl()->GetFrame()->View()->EnsureUkmAggregator().RecordSample( LocalFrameUkmAggregator::kHandleInputEvents, - raf_aligned_input_start_time_, CurrentTimeTicks()); + raf_aligned_input_start_time_.value(), CurrentTimeTicks()); } + raf_aligned_input_start_time_.reset(); +} + +void WebFrameWidgetImpl::BeginUpdateLayers() { + if (LocalRootImpl()) { + update_layers_start_time_.emplace(CurrentTimeTicks()); + } +} + +void WebFrameWidgetImpl::EndUpdateLayers() { + if (LocalRootImpl()) { + DCHECK(update_layers_start_time_); + LocalRootImpl()->GetFrame()->View()->EnsureUkmAggregator().RecordSample( + LocalFrameUkmAggregator::kUpdateLayers, + update_layers_start_time_.value(), CurrentTimeTicks()); + } + update_layers_start_time_.reset(); +} + +void WebFrameWidgetImpl::BeginCommitCompositorFrame() { + if (LocalRootImpl()) { + commit_compositor_frame_start_time_.emplace(CurrentTimeTicks()); + } +} + +void WebFrameWidgetImpl::EndCommitCompositorFrame() { + if (LocalRootImpl()) { + // Some tests call this without ever beginning a frame, so don't check for + // timing data. + LocalRootImpl()->GetFrame()->View()->EnsureUkmAggregator().RecordSample( + LocalFrameUkmAggregator::kProxyCommit, + commit_compositor_frame_start_time_.value(), CurrentTimeTicks()); + } + commit_compositor_frame_start_time_.reset(); } void WebFrameWidgetImpl::RecordStartOfFrameMetrics() {
diff --git a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h index ec26844..20b51c9f 100644 --- a/third_party/blink/renderer/core/frame/web_frame_widget_impl.h +++ b/third_party/blink/renderer/core/frame/web_frame_widget_impl.h
@@ -85,6 +85,10 @@ void DidBeginFrame() override; void BeginRafAlignedInput() override; void EndRafAlignedInput() override; + void BeginUpdateLayers() override; + void EndUpdateLayers() override; + void BeginCommitCompositorFrame() override; + void EndCommitCompositorFrame() override; void RecordStartOfFrameMetrics() override; void RecordEndOfFrameMetrics(base::TimeTicks) override; void UpdateLifecycle(LifecycleUpdate requested_update, @@ -188,7 +192,12 @@ cc::AnimationHost* animation_host_ = nullptr; scoped_refptr<cc::Layer> root_layer_; GraphicsLayer* root_graphics_layer_ = nullptr; - base::TimeTicks raf_aligned_input_start_time_; + + // Metrics gathering timing information + base::Optional<base::TimeTicks> raf_aligned_input_start_time_; + base::Optional<base::TimeTicks> update_layers_start_time_; + base::Optional<base::TimeTicks> commit_compositor_frame_start_time_; + bool is_accelerated_compositing_active_ = false; bool suppress_next_keypress_event_ = false;
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.h b/third_party/blink/renderer/core/frame/web_local_frame_impl.h index 68441d4..95d6c5a 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.h +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.h
@@ -53,7 +53,6 @@ #include "third_party/blink/renderer/platform/geometry/float_rect.h" #include "third_party/blink/renderer/platform/heap/self_keep_alive.h" #include "third_party/blink/renderer/platform/wtf/casting.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink {
diff --git a/third_party/blink/renderer/core/frame/web_view_frame_widget.cc b/third_party/blink/renderer/core/frame/web_view_frame_widget.cc index 71eba05..f90afed 100644 --- a/third_party/blink/renderer/core/frame/web_view_frame_widget.cc +++ b/third_party/blink/renderer/core/frame/web_view_frame_widget.cc
@@ -69,6 +69,22 @@ web_view_->EndRafAlignedInput(); } +void WebViewFrameWidget::BeginUpdateLayers() { + web_view_->BeginRafAlignedInput(); +} + +void WebViewFrameWidget::EndUpdateLayers() { + web_view_->EndRafAlignedInput(); +} + +void WebViewFrameWidget::BeginCommitCompositorFrame() { + web_view_->BeginCommitCompositorFrame(); +} + +void WebViewFrameWidget::EndCommitCompositorFrame() { + web_view_->EndCommitCompositorFrame(); +} + void WebViewFrameWidget::RecordStartOfFrameMetrics() { web_view_->RecordStartOfFrameMetrics(); }
diff --git a/third_party/blink/renderer/core/frame/web_view_frame_widget.h b/third_party/blink/renderer/core/frame/web_view_frame_widget.h index 9fef422..be1214f 100644 --- a/third_party/blink/renderer/core/frame/web_view_frame_widget.h +++ b/third_party/blink/renderer/core/frame/web_view_frame_widget.h
@@ -53,6 +53,10 @@ void DidBeginFrame() override; void BeginRafAlignedInput() override; void EndRafAlignedInput() override; + void BeginUpdateLayers() override; + void EndUpdateLayers() override; + void BeginCommitCompositorFrame() override; + void EndCommitCompositorFrame() override; void RecordStartOfFrameMetrics() override; void RecordEndOfFrameMetrics(base::TimeTicks frame_begin_time) override; void UpdateLifecycle(LifecycleUpdate requested_update,
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h index f328d06..7afd096 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h
@@ -364,7 +364,7 @@ IntSize size_; - TraceWrapperMember<CanvasRenderingContext> context_; + Member<CanvasRenderingContext> context_; // Used only for WebGL currently. bool context_creation_was_blocked_;
diff --git a/third_party/blink/renderer/core/html/canvas/image_data.h b/third_party/blink/renderer/core/html/canvas/image_data.h index 8abdfd04..cc0739d 100644 --- a/third_party/blink/renderer/core/html/canvas/image_data.h +++ b/third_party/blink/renderer/core/html/canvas/image_data.h
@@ -43,7 +43,6 @@ #include "third_party/blink/renderer/platform/graphics/canvas_color_params.h" #include "third_party/blink/renderer/platform/graphics/static_bitmap_image.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/skia/include/core/SkColorSpace.h"
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h index cac449fe7..9b10239 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h +++ b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h
@@ -40,8 +40,7 @@ friend class CustomElementReactionStackTestSupport; using ElementReactionQueueMap = - HeapHashMap<TraceWrapperMember<Element>, - Member<CustomElementReactionQueue>>; + HeapHashMap<Member<Element>, Member<CustomElementReactionQueue>>; ElementReactionQueueMap map_; using ElementQueue = HeapVector<Member<Element>, 1>;
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_registry.h b/third_party/blink/renderer/core/html/custom/custom_element_registry.h index e29f650..8f3ae3e3 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_registry.h +++ b/third_party/blink/renderer/core/html/custom/custom_element_registry.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/html/custom/custom_element_definition.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h" @@ -81,8 +80,7 @@ bool element_definition_is_running_; - using DefinitionList = - HeapVector<TraceWrapperMember<CustomElementDefinition>>; + using DefinitionList = HeapVector<Member<CustomElementDefinition>>; DefinitionList definitions_; using NameIdMap = HashMap<AtomicString, CustomElementDefinition::Id>; @@ -103,7 +101,7 @@ HeapHashMap<AtomicString, Member<ScriptPromiseResolver>>; WhenDefinedPromiseMap when_defined_promise_map_; - TraceWrapperMember<CustomElementReactionStack> reaction_stack_; + Member<CustomElementReactionStack> reaction_stack_; FRIEND_TEST_ALL_PREFIXES( CustomElementTest,
diff --git a/third_party/blink/renderer/core/html/forms/external_popup_menu.h b/third_party/blink/renderer/core/html/forms/external_popup_menu.h index c6536a46..9048585 100644 --- a/third_party/blink/renderer/core/html/forms/external_popup_menu.h +++ b/third_party/blink/renderer/core/html/forms/external_popup_menu.h
@@ -37,7 +37,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/html/forms/popup_menu.h" #include "third_party/blink/renderer/platform/timer.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/core/html/forms/html_output_element.h b/third_party/blink/renderer/core/html/forms/html_output_element.h index 036950c..a3e0fd6 100644 --- a/third_party/blink/renderer/core/html/forms/html_output_element.h +++ b/third_party/blink/renderer/core/html/forms/html_output_element.h
@@ -73,7 +73,7 @@ bool is_default_value_mode_; String default_value_; - TraceWrapperMember<DOMTokenList> tokens_; + Member<DOMTokenList> tokens_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/html/html_anchor_element.h b/third_party/blink/renderer/core/html/html_anchor_element.h index 7fdb334..f4ca628 100644 --- a/third_party/blink/renderer/core/html/html_anchor_element.h +++ b/third_party/blink/renderer/core/html/html_anchor_element.h
@@ -127,7 +127,7 @@ unsigned link_relations_ : 31; mutable LinkHash cached_visited_link_hash_; - TraceWrapperMember<RelList> rel_list_; + Member<RelList> rel_list_; }; inline LinkHash HTMLAnchorElement::VisitedLinkHash() const {
diff --git a/third_party/blink/renderer/core/html/html_iframe_element.h b/third_party/blink/renderer/core/html/html_iframe_element.h index 1010a54..f0b7471 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.h +++ b/third_party/blink/renderer/core/html/html_iframe_element.h
@@ -92,7 +92,7 @@ bool allow_fullscreen_; bool allow_payment_request_; bool collapsed_by_client_; - TraceWrapperMember<HTMLIFrameElementSandbox> sandbox_; + Member<HTMLIFrameElementSandbox> sandbox_; Member<DOMFeaturePolicy> policy_; // This represents a subset of sandbox flags set through 'sandbox' attribute // that will be converted to feature policies as part of the container
diff --git a/third_party/blink/renderer/core/html/html_link_element.h b/third_party/blink/renderer/core/html/html_link_element.h index af3537f1..e964a1f 100644 --- a/third_party/blink/renderer/core/html/html_link_element.h +++ b/third_party/blink/renderer/core/html/html_link_element.h
@@ -36,7 +36,6 @@ #include "third_party/blink/renderer/core/html/link_style.h" #include "third_party/blink/renderer/core/html/rel_list.h" #include "third_party/blink/renderer/core/loader/link_loader_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h" namespace blink { @@ -168,9 +167,9 @@ String integrity_; String importance_; network::mojom::ReferrerPolicy referrer_policy_; - TraceWrapperMember<DOMTokenList> sizes_; + Member<DOMTokenList> sizes_; Vector<IntSize> icon_sizes_; - TraceWrapperMember<RelList> rel_list_; + Member<RelList> rel_list_; LinkRelAttribute rel_attribute_; String scope_;
diff --git a/third_party/blink/renderer/core/html/html_script_element.h b/third_party/blink/renderer/core/html/html_script_element.h index 51d234d..c9850c6 100644 --- a/third_party/blink/renderer/core/html/html_script_element.h +++ b/third_party/blink/renderer/core/html/html_script_element.h
@@ -109,7 +109,7 @@ Element& CloneWithoutAttributesAndChildren(Document&) const override; - TraceWrapperMember<ScriptLoader> loader_; + Member<ScriptLoader> loader_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/html/html_template_element.h b/third_party/blink/renderer/core/html/html_template_element.h index fe9c1d8..66f4488 100644 --- a/third_party/blink/renderer/core/html/html_template_element.h +++ b/third_party/blink/renderer/core/html/html_template_element.h
@@ -32,7 +32,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_HTML_TEMPLATE_ELEMENT_H_ #include "third_party/blink/renderer/core/html/html_element.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -59,7 +58,7 @@ CloneChildrenFlag) override; void DidMoveToNewDocument(Document& old_document) override; - mutable TraceWrapperMember<TemplateContentDocumentFragment> content_; + mutable Member<TemplateContentDocumentFragment> content_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/html/imports/html_import_tree_root.h b/third_party/blink/renderer/core/html/imports/html_import_tree_root.h index cfe93b7..7d16abae 100644 --- a/third_party/blink/renderer/core/html/imports/html_import_tree_root.h +++ b/third_party/blink/renderer/core/html/imports/html_import_tree_root.h
@@ -8,7 +8,6 @@ #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/core/html/imports/html_import.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/timer.h" namespace blink { @@ -43,7 +42,7 @@ private: void RecalcTimerFired(TimerBase*); - TraceWrapperMember<Document> document_; + Member<Document> document_; TaskRunnerTimer<HTMLImportTreeRoot> recalc_timer_; // List of import which has been loaded or being loaded.
diff --git a/third_party/blink/renderer/core/html/imports/html_imports_controller.h b/third_party/blink/renderer/core/html/imports/html_imports_controller.h index 9c5b97c0..726a07d4 100644 --- a/third_party/blink/renderer/core/html/imports/html_imports_controller.h +++ b/third_party/blink/renderer/core/html/imports/html_imports_controller.h
@@ -84,7 +84,7 @@ HTMLImport* parent, HTMLImportChildClient*); - TraceWrapperMember<HTMLImportTreeRoot> root_; + Member<HTMLImportTreeRoot> root_; using LoaderList = HeapVector<Member<HTMLImportLoader>>; LoaderList loaders_; };
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.h b/third_party/blink/renderer/core/html/media/html_media_element.h index 8de1065..1397814 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.h +++ b/third_party/blink/renderer/core/html/media/html_media_element.h
@@ -41,7 +41,6 @@ #include "third_party/blink/renderer/core/intersection_observer/intersection_observer.h" #include "third_party/blink/renderer/platform/audio/audio_source_provider.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" #include "third_party/blink/renderer/platform/supplementable.h" @@ -621,12 +620,12 @@ // If any portion of an attached HTMLMediaElement (HTMLME) and the MediaSource // Extensions (MSE) API is alive (having pending activity or traceable from a - // GC root), the whole group is not GC'ed. Here, using TraceWrapperMember, + // GC root), the whole group is not GC'ed. Here, using Member, // instead of Member, because |media_source_|'s wrapper needs to remain alive // at least to successfully dispatch any events enqueued by behavior of the // HTMLME+MSE API. It makes |media_source_|'s wrapper remain alive as long as // this HTMLMediaElement's wrapper is alive. - TraceWrapperMember<HTMLMediaSource> media_source_; + Member<HTMLMediaSource> media_source_; // Stores "official playback position", updated periodically from "current // playback position". Official playback position should not change while @@ -662,9 +661,9 @@ bool was_always_muted_ : 1; - TraceWrapperMember<AudioTrackList> audio_tracks_; - TraceWrapperMember<VideoTrackList> video_tracks_; - TraceWrapperMember<TextTrackList> text_tracks_; + Member<AudioTrackList> audio_tracks_; + Member<VideoTrackList> video_tracks_; + Member<TextTrackList> text_tracks_; HeapVector<Member<TextTrack>> text_tracks_when_resource_selection_began_; Member<CueTimeline> cue_timeline_;
diff --git a/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc b/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc index 26e70c15f..4224493 100644 --- a/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc +++ b/third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.cc
@@ -98,7 +98,6 @@ DCHECK(GetVideoElement().CcLayer()); GetVideoElement().CcLayer()->SetIsDrawable(false); - GetVideoElement().CcLayer()->SetHitTestable(false); } void PictureInPictureInterstitial::Hide() { @@ -113,10 +112,8 @@ interstitial_timer_.StartOneShot(kPictureInPictureHiddenAnimationSeconds, FROM_HERE); - if (GetVideoElement().CcLayer()) { + if (GetVideoElement().CcLayer()) GetVideoElement().CcLayer()->SetIsDrawable(true); - GetVideoElement().CcLayer()->SetHitTestable(true); - } } Node::InsertionNotificationRequest PictureInPictureInterstitial::InsertedInto(
diff --git a/third_party/blink/renderer/core/html/parser/html_document_parser.h b/third_party/blink/renderer/core/html/parser/html_document_parser.h index 253f588..2384523d 100644 --- a/third_party/blink/renderer/core/html/parser/html_document_parser.h +++ b/third_party/blink/renderer/core/html/parser/html_document_parser.h
@@ -47,7 +47,6 @@ #include "third_party/blink/renderer/core/html/parser/xss_auditor.h" #include "third_party/blink/renderer/core/html/parser/xss_auditor_delegate.h" #include "third_party/blink/renderer/core/script/html_parser_script_runner_host.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/text/text_position.h" @@ -236,7 +235,7 @@ std::unique_ptr<HTMLToken> token_; std::unique_ptr<HTMLTokenizer> tokenizer_; - TraceWrapperMember<HTMLParserScriptRunner> script_runner_; + Member<HTMLParserScriptRunner> script_runner_; Member<HTMLTreeBuilder> tree_builder_; std::unique_ptr<HTMLPreloadScanner> preload_scanner_;
diff --git a/third_party/blink/renderer/core/html/track/text_track.h b/third_party/blink/renderer/core/html/track/text_track.h index 9b96c851..1abd4c2 100644 --- a/third_party/blink/renderer/core/html/track/text_track.h +++ b/third_party/blink/renderer/core/html/track/text_track.h
@@ -30,7 +30,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/event_target.h" #include "third_party/blink/renderer/core/html/track/track_base.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -142,7 +141,7 @@ CueTimeline* GetCueTimeline() const; TextTrackCueList* EnsureTextTrackCueList(); - TraceWrapperMember<TextTrackCueList> cues_; + Member<TextTrackCueList> cues_; Member<TextTrackCueList> active_cues_; Member<TextTrackList> track_list_;
diff --git a/third_party/blink/renderer/core/html/track/text_track_cue_list.h b/third_party/blink/renderer/core/html/track/text_track_cue_list.h index 261bce3..505136fa 100644 --- a/third_party/blink/renderer/core/html/track/text_track_cue_list.h +++ b/third_party/blink/renderer/core/html/track/text_track_cue_list.h
@@ -28,7 +28,6 @@ #include "third_party/blink/renderer/core/html/track/text_track_cue.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/vector.h" namespace blink { @@ -63,7 +62,7 @@ void InvalidateCueIndex(wtf_size_t index); void Clear(); - HeapVector<TraceWrapperMember<TextTrackCue>> list_; + HeapVector<Member<TextTrackCue>> list_; wtf_size_t first_invalid_index_; };
diff --git a/third_party/blink/renderer/core/html/track/text_track_list.cc b/third_party/blink/renderer/core/html/track/text_track_list.cc index c1ca2a7..0f2118f 100644 --- a/third_party/blink/renderer/core/html/track/text_track_list.cc +++ b/third_party/blink/renderer/core/html/track/text_track_list.cc
@@ -139,7 +139,7 @@ } void TextTrackList::InvalidateTrackIndexesAfterTrack(TextTrack* track) { - HeapVector<TraceWrapperMember<TextTrack>>* tracks = nullptr; + HeapVector<Member<TextTrack>>* tracks = nullptr; if (track->TrackType() == TextTrack::kTrackElement) { tracks = &element_tracks_; @@ -187,7 +187,7 @@ } void TextTrackList::Remove(TextTrack* track) { - HeapVector<TraceWrapperMember<TextTrack>>* tracks = nullptr; + HeapVector<Member<TextTrack>>* tracks = nullptr; if (track->TrackType() == TextTrack::kTrackElement) { tracks = &element_tracks_; @@ -221,7 +221,7 @@ } bool TextTrackList::Contains(TextTrack* track) const { - const HeapVector<TraceWrapperMember<TextTrack>>* tracks = nullptr; + const HeapVector<Member<TextTrack>>* tracks = nullptr; if (track->TrackType() == TextTrack::kTrackElement) tracks = &element_tracks_;
diff --git a/third_party/blink/renderer/core/html/track/text_track_list.h b/third_party/blink/renderer/core/html/track/text_track_list.h index f4a17ff..fd1483d 100644 --- a/third_party/blink/renderer/core/html/track/text_track_list.h +++ b/third_party/blink/renderer/core/html/track/text_track_list.h
@@ -82,9 +82,9 @@ Member<HTMLMediaElement> owner_; - HeapVector<TraceWrapperMember<TextTrack>> add_track_tracks_; - HeapVector<TraceWrapperMember<TextTrack>> element_tracks_; - HeapVector<TraceWrapperMember<TextTrack>> inband_tracks_; + HeapVector<Member<TextTrack>> add_track_tracks_; + HeapVector<Member<TextTrack>> element_tracks_; + HeapVector<Member<TextTrack>> inband_tracks_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/html/track/track_list_base.h b/third_party/blink/renderer/core/html/track/track_list_base.h index 6b9dca3..fcbd9a5 100644 --- a/third_party/blink/renderer/core/html/track/track_list_base.h +++ b/third_party/blink/renderer/core/html/track/track_list_base.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/html/media/html_media_element.h" #include "third_party/blink/renderer/core/html/track/track_event.h" #include "third_party/blink/renderer/core/html/track/track_event_init.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -91,7 +90,7 @@ media_element_->ScheduleEvent(event); } - HeapVector<TraceWrapperMember<T>> tracks_; + HeapVector<Member<T>> tracks_; Member<HTMLMediaElement> media_element_; };
diff --git a/third_party/blink/renderer/core/input/keyboard_event_manager.cc b/third_party/blink/renderer/core/input/keyboard_event_manager.cc index 0c4abb2a..d4e0e36 100644 --- a/third_party/blink/renderer/core/input/keyboard_event_manager.cc +++ b/third_party/blink/renderer/core/input/keyboard_event_manager.cc
@@ -42,10 +42,6 @@ namespace { -#if defined(OS_WIN) -static const uint16_t kHIGHBITMASKSHORT = 0x8000; -#endif - const int kVKeyProcessKey = 229; const int kVKeySpatNavBack = 233; @@ -498,10 +494,7 @@ bool KeyboardEventManager::CurrentCapsLockState() { switch (g_override_caps_lock_state) { case OverrideCapsLockState::kDefault: -#if defined(OS_WIN) - // FIXME: Does this even work inside the sandbox? - return GetKeyState(VK_CAPITAL) & 1; -#elif defined(OS_MACOSX) +#if defined(OS_MACOSX) return GetCurrentKeyModifiers() & alphaLock; #else // Caps lock state use is limited to Mac password input @@ -518,14 +511,7 @@ WebInputEvent::Modifiers KeyboardEventManager::GetCurrentModifierState() { unsigned modifiers = 0; -#if defined(OS_WIN) - if (GetKeyState(VK_SHIFT) & kHIGHBITMASKSHORT) - modifiers |= WebInputEvent::kShiftKey; - if (GetKeyState(VK_CONTROL) & kHIGHBITMASKSHORT) - modifiers |= WebInputEvent::kControlKey; - if (GetKeyState(VK_MENU) & kHIGHBITMASKSHORT) - modifiers |= WebInputEvent::kAltKey; -#elif defined(OS_MACOSX) +#if defined(OS_MACOSX) UInt32 current_modifiers = GetCurrentKeyModifiers(); if (current_modifiers & ::shiftKey) modifiers |= WebInputEvent::kShiftKey;
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol.pdl b/third_party/blink/renderer/core/inspector/browser_protocol.pdl index 8d86d0f..e23a03d 100644 --- a/third_party/blink/renderer/core/inspector/browser_protocol.pdl +++ b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
@@ -6404,6 +6404,13 @@ # Configuration for memory dump triggers. Used only when "memory-infra" category is enabled. optional MemoryDumpConfig memoryDumpConfig + # Data format of a trace. Can be either the legacy JSON format or the + # protocol buffer format. Note that the JSON format will be deprecated soon. + type StreamFormat extends string + enum + json + proto + # Compression type to use for traces returned via streams. type StreamCompression extends string enum @@ -6447,6 +6454,9 @@ optional enum transferMode ReportEvents ReturnAsStream + # Trace data format to use. This only applies when using `ReturnAsStream` + # transfer mode (defaults to `json`). + optional StreamFormat streamFormat # Compression format to use. This only applies when using `ReturnAsStream` # transfer mode (defaults to `none`) optional StreamCompression streamCompression @@ -6475,6 +6485,8 @@ parameters # A handle of the stream that holds resulting trace data. optional IO.StreamHandle stream + # Trace data format of returned stream. + optional StreamFormat traceFormat # Compression format of returned stream. optional StreamCompression streamCompression
diff --git a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc index 046f179..29d6574 100644 --- a/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.cc
@@ -44,6 +44,7 @@ #include "third_party/blink/renderer/core/inspector/resolve_node.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/wtf/functional.h" namespace {
diff --git a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc index 11d0499..cb84c02 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc
@@ -211,7 +211,6 @@ if (RuntimeEnabledFeatures::CompositeAfterPaintEnabled()) { layer_ = cc::PictureLayer::Create(this); layer_->SetIsDrawable(true); - layer_->SetHitTestable(true); } } ~InspectorPageOverlayDelegate() override {
diff --git a/third_party/blink/renderer/core/inspector/worker_inspector_controller.cc b/third_party/blink/renderer/core/inspector/worker_inspector_controller.cc index 5225b40..b62bdb1 100644 --- a/third_party/blink/renderer/core/inspector/worker_inspector_controller.cc +++ b/third_party/blink/renderer/core/inspector/worker_inspector_controller.cc
@@ -76,12 +76,10 @@ probe_sink_(MakeGarbageCollected<CoreProbeSink>()) { probe_sink_->AddInspectorTraceEvents( MakeGarbageCollected<InspectorTraceEvents>()); - if (auto* scope = DynamicTo<WorkerGlobalScope>(thread->GlobalScope())) { - worker_devtools_token_ = devtools_params->devtools_worker_token; - parent_devtools_token_ = scope->GetParentDevToolsToken(); - url_ = url; - worker_thread_id_ = thread->GetPlatformThreadId(); - } + worker_devtools_token_ = devtools_params->devtools_worker_token; + parent_devtools_token_ = thread->GlobalScope()->GetParentDevToolsToken(); + url_ = url; + worker_thread_id_ = thread->GetPlatformThreadId(); scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = Platform::Current()->GetIOTaskRunner(); if (!parent_devtools_token_.is_empty() && io_task_runner) {
diff --git a/third_party/blink/renderer/core/intersection_observer/element_intersection_observer_data.h b/third_party/blink/renderer/core/intersection_observer/element_intersection_observer_data.h index 5b35944..ac55771 100644 --- a/third_party/blink/renderer/core/intersection_observer/element_intersection_observer_data.h +++ b/third_party/blink/renderer/core/intersection_observer/element_intersection_observer_data.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/core/dom/dom_high_res_time_stamp.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -35,8 +34,7 @@ private: // IntersectionObservations for which the Node owning this data is target. - HeapHashMap<TraceWrapperMember<IntersectionObserver>, - Member<IntersectionObservation>> + HeapHashMap<Member<IntersectionObserver>, Member<IntersectionObservation>> intersection_observations_; };
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observer.h b/third_party/blink/renderer/core/intersection_observer/intersection_observer.h index dc21800b..876c584 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observer.h +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observer.h
@@ -12,7 +12,6 @@ #include "third_party/blink/renderer/core/intersection_observer/intersection_observer_entry.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/geometry/length.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" @@ -158,7 +157,7 @@ private: void ClearWeakMembers(Visitor*); - const TraceWrapperMember<IntersectionObserverDelegate> delegate_; + const Member<IntersectionObserverDelegate> delegate_; WeakMember<Element> root_; HeapLinkedHashSet<WeakMember<IntersectionObservation>> observations_; Vector<float> thresholds_;
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.h b/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.h index a457efc..516756a 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.h +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.h
@@ -8,7 +8,6 @@ #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/core/intersection_observer/intersection_observer.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" @@ -64,11 +63,10 @@ HeapHashSet<WeakMember<Element>> tracked_observation_targets_; // IntersectionObservers for which this is the execution context of the // callback. - HeapHashSet<TraceWrapperMember<IntersectionObserver>> - pending_intersection_observers_; + HeapHashSet<Member<IntersectionObserver>> pending_intersection_observers_; // TODO(https://crbug.com/796145): Remove this hack once on-stack objects // get supported by either of wrapper-tracing or unified GC. - HeapVector<TraceWrapperMember<IntersectionObserver>> + HeapVector<Member<IntersectionObserver>> intersection_observers_being_invoked_; };
diff --git a/third_party/blink/renderer/core/layout/BUILD.gn b/third_party/blink/renderer/core/layout/BUILD.gn index eff3c9bf..bc16075 100644 --- a/third_party/blink/renderer/core/layout/BUILD.gn +++ b/third_party/blink/renderer/core/layout/BUILD.gn
@@ -512,6 +512,7 @@ "text_decoration_offset_base.h", "text_run_constructor.cc", "text_run_constructor.h", + "theme_types.h", "traced_layout_object.cc", "traced_layout_object.h", "vertical_position_cache.h",
diff --git a/third_party/blink/renderer/core/layout/custom/css_layout_definition.h b/third_party/blink/renderer/core/layout/custom/css_layout_definition.h index 2142c302..7dde077 100644 --- a/third_party/blink/renderer/core/layout/custom/css_layout_definition.h +++ b/third_party/blink/renderer/core/layout/custom/css_layout_definition.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/scoped_persistent.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "v8/include/v8.h" @@ -95,9 +94,9 @@ // This object keeps the class instances, constructor function, intrinsic // sizes function, and layout function alive. It participates in wrapper // tracing as it holds onto V8 wrappers. - TraceWrapperMember<V8NoArgumentConstructor> constructor_; - TraceWrapperMember<V8Function> unused_intrinsic_sizes_; - TraceWrapperMember<V8LayoutCallback> layout_; + Member<V8NoArgumentConstructor> constructor_; + Member<V8Function> unused_intrinsic_sizes_; + Member<V8LayoutCallback> layout_; // If a constructor call ever fails, we'll refuse to create any more // instances of the web developer provided class.
diff --git a/third_party/blink/renderer/core/layout/custom/document_layout_definition.h b/third_party/blink/renderer/core/layout/custom/document_layout_definition.h index 7702fbe68..6c880e5 100644 --- a/third_party/blink/renderer/core/layout/custom/document_layout_definition.h +++ b/third_party/blink/renderer/core/layout/custom/document_layout_definition.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_CUSTOM_DOCUMENT_LAYOUT_DEFINITION_H_ #include "third_party/blink/renderer/core/layout/custom/css_layout_definition.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h index a802704..39074d6 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h +++ b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h
@@ -48,8 +48,7 @@ private: // https://drafts.css-houdini.org/css-layout-api/#layout-definitions - typedef HeapHashMap<String, TraceWrapperMember<CSSLayoutDefinition>> - DefinitionMap; + typedef HeapHashMap<String, Member<CSSLayoutDefinition>> DefinitionMap; DefinitionMap layout_definitions_; Member<PendingLayoutRegistry> pending_layout_registry_; };
diff --git a/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc b/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc index 656d287..427cece 100644 --- a/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc +++ b/third_party/blink/renderer/core/layout/flexible_box_algorithm.cc
@@ -39,7 +39,7 @@ FlexItem::FlexItem(LayoutBox* box, LayoutUnit flex_base_content_size, MinMaxSize min_max_sizes, - LayoutUnit main_axis_border_and_padding, + LayoutUnit main_axis_border_scrollbar_padding, LayoutUnit main_axis_margin) : algorithm(nullptr), line_number(0), @@ -48,7 +48,7 @@ min_max_sizes(min_max_sizes), hypothetical_main_content_size( min_max_sizes.ClampSizeToMinAndMax(flex_base_content_size)), - main_axis_border_and_padding(main_axis_border_and_padding), + main_axis_border_scrollbar_padding(main_axis_border_scrollbar_padding), main_axis_margin(main_axis_margin), frozen(false), ng_input_node(/* LayoutBox* */ nullptr) {
diff --git a/third_party/blink/renderer/core/layout/flexible_box_algorithm.h b/third_party/blink/renderer/core/layout/flexible_box_algorithm.h index 3819164..b7ae7a1 100644 --- a/third_party/blink/renderer/core/layout/flexible_box_algorithm.h +++ b/third_party/blink/renderer/core/layout/flexible_box_algorithm.h
@@ -69,30 +69,30 @@ DISALLOW_NEW(); public: - // flex_base_content_size includes scrollbar width but not border or padding. + // flex_base_content_size does not include border/scrollbar/padding. // min_max_sizes is the min and max size in the main axis direction. FlexItem(LayoutBox*, LayoutUnit flex_base_content_size, MinMaxSize min_max_sizes, - LayoutUnit main_axis_border_and_padding, + LayoutUnit main_axis_border_scrollbar_padding, LayoutUnit main_axis_margin); LayoutUnit HypotheticalMainAxisMarginBoxSize() const { - return hypothetical_main_content_size + main_axis_border_and_padding + + return hypothetical_main_content_size + main_axis_border_scrollbar_padding + main_axis_margin; } LayoutUnit FlexBaseMarginBoxSize() const { - return flex_base_content_size + main_axis_border_and_padding + + return flex_base_content_size + main_axis_border_scrollbar_padding + main_axis_margin; } LayoutUnit FlexedBorderBoxSize() const { - return flexed_content_size + main_axis_border_and_padding; + return flexed_content_size + main_axis_border_scrollbar_padding; } LayoutUnit FlexedMarginBoxSize() const { - return flexed_content_size + main_axis_border_and_padding + + return flexed_content_size + main_axis_border_scrollbar_padding + main_axis_margin; } @@ -129,7 +129,7 @@ const LayoutUnit flex_base_content_size; const MinMaxSize min_max_sizes; const LayoutUnit hypothetical_main_content_size; - const LayoutUnit main_axis_border_and_padding; + const LayoutUnit main_axis_border_scrollbar_padding; const LayoutUnit main_axis_margin; LayoutUnit flexed_content_size;
diff --git a/third_party/blink/renderer/core/layout/layout_box.h b/third_party/blink/renderer/core/layout/layout_box.h index 1545e10..0b216c8 100644 --- a/third_party/blink/renderer/core/layout/layout_box.h +++ b/third_party/blink/renderer/core/layout/layout_box.h
@@ -32,7 +32,6 @@ #include "third_party/blink/renderer/core/layout/min_max_size.h" #include "third_party/blink/renderer/core/layout/overflow_model.h" #include "third_party/blink/renderer/platform/graphics/scroll_types.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/core/layout/layout_flexible_box.cc b/third_party/blink/renderer/core/layout/layout_flexible_box.cc index c8beabd..9617f2c 100644 --- a/third_party/blink/renderer/core/layout/layout_flexible_box.cc +++ b/third_party/blink/renderer/core/layout/layout_flexible_box.cc
@@ -577,7 +577,7 @@ const LayoutBox& child, SizeType size_type, const Length& size, - LayoutUnit border_and_padding) const { + LayoutUnit border_scrollbar_padding) const { if (!MainAxisIsInlineAxis(child)) { // We don't have to check for "auto" here - computeContentLogicalHeight // will just return -1 for that case anyway. It's safe to access @@ -587,21 +587,20 @@ // childHasIntrinsicMainAxisSize) so we can be sure that the two height // calls here will return up-to-date data. return child.ComputeContentLogicalHeight( - size_type, size, child.IntrinsicContentLogicalHeight()) + - child.ScrollbarLogicalHeight(); + size_type, size, child.IntrinsicContentLogicalHeight()); } // computeLogicalWidth always re-computes the intrinsic widths. However, when // our logical width is auto, we can just use our cached value. So let's do // that here. (Compare code in LayoutBlock::computePreferredLogicalWidths) if (child.StyleRef().LogicalWidth().IsAuto() && !HasAspectRatio(child)) { if (size.IsMinContent()) - return child.MinPreferredLogicalWidth() - border_and_padding; + return child.MinPreferredLogicalWidth() - border_scrollbar_padding; if (size.IsMaxContent()) - return child.MaxPreferredLogicalWidth() - border_and_padding; + return child.MaxPreferredLogicalWidth() - border_scrollbar_padding; } return child.ComputeLogicalWidthUsing(size_type, size, ContentLogicalWidth(), this) - - border_and_padding; + border_scrollbar_padding; } LayoutUnit LayoutFlexibleBox::ContentInsetRight() const { @@ -819,7 +818,7 @@ DISABLE_CFI_PERF LayoutUnit LayoutFlexibleBox::ComputeInnerFlexBaseSizeForChild( LayoutBox& child, - LayoutUnit main_axis_border_and_padding, + LayoutUnit main_axis_border_scrollbar_padding, ChildLayoutType child_layout_type) { child.ClearOverrideSize(); @@ -830,7 +829,7 @@ if (MainAxisLengthIsDefinite(child, flex_basis)) { return std::max(LayoutUnit(), ComputeMainAxisExtentForChild( child, kMainOrPreferredSize, flex_basis, - main_axis_border_and_padding)); + main_axis_border_scrollbar_padding)); } if (child.ShouldApplySizeContainment()) @@ -857,9 +856,9 @@ } main_axis_extent = intrinsic_size_along_main_axis_.at(&child); } - DCHECK_GE(main_axis_extent - main_axis_border_and_padding, LayoutUnit()) - << main_axis_extent << " - " << main_axis_border_and_padding; - return main_axis_extent - main_axis_border_and_padding; + DCHECK_GE(main_axis_extent - main_axis_border_scrollbar_padding, LayoutUnit()) + << main_axis_extent << " - " << main_axis_border_scrollbar_padding; + return main_axis_extent - main_axis_border_scrollbar_padding; } void LayoutFlexibleBox::LayoutFlexItems(bool relayout_children, @@ -1038,14 +1037,14 @@ MinMaxSize LayoutFlexibleBox::ComputeMinAndMaxSizesForChild( const FlexLayoutAlgorithm& algorithm, const LayoutBox& child, - LayoutUnit border_and_padding) const { + LayoutUnit border_scrollbar_padding) const { MinMaxSize sizes{LayoutUnit(), LayoutUnit::Max()}; const Length& max = IsHorizontalFlow() ? child.StyleRef().MaxWidth() : child.StyleRef().MaxHeight(); if (max.IsSpecifiedOrIntrinsic()) { - sizes.max_size = - ComputeMainAxisExtentForChild(child, kMaxSize, max, border_and_padding); + sizes.max_size = ComputeMainAxisExtentForChild(child, kMaxSize, max, + border_scrollbar_padding); if (sizes.max_size == -1) sizes.max_size = LayoutUnit::Max(); DCHECK_GE(sizes.max_size, LayoutUnit()); @@ -1054,14 +1053,14 @@ const Length& min = IsHorizontalFlow() ? child.StyleRef().MinWidth() : child.StyleRef().MinHeight(); if (min.IsSpecifiedOrIntrinsic()) { - sizes.min_size = - ComputeMainAxisExtentForChild(child, kMinSize, min, border_and_padding); + sizes.min_size = ComputeMainAxisExtentForChild(child, kMinSize, min, + border_scrollbar_padding); // computeMainAxisExtentForChild can return -1 when the child has a // percentage min size, but we have an indefinite size in that axis. sizes.min_size = std::max(LayoutUnit(), sizes.min_size); } else if (algorithm.ShouldApplyMinSizeAutoForChild(child)) { LayoutUnit content_size = ComputeMainAxisExtentForChild( - child, kMinSize, Length::MinContent(), border_and_padding); + child, kMinSize, Length::MinContent(), border_scrollbar_padding); DCHECK_GE(content_size, LayoutUnit()); if (HasAspectRatio(child) && child.IntrinsicSize().Height() > 0) content_size = @@ -1078,7 +1077,7 @@ : child.StyleRef().Height(); if (MainAxisLengthIsDefinite(child, main_size)) { LayoutUnit resolved_main_size = ComputeMainAxisExtentForChild( - child, kMainOrPreferredSize, main_size, border_and_padding); + child, kMainOrPreferredSize, main_size, border_scrollbar_padding); DCHECK_GE(resolved_main_size, LayoutUnit()); LayoutUnit specified_size = sizes.max_size != -1 ? std::min(resolved_main_size, sizes.max_size) @@ -1192,19 +1191,20 @@ } } - LayoutUnit border_and_padding = IsHorizontalFlow() - ? child.BorderAndPaddingWidth() - : child.BorderAndPaddingHeight(); + LayoutUnit border_scrollbar_padding = + IsHorizontalFlow() + ? child.BorderAndPaddingWidth() + child.VerticalScrollbarWidth() + : child.BorderAndPaddingHeight() + child.HorizontalScrollbarHeight(); - MinMaxSize sizes = - ComputeMinAndMaxSizesForChild(*algorithm, child, border_and_padding); + MinMaxSize sizes = ComputeMinAndMaxSizesForChild(*algorithm, child, + border_scrollbar_padding); - LayoutUnit child_inner_flex_base_size = - ComputeInnerFlexBaseSizeForChild(child, border_and_padding, layout_type); + LayoutUnit child_inner_flex_base_size = ComputeInnerFlexBaseSizeForChild( + child, border_scrollbar_padding, layout_type); LayoutUnit margin = IsHorizontalFlow() ? child.MarginWidth() : child.MarginHeight(); algorithm->emplace_back(&child, child_inner_flex_base_size, sizes, - border_and_padding, margin); + border_scrollbar_padding, margin); } static LayoutUnit AlignmentOffset(LayoutUnit available_free_space, @@ -1455,7 +1455,8 @@ // But it turns out that tables ignore the override size, and so we have // to re-check the size so that we place the flex item correctly. flex_item.flexed_content_size = - MainAxisExtentForChild(*child) - flex_item.main_axis_border_and_padding; + MainAxisExtentForChild(*child) - + flex_item.main_axis_border_scrollbar_padding; flex_item.cross_axis_size = CrossAxisUnstretchedExtentForChild(*child); } }
diff --git a/third_party/blink/renderer/core/layout/layout_flexible_box.h b/third_party/blink/renderer/core/layout/layout_flexible_box.h index c35d283..68efd71 100644 --- a/third_party/blink/renderer/core/layout/layout_flexible_box.h +++ b/third_party/blink/renderer/core/layout/layout_flexible_box.h
@@ -130,10 +130,11 @@ const LayoutBox& child) const; LayoutUnit CrossAxisExtent() const; LayoutUnit MainAxisContentExtent(LayoutUnit content_logical_height); - LayoutUnit ComputeMainAxisExtentForChild(const LayoutBox& child, - SizeType, - const Length& size, - LayoutUnit border_and_padding) const; + LayoutUnit ComputeMainAxisExtentForChild( + const LayoutBox& child, + SizeType, + const Length& size, + LayoutUnit border_scrollbar_padding) const; LayoutUnit ContentInsetBottom() const; LayoutUnit ContentInsetRight() const; @@ -152,7 +153,7 @@ void SetFlowAwareLocationForChild(LayoutBox& child, const LayoutPoint&); LayoutUnit ComputeInnerFlexBaseSizeForChild( LayoutBox& child, - LayoutUnit main_axis_border_and_padding, + LayoutUnit main_axis_border_scrollbar_padding, ChildLayoutType = kLayoutIfNeeded); void AdjustAlignmentForChild(LayoutBox& child, LayoutUnit); bool MainAxisLengthIsDefinite(const LayoutBox& child, @@ -176,9 +177,10 @@ LayoutUnit ComputeChildMarginValue(const Length& margin); void PrepareOrderIteratorAndMargins(); - MinMaxSize ComputeMinAndMaxSizesForChild(const FlexLayoutAlgorithm& algorithm, - const LayoutBox& child, - LayoutUnit border_and_padding) const; + MinMaxSize ComputeMinAndMaxSizesForChild( + const FlexLayoutAlgorithm& algorithm, + const LayoutBox& child, + LayoutUnit border_scrollbar_padding) const; LayoutUnit AdjustChildSizeForAspectRatioCrossAxisMinAndMax( const LayoutBox& child, LayoutUnit child_size) const;
diff --git a/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc b/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc index 1e4b253..82c2aa88c 100644 --- a/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc +++ b/third_party/blink/renderer/core/layout/layout_multi_column_flow_thread_test.cc
@@ -8,6 +8,7 @@ #include "third_party/blink/renderer/core/layout/layout_multi_column_set.h" #include "third_party/blink/renderer/core/layout/layout_multi_column_spanner_placeholder.h" #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { @@ -37,17 +38,17 @@ String MultiColumnRenderingTest::ColumnSetSignature( LayoutMultiColumnFlowThread* flow_thread) { - String signature = ""; + StringBuilder signature; for (LayoutBox* column_box = flow_thread->FirstMultiColumnBox(); column_box; column_box = column_box->NextSiblingMultiColumnBox()) { if (column_box->IsLayoutMultiColumnSpannerPlaceholder()) - signature.append('s'); + signature.Append('s'); else if (column_box->IsLayoutMultiColumnSet()) - signature.append('c'); + signature.Append('c'); else - signature.append('?'); + signature.Append('?'); } - return signature; + return signature.ToString(); } String MultiColumnRenderingTest::ColumnSetSignature(const char* multicol_id) {
diff --git a/third_party/blink/renderer/core/layout/layout_theme.cc b/third_party/blink/renderer/core/layout/layout_theme.cc index a4ca253b..682bc4dc 100644 --- a/third_party/blink/renderer/core/layout/layout_theme.cc +++ b/third_party/blink/renderer/core/layout/layout_theme.cc
@@ -55,7 +55,6 @@ #include "third_party/blink/renderer/platform/graphics/touch_action.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/text/platform_locale.h" -#include "third_party/blink/renderer/platform/theme.h" #include "third_party/blink/renderer/platform/web_test_support.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "ui/native_theme/native_theme.h" @@ -79,8 +78,7 @@ return NativeTheme(); } -LayoutTheme::LayoutTheme(Theme* platform_theme) - : has_custom_focus_ring_color_(false), platform_theme_(platform_theme) {} +LayoutTheme::LayoutTheme() : has_custom_focus_ring_color_(false) {} void LayoutTheme::AdjustStyle(ComputedStyle& style, Element* e) { DCHECK(style.HasAppearance()); @@ -118,125 +116,7 @@ return; } - if (platform_theme_) { - switch (part) { - case kCheckboxPart: - case kInnerSpinButtonPart: - case kRadioPart: - case kPushButtonPart: - case kSquareButtonPart: - case kButtonPart: { - // Border - LengthBox border_box(style.BorderTopWidth(), style.BorderRightWidth(), - style.BorderBottomWidth(), - style.BorderLeftWidth()); - border_box = platform_theme_->ControlBorder( - part, style.GetFont().GetFontDescription(), border_box, - style.EffectiveZoom()); - if (border_box.Top().Value() != - static_cast<int>(style.BorderTopWidth())) { - if (border_box.Top().Value()) - style.SetBorderTopWidth(border_box.Top().Value()); - else - style.ResetBorderTop(); - } - if (border_box.Right().Value() != - static_cast<int>(style.BorderRightWidth())) { - if (border_box.Right().Value()) - style.SetBorderRightWidth(border_box.Right().Value()); - else - style.ResetBorderRight(); - } - if (border_box.Bottom().Value() != - static_cast<int>(style.BorderBottomWidth())) { - style.SetBorderBottomWidth(border_box.Bottom().Value()); - if (border_box.Bottom().Value()) - style.SetBorderBottomWidth(border_box.Bottom().Value()); - else - style.ResetBorderBottom(); - } - if (border_box.Left().Value() != - static_cast<int>(style.BorderLeftWidth())) { - style.SetBorderLeftWidth(border_box.Left().Value()); - if (border_box.Left().Value()) - style.SetBorderLeftWidth(border_box.Left().Value()); - else - style.ResetBorderLeft(); - } - - // Padding - LengthBox padding_box = platform_theme_->ControlPadding( - part, style.GetFont().GetFontDescription(), style.PaddingTop(), - style.PaddingRight(), style.PaddingBottom(), style.PaddingLeft(), - style.EffectiveZoom()); - if (!style.PaddingEqual(padding_box)) - style.SetPadding(padding_box); - - // Whitespace - if (platform_theme_->ControlRequiresPreWhiteSpace(part)) - style.SetWhiteSpace(EWhiteSpace::kPre); - - // Width / Height - // The width and height here are affected by the zoom. - // FIXME: Check is flawed, since it doesn't take min-width/max-width - // into account. - LengthSize control_size = platform_theme_->GetControlSize( - part, style.GetFont().GetFontDescription(), - LengthSize(style.Width(), style.Height()), style.EffectiveZoom()); - - LengthSize min_control_size = platform_theme_->MinimumControlSize( - part, style.GetFont().GetFontDescription(), style.EffectiveZoom()); - - // Only potentially set min-size to |control_size| for these parts. - if (part == kCheckboxPart || part == kRadioPart) - SetMinimumSize(style, &control_size, &min_control_size); - else - SetMinimumSize(style, nullptr, &min_control_size); - - if (control_size.Width() != style.Width()) - style.SetWidth(control_size.Width()); - if (control_size.Height() != style.Height()) - style.SetHeight(control_size.Height()); - - // Font - FontDescription control_font = platform_theme_->ControlFont( - part, style.GetFont().GetFontDescription(), style.EffectiveZoom()); - if (control_font != style.GetFont().GetFontDescription()) { - // Reset our line-height - style.SetLineHeight(ComputedStyleInitialValues::InitialLineHeight()); - - // Now update our font. - if (style.SetFontDescription(control_font)) - style.GetFont().Update(nullptr); - } - break; - } - case kProgressBarPart: - AdjustProgressBarBounds(style); - break; - default: - break; - } - } - - if (!platform_theme_) { - // Call the appropriate style adjustment method based off the appearance - // value. - switch (style.Appearance()) { - case kCheckboxPart: - return AdjustCheckboxStyle(style); - case kRadioPart: - return AdjustRadioStyle(style); - case kPushButtonPart: - case kSquareButtonPart: - case kButtonPart: - return AdjustButtonStyle(style); - case kInnerSpinButtonPart: - return AdjustInnerSpinButtonStyle(style); - default: - break; - } - } + AdjustControlPartStyle(style); // Call the appropriate style adjustment method based off the appearance // value. @@ -357,11 +237,6 @@ LayoutUnit LayoutTheme::BaselinePositionAdjustment( const ComputedStyle& style) const { - if (platform_theme_) { - return LayoutUnit( - platform_theme_->BaselinePositionAdjustment(style.Appearance()) * - style.EffectiveZoom()); - } return LayoutUnit(); } @@ -391,16 +266,6 @@ } } -void LayoutTheme::AddVisualOverflow(const Node* node, - const ComputedStyle& style, - IntRect& border_box) { - if (platform_theme_) { - platform_theme_->AddVisualOverflow(style.Appearance(), - ControlStatesForNode(node, style), - style.EffectiveZoom(), border_box); - } -} - bool LayoutTheme::ShouldDrawDefaultFocusRing(const Node* node, const ComputedStyle& style) const { if (ThemeDrawsFocusRing(style)) @@ -948,4 +813,58 @@ return ComputedStyleInitialValues::InitialColor(); } +LengthBox LayoutTheme::ControlPadding(ControlPart part, + const FontDescription&, + const Length& zoomed_box_top, + const Length& zoomed_box_right, + const Length& zoomed_box_bottom, + const Length& zoomed_box_left, + float) const { + switch (part) { + case kMenulistPart: + case kMenulistButtonPart: + case kCheckboxPart: + case kRadioPart: + return LengthBox(0); + default: + return LengthBox(zoomed_box_top, zoomed_box_right, zoomed_box_bottom, + zoomed_box_left); + } +} + +LengthBox LayoutTheme::ControlBorder(ControlPart part, + const FontDescription&, + const LengthBox& zoomed_box, + float) const { + switch (part) { + case kPushButtonPart: + case kMenulistPart: + case kSearchFieldPart: + case kCheckboxPart: + case kRadioPart: + return LengthBox(0); + default: + return zoomed_box; + } +} + +void LayoutTheme::AdjustControlPartStyle(ComputedStyle& style) { + // Call the appropriate style adjustment method based off the appearance + // value. + switch (style.Appearance()) { + case kCheckboxPart: + return AdjustCheckboxStyle(style); + case kRadioPart: + return AdjustRadioStyle(style); + case kPushButtonPart: + case kSquareButtonPart: + case kButtonPart: + return AdjustButtonStyle(style); + case kInnerSpinButtonPart: + return AdjustInnerSpinButtonStyle(style); + default: + break; + } +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/layout_theme.h b/third_party/blink/renderer/core/layout/layout_theme.h index f5bf39c..926cb549 100644 --- a/third_party/blink/renderer/core/layout/layout_theme.h +++ b/third_party/blink/renderer/core/layout/layout_theme.h
@@ -26,8 +26,11 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/css_value_keywords.h" #include "third_party/blink/renderer/core/scroll/scroll_types.h" +#include "third_party/blink/renderer/platform/fonts/font_description.h" #include "third_party/blink/renderer/platform/fonts/font_selection_types.h" #include "third_party/blink/renderer/platform/geometry/layout_unit.h" +#include "third_party/blink/renderer/platform/geometry/length_box.h" +#include "third_party/blink/renderer/platform/geometry/length_size.h" #include "third_party/blink/renderer/platform/graphics/color.h" #include "third_party/blink/renderer/platform/graphics/color_scheme.h" #include "third_party/blink/renderer/platform/theme_types.h" @@ -48,14 +51,13 @@ class Locale; class Node; class ChromeClient; -class Theme; class ThemePainter; class CORE_EXPORT LayoutTheme : public RefCounted<LayoutTheme> { USING_FAST_MALLOC(LayoutTheme); protected: - explicit LayoutTheme(Theme*); + LayoutTheme(); public: virtual ~LayoutTheme() = default; @@ -101,7 +103,7 @@ // control. This will only be used if a baseline position cannot be determined // by examining child content. // Checkboxes and radio buttons are examples of controls that need to do this. - LayoutUnit BaselinePositionAdjustment(const ComputedStyle&) const; + virtual LayoutUnit BaselinePositionAdjustment(const ComputedStyle&) const; // A method for asking if a control is a container or not. Leaf controls have // to have some special behavior (like the baseline position API above). @@ -115,7 +117,7 @@ // 10.9 checkbox). Add this "visual overflow" to the object's border box rect. virtual void AddVisualOverflow(const Node*, const ComputedStyle&, - IntRect& border_box); + IntRect& border_box) {} // This method is called whenever a control state changes on a particular // themed object, e.g., the mouse becomes pressed or a control becomes @@ -252,6 +254,50 @@ virtual bool ShouldUseFallbackTheme(const ComputedStyle&) const; + // Methods used to adjust the ComputedStyles of controls. + + // The font description result should have a zoomed font size. + virtual FontDescription ControlFont(ControlPart, + const FontDescription& font_description, + float /*zoomFactor*/) const { + return font_description; + } + + // The size here is in zoomed coordinates already. If a new size is returned, + // it also needs to be in zoomed coordinates. + virtual LengthSize GetControlSize(ControlPart, + const FontDescription&, + const LengthSize& zoomed_size, + float /*zoomFactor*/) const { + return zoomed_size; + } + + // Returns the minimum size for a control in zoomed coordinates. + virtual LengthSize MinimumControlSize(ControlPart, + const FontDescription&, + float /*zoomFactor*/) const { + return LengthSize(Length::Fixed(0), Length::Fixed(0)); + } + + // Allows the theme to modify the existing padding/border. + virtual LengthBox ControlPadding(ControlPart, + const FontDescription&, + const Length& zoomed_box_top, + const Length& zoomed_box_right, + const Length& zoomed_box_bottom, + const Length& zoomed_box_left, + float zoom_factor) const; + virtual LengthBox ControlBorder(ControlPart, + const FontDescription&, + const LengthBox& zoomed_box, + float zoom_factor) const; + + // Whether or not whitespace: pre should be forced on always. + virtual bool ControlRequiresPreWhiteSpace(ControlPart) const { return false; } + + // Adjust style as per platform selection. + virtual void AdjustControlPartStyle(ComputedStyle&); + protected: // The platform selection color. virtual Color PlatformActiveSelectionBackgroundColor() const; @@ -286,8 +332,6 @@ void AdjustCheckboxStyleUsingFallbackTheme(ComputedStyle&) const; void AdjustRadioStyleUsingFallbackTheme(ComputedStyle&) const; - bool HasPlatformTheme() const { return platform_theme_; } - public: // Methods for state querying static ControlStates ControlStatesForNode(const Node*, const ComputedStyle&); @@ -318,8 +362,6 @@ static const RGBA32 kDefaultTapHighlightColor = 0x66000000; static const RGBA32 kDefaultCompositionBackgroundColor = 0xFFFFDD55; - - Theme* platform_theme_; // The platform-specific theme. }; } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/layout_theme_default.cc b/third_party/blink/renderer/core/layout/layout_theme_default.cc index 8d1353c..8c7e31d 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_default.cc +++ b/third_party/blink/renderer/core/layout/layout_theme_default.cc
@@ -54,8 +54,7 @@ TimeDelta LayoutThemeDefault::caret_blink_interval_; -LayoutThemeDefault::LayoutThemeDefault() - : LayoutTheme(nullptr), painter_(*this) { +LayoutThemeDefault::LayoutThemeDefault() : LayoutTheme(), painter_(*this) { caret_blink_interval_ = LayoutTheme::CaretBlinkInterval(); }
diff --git a/third_party/blink/renderer/core/layout/layout_theme_mac.h b/third_party/blink/renderer/core/layout/layout_theme_mac.h index 86e4f51..98ea652 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_mac.h +++ b/third_party/blink/renderer/core/layout/layout_theme_mac.h
@@ -31,7 +31,7 @@ #import "third_party/blink/renderer/core/paint/theme_painter_mac.h" #import "third_party/blink/renderer/platform/wtf/hash_map.h" -OBJC_CLASS BlinkLayoutThemeNotificationObserver; +@class BlinkLayoutThemeNotificationObserver; namespace blink { @@ -171,6 +171,90 @@ static const int kSliderTrackWidth = 5; static const int kSliderTrackBorderWidth = 1; + LayoutUnit BaselinePositionAdjustment(const ComputedStyle&) const override; + + FontDescription ControlFont(ControlPart, + const FontDescription&, + float zoom_factor) const override; + + LengthSize GetControlSize(ControlPart, + const FontDescription&, + const LengthSize&, + float zoom_factor) const override; + LengthSize MinimumControlSize(ControlPart, + const FontDescription&, + float zoom_factor) const override; + + LengthBox ControlPadding(ControlPart, + const FontDescription&, + const Length& zoomed_box_top, + const Length& zoomed_box_right, + const Length& zoomed_box_bottom, + const Length& zoomed_box_left, + float zoom_factor) const override; + LengthBox ControlBorder(ControlPart, + const FontDescription&, + const LengthBox& zoomed_box, + float zoom_factor) const override; + + bool ControlRequiresPreWhiteSpace(ControlPart part) const override { + return part == kPushButtonPart; + } + + // Add visual overflow (e.g., the check on an OS X checkbox). The rect passed + // in is in zoomed coordinates so the inflation should take that into account + // and make sure the inflation amount is also scaled by the zoomFactor. + void AddVisualOverflowHelper(ControlPart, + ControlStates, + float zoom_factor, + IntRect& border_box) const; + + // Adjust style as per platform selection. + void AdjustControlPartStyle(ComputedStyle&) override; + + // Function for ThemePainter + static CORE_EXPORT IntRect InflateRect(const IntRect&, + const IntSize&, + const int* margins, + float zoom_level = 1.0f); + + // Inflate an IntRect to account for its focus ring. + // TODO: Consider using computing the focus ring's bounds with + // -[NSCell focusRingMaskBoundsForFrame:inView:]). + static CORE_EXPORT IntRect InflateRectForFocusRing(const IntRect&); + + static CORE_EXPORT LengthSize CheckboxSize(const FontDescription&, + const LengthSize& zoomed_size, + float zoom_factor); + static CORE_EXPORT NSButtonCell* Checkbox(ControlStates, + const IntRect& zoomed_rect, + float zoom_factor); + static CORE_EXPORT const IntSize* CheckboxSizes(); + static CORE_EXPORT const int* CheckboxMargins(NSControlSize); + static CORE_EXPORT NSView* EnsuredView(const IntSize&); + + static CORE_EXPORT const IntSize* RadioSizes(); + static CORE_EXPORT const int* RadioMargins(NSControlSize); + static CORE_EXPORT LengthSize RadioSize(const FontDescription&, + const LengthSize& zoomed_size, + float zoom_factor); + static CORE_EXPORT NSButtonCell* Radio(ControlStates, + const IntRect& zoomed_rect, + float zoom_factor); + + static CORE_EXPORT const IntSize* ButtonSizes(); + static CORE_EXPORT const int* ButtonMargins(NSControlSize); + static CORE_EXPORT NSButtonCell* Button(ControlPart, + ControlStates, + const IntRect& zoomed_rect, + float zoom_factor); + + static CORE_EXPORT NSControlSize + ControlSizeFromPixelSize(const IntSize* sizes, + const IntSize& min_zoomed_size, + float zoom_factor); + static CORE_EXPORT const IntSize* StepperSizes(); + protected: String ExtraFullscreenStyleSheet() override;
diff --git a/third_party/blink/renderer/core/layout/layout_theme_mac.mm b/third_party/blink/renderer/core/layout/layout_theme_mac.mm index 5fa4a87..029aae2 100644 --- a/third_party/blink/renderer/core/layout/layout_theme_mac.mm +++ b/third_party/blink/renderer/core/layout/layout_theme_mac.mm
@@ -36,15 +36,33 @@ #import "third_party/blink/renderer/platform/data_resource_helper.h" #import "third_party/blink/renderer/platform/fonts/string_truncator.h" #import "third_party/blink/renderer/platform/graphics/bitmap_image.h" +#import "third_party/blink/renderer/platform/mac/block_exceptions.h" #import "third_party/blink/renderer/platform/mac/color_mac.h" -#import "third_party/blink/renderer/platform/mac/theme_mac.h" #import "third_party/blink/renderer/platform/mac/version_util_mac.h" #import "third_party/blink/renderer/platform/mac/web_core_ns_cell_extras.h" #import "third_party/blink/renderer/platform/runtime_enabled_features.h" #import "third_party/blink/renderer/platform/text/platform_locale.h" -#import "third_party/blink/renderer/platform/theme.h" #import "third_party/blink/renderer/platform/web_test_support.h" +// This is a view whose sole purpose is to tell AppKit that it's flipped. +@interface BlinkFlippedControl : NSControl +@end + +@implementation BlinkFlippedControl + +- (BOOL)isFlipped { + return YES; +} + +- (NSText*)currentEditor { + return nil; +} + +- (BOOL)_automaticFocusRingDisabled { + return YES; +} + +@end // The methods in this file are specific to the Mac OS X platform. @interface BlinkLayoutThemeNotificationObserver : NSObject { @@ -120,6 +138,9 @@ namespace { +// Inflate an IntRect to account for specific padding around margins. +enum { kTopMargin = 0, kRightMargin = 1, kBottomMargin = 2, kLeftMargin = 3 }; + bool FontSizeMatchesToControlSize(const ComputedStyle& style) { int font_size = style.FontSize(); if (font_size == [NSFont systemFontSizeForControlSize:NSRegularControlSize]) @@ -140,10 +161,44 @@ return sandbox_support->GetSystemColor(color_id); } +// Helper functions used by a bunch of different control parts. +NSControlSize ControlSizeForFont(const FontDescription& font_description) { + int font_size = font_description.ComputedPixelSize(); + if (font_size >= 16) + return NSRegularControlSize; + if (font_size >= 11) + return NSSmallControlSize; + return NSMiniControlSize; +} + +LengthSize SizeFromNSControlSize(NSControlSize ns_control_size, + const LengthSize& zoomed_size, + float zoom_factor, + const IntSize* sizes) { + IntSize control_size = sizes[ns_control_size]; + if (zoom_factor != 1.0f) + control_size = IntSize(control_size.Width() * zoom_factor, + control_size.Height() * zoom_factor); + LengthSize result = zoomed_size; + if (zoomed_size.Width().IsIntrinsicOrAuto() && control_size.Width() > 0) + result.SetWidth(Length::Fixed(control_size.Width())); + if (zoomed_size.Height().IsIntrinsicOrAuto() && control_size.Height() > 0) + result.SetHeight(Length::Fixed(control_size.Height())); + return result; +} + +LengthSize SizeFromFont(const FontDescription& font_description, + const LengthSize& zoomed_size, + float zoom_factor, + const IntSize* sizes) { + return SizeFromNSControlSize(ControlSizeForFont(font_description), + zoomed_size, zoom_factor, sizes); +} + } // namespace LayoutThemeMac::LayoutThemeMac() - : LayoutTheme(PlatformTheme()), + : LayoutTheme(), notification_observer_( [[BlinkLayoutThemeNotificationObserver alloc] initWithTheme:this]), painter_(*this) { @@ -426,19 +481,18 @@ const ComputedStyle& style, IntRect& rect) { ControlPart part = style.Appearance(); - - if (HasPlatformTheme()) { - switch (part) { - case kCheckboxPart: - case kRadioPart: - case kPushButtonPart: - case kSquareButtonPart: - case kButtonPart: - case kInnerSpinButtonPart: - return LayoutTheme::AddVisualOverflow(node, style, rect); - default: - break; - } + switch (part) { + case kCheckboxPart: + case kRadioPart: + case kPushButtonPart: + case kSquareButtonPart: + case kButtonPart: + case kInnerSpinButtonPart: + return AddVisualOverflowHelper(style.Appearance(), + ControlStatesForNode(node, style), + style.EffectiveZoom(), rect); + default: + break; } float zoom_level = style.EffectiveZoom(); @@ -448,7 +502,7 @@ IntSize size = PopupButtonSizes()[[PopupButton() controlSize]]; size.SetHeight(size.Height() * zoom_level); size.SetWidth(rect.Width()); - rect = ThemeMac::InflateRect(rect, size, PopupButtonMargins(), zoom_level); + rect = InflateRect(rect, size, PopupButtonMargins(), zoom_level); } else if (part == kSliderThumbHorizontalPart || part == kSliderThumbVerticalPart) { rect.SetHeight(rect.Height() + kSliderThumbShadowBlur); @@ -672,8 +726,7 @@ int LayoutThemeMac::PopupInternalPaddingStart( const ComputedStyle& style) const { if (style.Appearance() == kMenulistPart) - return PopupButtonPadding( - ControlSizeForFont(style))[ThemeMac::kLeftMargin] * + return PopupButtonPadding(ControlSizeForFont(style))[kLeftMargin] * style.EffectiveZoom(); if (style.Appearance() == kMenulistButtonPart) return kStyledPopupPaddingStart * style.EffectiveZoom(); @@ -683,8 +736,7 @@ int LayoutThemeMac::PopupInternalPaddingEnd(const ChromeClient*, const ComputedStyle& style) const { if (style.Appearance() == kMenulistPart) - return PopupButtonPadding( - ControlSizeForFont(style))[ThemeMac::kRightMargin] * + return PopupButtonPadding(ControlSizeForFont(style))[kRightMargin] * style.EffectiveZoom(); if (style.Appearance() != kMenulistButtonPart) return 0; @@ -697,7 +749,7 @@ int LayoutThemeMac::PopupInternalPaddingTop(const ComputedStyle& style) const { if (style.Appearance() == kMenulistPart) - return PopupButtonPadding(ControlSizeForFont(style))[ThemeMac::kTopMargin] * + return PopupButtonPadding(ControlSizeForFont(style))[kTopMargin] * style.EffectiveZoom(); if (style.Appearance() == kMenulistButtonPart) return kStyledPopupPaddingTop * style.EffectiveZoom(); @@ -707,8 +759,7 @@ int LayoutThemeMac::PopupInternalPaddingBottom( const ComputedStyle& style) const { if (style.Appearance() == kMenulistPart) - return PopupButtonPadding( - ControlSizeForFont(style))[ThemeMac::kBottomMargin] * + return PopupButtonPadding(ControlSizeForFont(style))[kBottomMargin] * style.EffectiveZoom(); if (style.Appearance() == kMenulistButtonPart) return kStyledPopupPaddingBottom * style.EffectiveZoom(); @@ -1041,4 +1092,569 @@ return false; } +// We don't use controlSizeForFont() for steppers because the stepper height +// should be equal to or less than the corresponding text field height, +static NSControlSize StepperControlSizeForFont( + const FontDescription& font_description) { + int font_size = font_description.ComputedPixelSize(); + if (font_size >= 27) + return NSRegularControlSize; + if (font_size >= 22) + return NSSmallControlSize; + return NSMiniControlSize; +} + +NSControlSize LayoutThemeMac::ControlSizeFromPixelSize( + const IntSize* sizes, + const IntSize& min_zoomed_size, + float zoom_factor) { + if (min_zoomed_size.Width() >= + static_cast<int>(sizes[NSRegularControlSize].Width() * zoom_factor) && + min_zoomed_size.Height() >= + static_cast<int>(sizes[NSRegularControlSize].Height() * zoom_factor)) + return NSRegularControlSize; + if (min_zoomed_size.Width() >= + static_cast<int>(sizes[NSSmallControlSize].Width() * zoom_factor) && + min_zoomed_size.Height() >= + static_cast<int>(sizes[NSSmallControlSize].Height() * zoom_factor)) + return NSSmallControlSize; + return NSMiniControlSize; +} + +static void SetControlSizeThemeMac(NSCell* cell, + const IntSize* sizes, + const IntSize& min_zoomed_size, + float zoom_factor) { + ControlSize size = LayoutThemeMac::ControlSizeFromPixelSize( + sizes, min_zoomed_size, zoom_factor); + // Only update if we have to, since AppKit does work even if the size is the + // same. + if (size != [cell controlSize]) + [cell setControlSize:(NSControlSize)size]; +} + +static void UpdateStates(NSCell* cell, ControlStates states) { + // Hover state is not supported by Aqua. + + // Pressed state + bool old_pressed = [cell isHighlighted]; + bool pressed = states & kPressedControlState; + if (pressed != old_pressed) + [cell setHighlighted:pressed]; + + // Enabled state + bool old_enabled = [cell isEnabled]; + bool enabled = states & kEnabledControlState; + if (enabled != old_enabled) + [cell setEnabled:enabled]; + + // Checked and Indeterminate + bool old_indeterminate = [cell state] == NSMixedState; + bool indeterminate = (states & kIndeterminateControlState); + bool checked = states & kCheckedControlState; + bool old_checked = [cell state] == NSOnState; + if (old_indeterminate != indeterminate || checked != old_checked) + [cell setState:indeterminate ? NSMixedState + : (checked ? NSOnState : NSOffState)]; + + // Window inactive state does not need to be checked explicitly, since we + // paint parented to a view in a window whose key state can be detected. +} + +// Return a fake NSView whose sole purpose is to tell AppKit that it's flipped. +NSView* LayoutThemeMac::EnsuredView(const IntSize& size) { + // Use a fake flipped view. + static NSView* flipped_view = [[BlinkFlippedControl alloc] init]; + [flipped_view setFrameSize:NSSizeFromCGSize(CGSize(size))]; + + return flipped_view; +} + +LayoutUnit LayoutThemeMac::BaselinePositionAdjustment( + const ComputedStyle& style) const { + ControlPart part = style.Appearance(); + if (part == kCheckboxPart || part == kRadioPart) + return LayoutUnit(style.EffectiveZoom() * -2); + return LayoutTheme::BaselinePositionAdjustment(style); +} + +FontDescription LayoutThemeMac::ControlFont( + ControlPart part, + const FontDescription& font_description, + float zoom_factor) const { + using ::blink::ControlSizeForFont; + switch (part) { + case kPushButtonPart: { + FontDescription result; + result.SetIsAbsoluteSize(true); + result.SetGenericFamily(FontDescription::kSerifFamily); + + NSFont* ns_font = [NSFont + systemFontOfSize:[NSFont systemFontSizeForControlSize: + ControlSizeForFont(font_description)]]; + result.FirstFamily().SetFamily(font_family_names::kSystemUi); + result.SetComputedSize([ns_font pointSize] * zoom_factor); + result.SetSpecifiedSize([ns_font pointSize] * zoom_factor); + return result; + } + default: + return LayoutTheme::ControlFont(part, font_description, zoom_factor); + } +} + +LengthSize LayoutThemeMac::GetControlSize( + ControlPart part, + const FontDescription& font_description, + const LengthSize& zoomed_size, + float zoom_factor) const { + switch (part) { + case kCheckboxPart: + return CheckboxSize(font_description, zoomed_size, zoom_factor); + case kRadioPart: + return RadioSize(font_description, zoomed_size, zoom_factor); + case kPushButtonPart: + // Height is reset to auto so that specified heights can be ignored. + return SizeFromFont(font_description, + LengthSize(zoomed_size.Width(), Length()), + zoom_factor, ButtonSizes()); + case kInnerSpinButtonPart: + if (!zoomed_size.Width().IsIntrinsicOrAuto() && + !zoomed_size.Height().IsIntrinsicOrAuto()) + return zoomed_size; + return SizeFromNSControlSize(StepperControlSizeForFont(font_description), + zoomed_size, zoom_factor, StepperSizes()); + default: + return zoomed_size; + } +} + +LengthSize LayoutThemeMac::MinimumControlSize( + ControlPart part, + const FontDescription& font_description, + float zoom_factor) const { + switch (part) { + case kSquareButtonPart: + case kButtonPart: + return LengthSize(Length::Fixed(0), + Length::Fixed(static_cast<int>(15 * zoom_factor))); + case kInnerSpinButtonPart: { + IntSize base = StepperSizes()[NSMiniControlSize]; + return LengthSize( + Length::Fixed(static_cast<int>(base.Width() * zoom_factor)), + Length::Fixed(static_cast<int>(base.Height() * zoom_factor))); + } + default: + return LayoutTheme::MinimumControlSize(part, font_description, + zoom_factor); + } +} + +LengthBox LayoutThemeMac::ControlPadding( + ControlPart part, + const FontDescription& font_description, + const Length& zoomed_box_top, + const Length& zoomed_box_right, + const Length& zoomed_box_bottom, + const Length& zoomed_box_left, + float zoom_factor) const { + switch (part) { + case kPushButtonPart: { + // Just use 8px. AppKit wants to use 11px for mini buttons, but that + // padding is just too large for real-world Web sites (creating a huge + // necessary minimum width for buttons whose space is by definition + // constrained, since we select mini only for small cramped environments. + // This also guarantees the HTML <button> will match our rendering by + // default, since we're using a consistent padding. + const int padding = 8 * zoom_factor; + return LengthBox(2, padding, 3, padding); + } + default: + return LayoutTheme::ControlPadding(part, font_description, zoomed_box_top, + zoomed_box_right, zoomed_box_bottom, + zoomed_box_left, zoom_factor); + } +} + +LengthBox LayoutThemeMac::ControlBorder(ControlPart part, + const FontDescription& font_description, + const LengthBox& zoomed_box, + float zoom_factor) const { + switch (part) { + case kSquareButtonPart: + return LengthBox(0, zoomed_box.Right().Value(), 0, + zoomed_box.Left().Value()); + default: + return LayoutTheme::ControlBorder(part, font_description, zoomed_box, + zoom_factor); + } +} + +void LayoutThemeMac::AddVisualOverflowHelper(ControlPart part, + ControlStates states, + float zoom_factor, + IntRect& zoomed_rect) const { + BEGIN_BLOCK_OBJC_EXCEPTIONS + switch (part) { + case kCheckboxPart: { + // We inflate the rect as needed to account for padding included in the + // cell to accommodate the checkbox shadow" and the check. We don't + // consider this part of the bounds of the control in WebKit. + NSCell* cell = Checkbox(states, zoomed_rect, zoom_factor); + NSControlSize control_size = [cell controlSize]; + IntSize zoomed_size = CheckboxSizes()[control_size]; + zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); + zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); + zoomed_rect = InflateRect(zoomed_rect, zoomed_size, + CheckboxMargins(control_size), zoom_factor); + break; + } + case kRadioPart: { + // We inflate the rect as needed to account for padding included in the + // cell to accommodate the radio button shadow". We don't consider this + // part of the bounds of the control in WebKit. + NSCell* cell = Radio(states, zoomed_rect, zoom_factor); + NSControlSize control_size = [cell controlSize]; + IntSize zoomed_size = RadioSizes()[control_size]; + zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); + zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); + zoomed_rect = InflateRect(zoomed_rect, zoomed_size, + RadioMargins(control_size), zoom_factor); + break; + } + case kPushButtonPart: + case kButtonPart: { + NSButtonCell* cell = Button(part, states, zoomed_rect, zoom_factor); + NSControlSize control_size = [cell controlSize]; + + // We inflate the rect as needed to account for the Aqua button's shadow. + if ([cell bezelStyle] == NSRoundedBezelStyle) { + IntSize zoomed_size = ButtonSizes()[control_size]; + zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); + // Buttons don't ever constrain width, so the zoomed width can just be + // honored. + zoomed_size.SetWidth(zoomed_rect.Width()); + zoomed_rect = InflateRect(zoomed_rect, zoomed_size, + ButtonMargins(control_size), zoom_factor); + } + break; + } + case kInnerSpinButtonPart: { + static const int kStepperMargin[4] = {0, 0, 0, 0}; + ControlSize control_size = ControlSizeFromPixelSize( + StepperSizes(), zoomed_rect.Size(), zoom_factor); + IntSize zoomed_size = StepperSizes()[control_size]; + zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); + zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); + zoomed_rect = + InflateRect(zoomed_rect, zoomed_size, kStepperMargin, zoom_factor); + break; + } + default: + break; + } + END_BLOCK_OBJC_EXCEPTIONS +} + +void LayoutThemeMac::AdjustControlPartStyle(ComputedStyle& style) { + ControlPart part = style.Appearance(); + switch (part) { + case kCheckboxPart: + case kInnerSpinButtonPart: + case kRadioPart: + case kPushButtonPart: + case kSquareButtonPart: + case kButtonPart: { + // Border + LengthBox border_box(style.BorderTopWidth(), style.BorderRightWidth(), + style.BorderBottomWidth(), style.BorderLeftWidth()); + border_box = ControlBorder(part, style.GetFont().GetFontDescription(), + border_box, style.EffectiveZoom()); + if (border_box.Top().Value() != + static_cast<int>(style.BorderTopWidth())) { + if (border_box.Top().Value()) + style.SetBorderTopWidth(border_box.Top().Value()); + else + style.ResetBorderTop(); + } + if (border_box.Right().Value() != + static_cast<int>(style.BorderRightWidth())) { + if (border_box.Right().Value()) + style.SetBorderRightWidth(border_box.Right().Value()); + else + style.ResetBorderRight(); + } + if (border_box.Bottom().Value() != + static_cast<int>(style.BorderBottomWidth())) { + style.SetBorderBottomWidth(border_box.Bottom().Value()); + if (border_box.Bottom().Value()) + style.SetBorderBottomWidth(border_box.Bottom().Value()); + else + style.ResetBorderBottom(); + } + if (border_box.Left().Value() != + static_cast<int>(style.BorderLeftWidth())) { + style.SetBorderLeftWidth(border_box.Left().Value()); + if (border_box.Left().Value()) + style.SetBorderLeftWidth(border_box.Left().Value()); + else + style.ResetBorderLeft(); + } + + // Padding + LengthBox padding_box = ControlPadding( + part, style.GetFont().GetFontDescription(), style.PaddingTop(), + style.PaddingRight(), style.PaddingBottom(), style.PaddingLeft(), + style.EffectiveZoom()); + if (!style.PaddingEqual(padding_box)) + style.SetPadding(padding_box); + + // Whitespace + if (ControlRequiresPreWhiteSpace(part)) + style.SetWhiteSpace(EWhiteSpace::kPre); + + // Width / Height + // The width and height here are affected by the zoom. + // FIXME: Check is flawed, since it doesn't take min-width/max-width + // into account. + LengthSize control_size = GetControlSize( + part, style.GetFont().GetFontDescription(), + LengthSize(style.Width(), style.Height()), style.EffectiveZoom()); + + LengthSize min_control_size = MinimumControlSize( + part, style.GetFont().GetFontDescription(), style.EffectiveZoom()); + + // Only potentially set min-size to |control_size| for these parts. + if (part == kCheckboxPart || part == kRadioPart) + SetMinimumSize(style, &control_size, &min_control_size); + else + SetMinimumSize(style, nullptr, &min_control_size); + + if (control_size.Width() != style.Width()) + style.SetWidth(control_size.Width()); + if (control_size.Height() != style.Height()) + style.SetHeight(control_size.Height()); + + // Font + FontDescription control_font = ControlFont( + part, style.GetFont().GetFontDescription(), style.EffectiveZoom()); + if (control_font != style.GetFont().GetFontDescription()) { + // Reset our line-height + style.SetLineHeight(ComputedStyleInitialValues::InitialLineHeight()); + + // Now update our font. + if (style.SetFontDescription(control_font)) + style.GetFont().Update(nullptr); + } + break; + } + case kProgressBarPart: + AdjustProgressBarBounds(style); + break; + default: + break; + } +} + +// static +IntRect LayoutThemeMac::InflateRect(const IntRect& zoomed_rect, + const IntSize& zoomed_size, + const int* margins, + float zoom_factor) { + // Only do the inflation if the available width/height are too small. + // Otherwise try to fit the glow/check space into the available box's + // width/height. + int width_delta = zoomed_rect.Width() - + (zoomed_size.Width() + margins[kLeftMargin] * zoom_factor + + margins[kRightMargin] * zoom_factor); + int height_delta = zoomed_rect.Height() - + (zoomed_size.Height() + margins[kTopMargin] * zoom_factor + + margins[kBottomMargin] * zoom_factor); + IntRect result(zoomed_rect); + if (width_delta < 0) { + result.SetX(result.X() - margins[kLeftMargin] * zoom_factor); + result.SetWidth(result.Width() - width_delta); + } + if (height_delta < 0) { + result.SetY(result.Y() - margins[kTopMargin] * zoom_factor); + result.SetHeight(result.Height() - height_delta); + } + return result; +} + +// static +IntRect LayoutThemeMac::InflateRectForFocusRing(const IntRect& rect) { + // Just put a margin of 16 units around the rect. The UI elements that use + // this don't appropriately scale their focus rings appropriately (e.g, paint + // pickers), or switch to non-native widgets when scaled (e.g, check boxes + // and radio buttons). + const int kMargin = 16; + IntRect result; + result.SetX(rect.X() - kMargin); + result.SetY(rect.Y() - kMargin); + result.SetWidth(rect.Width() + 2 * kMargin); + result.SetHeight(rect.Height() + 2 * kMargin); + return result; +} + +// Checkboxes + +const IntSize* LayoutThemeMac::CheckboxSizes() { + static const IntSize kSizes[3] = {IntSize(14, 14), IntSize(12, 12), + IntSize(10, 10)}; + return kSizes; +} + +const int* LayoutThemeMac::CheckboxMargins(NSControlSize control_size) { + static const int kMargins[3][4] = { + {3, 4, 4, 2}, + {4, 3, 3, 3}, + {4, 3, 3, 3}, + }; + return kMargins[control_size]; +} + +LengthSize LayoutThemeMac::CheckboxSize(const FontDescription& font_description, + const LengthSize& zoomed_size, + float zoom_factor) { + // If the width and height are both specified, then we have nothing to do. + if (!zoomed_size.Width().IsIntrinsicOrAuto() && + !zoomed_size.Height().IsIntrinsicOrAuto()) + return zoomed_size; + + // Use the font size to determine the intrinsic width of the control. + return SizeFromFont(font_description, zoomed_size, zoom_factor, + CheckboxSizes()); +} + +NSButtonCell* LayoutThemeMac::Checkbox(ControlStates states, + const IntRect& zoomed_rect, + float zoom_factor) { + static NSButtonCell* checkbox_cell; + if (!checkbox_cell) { + checkbox_cell = [[NSButtonCell alloc] init]; + [checkbox_cell setButtonType:NSSwitchButton]; + [checkbox_cell setTitle:nil]; + [checkbox_cell setAllowsMixedState:YES]; + [checkbox_cell setFocusRingType:NSFocusRingTypeExterior]; + } + + // Set the control size based off the rectangle we're painting into. + SetControlSizeThemeMac(checkbox_cell, CheckboxSizes(), zoomed_rect.Size(), + zoom_factor); + + // Update the various states we respond to. + UpdateStates(checkbox_cell, states); + + return checkbox_cell; +} + +const IntSize* LayoutThemeMac::RadioSizes() { + static const IntSize kSizes[3] = {IntSize(14, 15), IntSize(12, 13), + IntSize(10, 10)}; + return kSizes; +} + +const int* LayoutThemeMac::RadioMargins(NSControlSize control_size) { + static const int kMargins[3][4] = { + {2, 2, 4, 2}, + {3, 2, 3, 2}, + {1, 0, 2, 0}, + }; + return kMargins[control_size]; +} + +LengthSize LayoutThemeMac::RadioSize(const FontDescription& font_description, + const LengthSize& zoomed_size, + float zoom_factor) { + // If the width and height are both specified, then we have nothing to do. + if (!zoomed_size.Width().IsIntrinsicOrAuto() && + !zoomed_size.Height().IsIntrinsicOrAuto()) + return zoomed_size; + + // Use the font size to determine the intrinsic width of the control. + return SizeFromFont(font_description, zoomed_size, zoom_factor, RadioSizes()); +} + +NSButtonCell* LayoutThemeMac::Radio(ControlStates states, + const IntRect& zoomed_rect, + float zoom_factor) { + static NSButtonCell* radio_cell; + if (!radio_cell) { + radio_cell = [[NSButtonCell alloc] init]; + [radio_cell setButtonType:NSRadioButton]; + [radio_cell setTitle:nil]; + [radio_cell setFocusRingType:NSFocusRingTypeExterior]; + } + + // Set the control size based off the rectangle we're painting into. + SetControlSizeThemeMac(radio_cell, RadioSizes(), zoomed_rect.Size(), + zoom_factor); + + // Update the various states we respond to. + // Cocoa draws NSMixedState NSRadioButton as NSOnState so we don't want that. + states &= ~kIndeterminateControlState; + UpdateStates(radio_cell, states); + + return radio_cell; +} + +// Buttons really only constrain height. They respect width. +const IntSize* LayoutThemeMac::ButtonSizes() { + static const IntSize kSizes[3] = {IntSize(0, 21), IntSize(0, 18), + IntSize(0, 15)}; + return kSizes; +} + +const int* LayoutThemeMac::ButtonMargins(NSControlSize control_size) { + static const int kMargins[3][4] = { + {4, 6, 7, 6}, + {4, 5, 6, 5}, + {0, 1, 1, 1}, + }; + return kMargins[control_size]; +} + +static void SetUpButtonCell(NSButtonCell* cell, + ControlPart part, + ControlStates states, + const IntRect& zoomed_rect, + float zoom_factor) { + // Set the control size based off the rectangle we're painting into. + const IntSize* sizes = LayoutThemeMac::ButtonSizes(); + if (part == kSquareButtonPart || + zoomed_rect.Height() > + LayoutThemeMac::ButtonSizes()[NSRegularControlSize].Height() * + zoom_factor) { + // Use the square button + if ([cell bezelStyle] != NSShadowlessSquareBezelStyle) + [cell setBezelStyle:NSShadowlessSquareBezelStyle]; + } else if ([cell bezelStyle] != NSRoundedBezelStyle) + [cell setBezelStyle:NSRoundedBezelStyle]; + + SetControlSizeThemeMac(cell, sizes, zoomed_rect.Size(), zoom_factor); + + // Update the various states we respond to. + UpdateStates(cell, states); +} + +NSButtonCell* LayoutThemeMac::Button(ControlPart part, + ControlStates states, + const IntRect& zoomed_rect, + float zoom_factor) { + static NSButtonCell* cell = nil; + if (!cell) { + cell = [[NSButtonCell alloc] init]; + [cell setTitle:nil]; + [cell setButtonType:NSMomentaryPushInButton]; + } + SetUpButtonCell(cell, part, states, zoomed_rect, zoom_factor); + return cell; +} + +const IntSize* LayoutThemeMac::StepperSizes() { + static const IntSize kSizes[3] = {IntSize(19, 27), IntSize(15, 22), + IntSize(13, 15)}; + return kSizes; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc index ace7c5ff..e2c22b7 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_node_test.cc
@@ -45,7 +45,7 @@ LayoutObject* layout_object = nullptr) { NGInlineNodeData* data = MutableData(); unsigned start = data->text_content.length(); - data->text_content.append(text); + data->text_content = data->text_content + text; data->items.push_back(NGInlineItem(NGInlineItem::kText, start, start + text.length(), style, layout_object)); @@ -54,7 +54,7 @@ void Append(UChar character) { NGInlineNodeData* data = MutableData(); - data->text_content.append(character); + data->text_content = data->text_content + character; unsigned end = data->text_content.length(); data->items.push_back( NGInlineItem(NGInlineItem::kBidiControl, end - 1, end, nullptr));
diff --git a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc index c6c7084..98f0768 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_flex_layout_algorithm.cc
@@ -86,11 +86,11 @@ NGBoxStrut border_padding_in_child_writing_mode = ComputeBorders(child_space, child) + - ComputePadding(child_space, child_style); + ComputePadding(child_space, child_style) + child.GetScrollbarSizes(); NGPhysicalBoxStrut physical_border_padding( border_padding_in_child_writing_mode.ConvertToPhysical( child_style.GetWritingMode(), child_style.Direction())); - LayoutUnit main_axis_border_and_padding = + LayoutUnit main_axis_border_scrollbar_padding = is_horizontal_flow ? physical_border_padding.HorizontalSum() : physical_border_padding.VerticalSum(); @@ -136,10 +136,8 @@ // Spec calls this "flex base size" // https://www.w3.org/TR/css-flexbox-1/#algo-main-item - // Blink's FlexibleBoxAlgorithm expects it to be content + scrollbar widths, - // but no padding or border. LayoutUnit flex_base_content_size = - flex_base_border_box - main_axis_border_and_padding; + flex_base_border_box - main_axis_border_scrollbar_padding; NGPhysicalBoxStrut physical_child_margins = ComputePhysicalMargins(child_space, child_style); @@ -184,7 +182,7 @@ algorithm_ ->emplace_back(child.GetLayoutBox(), flex_base_content_size, min_max_sizes_in_main_axis_direction, - main_axis_border_and_padding, main_axis_margin) + main_axis_border_scrollbar_padding, main_axis_margin) .ng_input_node = child; } } @@ -231,12 +229,14 @@ NGLogicalSize available_size; if (is_column_) { available_size.inline_size = content_box_size_.inline_size; - available_size.block_size = flex_item.flexed_content_size + - flex_item.main_axis_border_and_padding; + available_size.block_size = + flex_item.flexed_content_size + + flex_item.main_axis_border_scrollbar_padding; space_builder.SetIsFixedSizeBlock(true); } else { - available_size.inline_size = flex_item.flexed_content_size + - flex_item.main_axis_border_and_padding; + available_size.inline_size = + flex_item.flexed_content_size + + flex_item.main_axis_border_scrollbar_padding; available_size.block_size = content_box_size_.block_size; space_builder.SetIsFixedSizeInline(true); } @@ -311,9 +311,10 @@ SetOrthogonalFallbackInlineSizeIfNeeded( Style(), flex_item.ng_input_node, &space_builder); - NGLogicalSize available_size(flex_item.flexed_content_size + - flex_item.main_axis_border_and_padding, - flex_item.cross_axis_size); + NGLogicalSize available_size( + flex_item.flexed_content_size + + flex_item.main_axis_border_scrollbar_padding, + flex_item.cross_axis_size); if (is_column_) available_size.Flip(); space_builder.SetAvailableSize(available_size);
diff --git a/third_party/blink/renderer/core/layout/ng/ng_inline_layout_test.cc b/third_party/blink/renderer/core/layout/ng/ng_inline_layout_test.cc index 226d7ef8..cc971a2f 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_inline_layout_test.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_inline_layout_test.cc
@@ -77,11 +77,12 @@ NGBlockLayoutAlgorithm(node, constraint_space).Layout(); EXPECT_TRUE(result); - String expected_text("Hello "); - expected_text.append(kObjectReplacementCharacter); - expected_text.append("."); + StringBuilder expected_text; + expected_text.Append("Hello "); + expected_text.Append(kObjectReplacementCharacter); + expected_text.Append('.'); auto first_child = To<NGInlineNode>(node.FirstChild()); - EXPECT_EQ(expected_text, + EXPECT_EQ(expected_text.ToString(), StringView(first_child.ItemsData(false).text_content, 0, 8)); // Delete the line box tree to avoid leaks in the test.
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h index ababbe0..afe4b50 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/script/modulator.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/kurl_hash.h" @@ -126,7 +125,7 @@ // Correspond to _result_ in // https://html.spec.whatwg.org/C/#internal-module-script-graph-fetching-procedure - TraceWrapperMember<ModuleScript> result_; + Member<ModuleScript> result_; bool found_parse_error_ = false;
diff --git a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker_registry.h b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker_registry.h index a0a0f7a..442e8b0 100644 --- a/third_party/blink/renderer/core/loader/modulescript/module_tree_linker_registry.h +++ b/third_party/blink/renderer/core/loader/modulescript/module_tree_linker_registry.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -31,7 +30,7 @@ void AddFetcher(ModuleTreeLinker*); void ReleaseFinishedFetcher(ModuleTreeLinker*); - HeapHashSet<TraceWrapperMember<ModuleTreeLinker>> active_tree_linkers_; + HeapHashSet<Member<ModuleTreeLinker>> active_tree_linkers_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/ping_loader.cc b/third_party/blink/renderer/core/loader/ping_loader.cc index 77ce4b08..cd198a0d 100644 --- a/third_party/blink/renderer/core/loader/ping_loader.cc +++ b/third_party/blink/renderer/core/loader/ping_loader.cc
@@ -51,7 +51,6 @@ #include "third_party/blink/renderer/platform/network/parsed_content_type.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/compiler.h" #include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/resource/font_resource.cc b/third_party/blink/renderer/core/loader/resource/font_resource.cc index 4a1561c..71545e7b 100644 --- a/third_party/blink/renderer/core/loader/resource/font_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/font_resource.cc
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader.h" #include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/time.h" namespace blink {
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource.cc b/third_party/blink/renderer/core/loader/resource/image_resource.cc index 6260074..85dd5d5 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource.cc
@@ -50,6 +50,7 @@ #include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/security_violation_reporting_policy.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/time.h" #include "v8/include/v8.h"
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc index 24b9e00..a5e9351 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_content.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource_content.cc
@@ -527,9 +527,13 @@ } if (MIMETypeRegistry::IsLosslessImageMIMEType(mime_type)) { // Enforce the lossless image policy. - return context.IsFeatureEnabled( + bool enabled_by_10k_policy = context.IsFeatureEnabled( mojom::FeaturePolicyFeature::kUnoptimizedLosslessImages, PolicyValue(compression_ratio_10k), ReportOptions::kReportOnFailure); + bool enabled_by_1k_policy = context.IsFeatureEnabled( + mojom::FeaturePolicyFeature::kUnoptimizedLosslessImagesStrict, + PolicyValue(compression_ratio_1k), ReportOptions::kReportOnFailure); + return enabled_by_10k_policy && enabled_by_1k_policy; } return true;
diff --git a/third_party/blink/renderer/core/loader/resource/image_resource_test.cc b/third_party/blink/renderer/core/loader/resource/image_resource_test.cc index 987dd75..9a4ce34 100644 --- a/third_party/blink/renderer/core/loader/resource/image_resource_test.cc +++ b/third_party/blink/renderer/core/loader/resource/image_resource_test.cc
@@ -1987,8 +1987,7 @@ void CreateImageResource(const char* url_part, bool ua_resource) { // Create a unique fake data url. - String url("data:image/png;base64,"); - url.append(url_part); + String url = StringView("data:image/png;base64,") + url_part; // Setup the fetcher and request. ResourceFetcher* fetcher = CreateFetcher();
diff --git a/third_party/blink/renderer/core/loader/resource/script_resource.cc b/third_party/blink/renderer/core/loader/resource/script_resource.cc index dc76a049..e60593d4 100644 --- a/third_party/blink/renderer/core/loader/resource/script_resource.cc +++ b/third_party/blink/renderer/core/loader/resource/script_resource.cc
@@ -48,6 +48,7 @@ #include "third_party/blink/renderer/platform/network/mime/mime_type_registry.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/shared_buffer.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" namespace blink {
diff --git a/third_party/blink/renderer/core/mojo/mojo_watcher.h b/third_party/blink/renderer/core/mojo/mojo_watcher.h index 2b4523c..8fc307a 100644 --- a/third_party/blink/renderer/core/mojo/mojo_watcher.h +++ b/third_party/blink/renderer/core/mojo/mojo_watcher.h
@@ -10,7 +10,6 @@ #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -53,7 +52,7 @@ void RunReadyCallback(MojoResult); scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - TraceWrapperMember<V8MojoWatchCallback> callback_; + Member<V8MojoWatchCallback> callback_; mojo::ScopedTrapHandle trap_handle_; mojo::Handle handle_; };
diff --git a/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc b/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc index 21a4f5e5..57bb825 100644 --- a/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc +++ b/third_party/blink/renderer/core/mojo/tests/js_to_cpp_test.cc
@@ -52,22 +52,16 @@ #define EXPECT_NAN(x) EXPECT_NE(x, x) String MojoBindingsScriptPath() { - String filepath = test::ExecutableDir(); - filepath.append("/gen/mojo/public/js/mojo_bindings.js"); - return filepath; + return test::ExecutableDir() + "/gen/mojo/public/js/mojo_bindings.js"; } String TestBindingsScriptPath() { - String filepath = test::ExecutableDir(); - filepath.append( - "/gen/third_party/blink/renderer/core/mojo/tests/JsToCpp.mojom.js"); - return filepath; + return test::ExecutableDir() + + "/gen/third_party/blink/renderer/core/mojo/tests/JsToCpp.mojom.js"; } String TestScriptPath() { - String filepath = test::BlinkRootDir(); - filepath.append("/renderer/core/mojo/tests/JsToCppTest.js"); - return filepath; + return test::BlinkRootDir() + "/renderer/core/mojo/tests/JsToCppTest.js"; } v8::Local<v8::Value> ExecuteScript(const String& script_path,
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc index 3898d61..d93bb7d 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.cc
@@ -37,6 +37,9 @@ #include "cc/layers/picture_layer.h" #include "cc/layers/scrollbar_layer_interface.h" #include "cc/layers/solid_color_scrollbar_layer.h" +#include "third_party/blink/public/platform/platform.h" +#include "third_party/blink/public/platform/web_layer_tree_view.h" +#include "third_party/blink/public/web/web_element.h" #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/exported/web_plugin_container_impl.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h" @@ -53,6 +56,9 @@ #include "third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" #include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h" +#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" +#include "third_party/blink/renderer/core/scroll/scrollbar_layer_delegate.h" +#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h" #include "third_party/blink/renderer/platform/animation/compositor_animation_timeline.h" #include "third_party/blink/renderer/platform/geometry/region.h" #include "third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h" @@ -61,11 +67,6 @@ #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/transforms/transform_state.h" -#include "third_party/blink/public/platform/platform.h" -#include "third_party/blink/public/platform/web_layer_tree_view.h" -#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" -#include "third_party/blink/renderer/core/scroll/scrollbar_layer_delegate.h" -#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h" namespace { @@ -95,11 +96,9 @@ void ScrollingCoordinator::SetShouldHandleScrollGestureOnMainThreadRegion( const Region& region, - LocalFrameView* frame_view) { - if (cc::Layer* scroll_layer = GraphicsLayerToCcLayer( - frame_view->LayoutViewport()->LayerForScrolling())) { - scroll_layer->SetNonFastScrollableRegion(RegionToCCRegion(region)); - } + GraphicsLayer* layer) { + if (cc::Layer* cc_layer = GraphicsLayerToCcLayer(layer)) + cc_layer->SetNonFastScrollableRegion(RegionToCCRegion(region)); } void ScrollingCoordinator::NotifyGeometryChanged(LocalFrameView* frame_view) { @@ -174,19 +173,30 @@ // TODO(pdr): Move the scroll gesture region logic to use touch action rects. // These features are similar and do not need independent implementations. if (scroll_gesture_region_dirty) { - // Compute the region of the page where we can't handle scroll gestures and - // mousewheel events - // on the impl thread. This currently includes: + // Compute the regions of the page where we can't handle scroll gestures on + // the impl thread. This currently includes: // 1. All scrollable areas, such as subframes, overflow divs and list boxes, // whose composited scrolling are not enabled. We need to do this even if // the frame view whose layout was updated is not the main frame. // 2. Resize control areas, e.g. the small rect at the right bottom of // div/textarea/iframe when CSS property "resize" is enabled. // 3. Plugin areas. - Region should_handle_scroll_gesture_on_main_thread_region = - ComputeShouldHandleScrollGestureOnMainThreadRegion(frame); + Region main_thread_scrolling_region; + Region main_thread_fixed_region; + ComputeShouldHandleScrollGestureOnMainThreadRegion( + frame, &main_thread_scrolling_region, &main_thread_fixed_region); + SetShouldHandleScrollGestureOnMainThreadRegion( - should_handle_scroll_gesture_on_main_thread_region, frame_view); + main_thread_scrolling_region, + frame_view->LayoutViewport()->LayerForScrolling()); + + // Fixed regions will be stored on the visual viewport's scroll layer. This + // is because a region for an area that's fixed to the layout viewport + // won't move when the layout viewport scrolls. + SetShouldHandleScrollGestureOnMainThreadRegion( + main_thread_fixed_region, + page_->GetVisualViewport().LayerForScrolling()); + frame_view->GetScrollingContext()->SetScrollGestureRegionIsDirty(false); } @@ -391,7 +401,6 @@ scrollbar_graphics_layer->SetContentsToCcLayer(nullptr, false); scrollbar_graphics_layer->SetDrawsContent(true); - scrollbar_graphics_layer->SetHitTestable(true); } static void SetupScrollbarLayer( @@ -411,7 +420,6 @@ scrollbar_layer_group->layer.get(), /*prevent_contents_opaque_changes=*/false); scrollbar_graphics_layer->SetDrawsContent(false); - scrollbar_graphics_layer->SetHitTestable(false); } void ScrollingCoordinator::AddScrollbarLayerGroup( @@ -797,14 +805,38 @@ return layout_view->UsesCompositing(); } -Region ScrollingCoordinator::ComputeShouldHandleScrollGestureOnMainThreadRegion( - const LocalFrame* frame) const { - Region should_handle_scroll_gesture_on_main_thread_region; +namespace { + +bool ScrollsWithFrame(const LocalFrame& frame, LayoutBox* object) { + DCHECK(object); + DCHECK(object->Layer()->GetLayoutBox() == object); + + if (object->Layer()->AncestorScrollingLayer() == + frame.ContentLayoutObject()->Layer()) + return true; + + // TODO(bokan): Returning false unconditionally here is actually wrong but we + // do this because NonFastScrollableRegions are stored only on the layout and + // visual viewport's scroll layers. This can lead to issues when subscroller + // layers are scrolled (e.g. https://crbug.com/817600). These should really + // be stored on the nearest ancestor ScrollNode, rather than the root + // viewport. Should be addressed by https://crbug.com/864567. + return false; +} + +} // namespace + +void ScrollingCoordinator::ComputeShouldHandleScrollGestureOnMainThreadRegion( + const LocalFrame* frame, + Region* scrolling_region, + Region* fixed_region) const { LocalFrameView* frame_view = frame->View(); + DCHECK(scrolling_region); + DCHECK(fixed_region); if (!frame_view || frame_view->ShouldThrottleRendering() || !frame_view->IsVisible()) { - return should_handle_scroll_gesture_on_main_thread_region; + return; } if (const LocalFrameView::ScrollableAreaSet* scrollable_areas = @@ -814,8 +846,12 @@ if (scrollable_area->UsesCompositedScrolling()) continue; + Region* region = ScrollsWithFrame(*frame, scrollable_area->GetLayoutBox()) + ? scrolling_region + : fixed_region; + IntRect box = scrollable_area->ScrollableAreaBoundingBox(); - should_handle_scroll_gesture_on_main_thread_region.Unite(box); + region->Unite(box); } } @@ -828,6 +864,11 @@ for (const LayoutBox* box : *resizer_areas) { PaintLayerScrollableArea* scrollable_area = box->Layer()->GetScrollableArea(); + + Region* region = ScrollsWithFrame(*frame, scrollable_area->GetLayoutBox()) + ? scrolling_region + : fixed_region; + IntRect bounds = box->AbsoluteBoundingBoxRect(); // Get the corner in local coords. IntRect corner = @@ -837,14 +878,25 @@ ->LocalToAbsoluteQuad(FloatRect(corner), kTraverseDocumentBoundaries) .EnclosingBoundingBox(); - should_handle_scroll_gesture_on_main_thread_region.Unite(corner); + region->Unite(corner); } } for (const auto& plugin : frame_view->Plugins()) { + Element* element = plugin->GetElement(); + // Plugins can run script during layout so ensure the plugin wasn't removed + // since being added to the Plugins set. + if (!element->GetLayoutObject()) + continue; + + Region* region = + ScrollsWithFrame(*frame, ToLayoutBox(element->GetLayoutObject())) + ? scrolling_region + : fixed_region; + if (plugin->WantsWheelEvents()) { IntRect box = frame_view->ConvertToRootFrame(plugin->FrameRect()); - should_handle_scroll_gesture_on_main_thread_region.Unite(box); + region->Unite(box); } } @@ -852,12 +904,15 @@ for (Frame* sub_frame = tree.FirstChild(); sub_frame; sub_frame = sub_frame->Tree().NextSibling()) { if (auto* sub_local_frame = DynamicTo<LocalFrame>(sub_frame)) { - should_handle_scroll_gesture_on_main_thread_region.Unite( - ComputeShouldHandleScrollGestureOnMainThreadRegion(sub_local_frame)); + // We always use the scrolling_region in subframes because the returned + // regions will be relative to the local root frame. Inside an iframe, + // there's no way to fix an element to an ancestor frame. i.e. A fixed + // region inside the iframe will still translate when the root frame + // scrolls; it's only fixed with repsect to its own frame. + ComputeShouldHandleScrollGestureOnMainThreadRegion( + sub_local_frame, scrolling_region, scrolling_region); } } - - return should_handle_scroll_gesture_on_main_thread_region; } void ScrollingCoordinator::
diff --git a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h index 60bdfcf..3586dcb 100644 --- a/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h +++ b/third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h
@@ -149,8 +149,15 @@ const PaintLayer* parent); void UpdateClipParentForGraphicsLayer(GraphicsLayer* child, const PaintLayer* parent); - Region ComputeShouldHandleScrollGestureOnMainThreadRegion( - const LocalFrame*) const; + + // Computes the NonFastScrollableRegions for the given local root frame. It + // outputs a separate region for areas that scroll with the viewport and + // those that are fixed to it since these regions will need to go on separate + // layers. + void ComputeShouldHandleScrollGestureOnMainThreadRegion( + const LocalFrame*, + Region* scrolling_region, + Region* fixed_region) const; void UpdateTouchEventTargetRectsIfNeeded(LocalFrame*); @@ -191,7 +198,7 @@ MainThreadScrollingReasons); void SetShouldHandleScrollGestureOnMainThreadRegion(const Region&, - LocalFrameView*); + GraphicsLayer*); void AddScrollbarLayerGroup(ScrollableArea*, ScrollbarOrientation,
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc index a5b3a5e6..d7a4d5f 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.cc
@@ -251,7 +251,7 @@ CreateGraphicsLayer(owning_layer_.GetCompositingReasons(), owning_layer_.GetSquashingDisallowedReasons()); - graphics_layer_->SetHitTestable(true); + UpdateHitTestableWithoutDrawsContent(true); UpdateOpacity(GetLayoutObject().StyleRef()); UpdateTransform(GetLayoutObject().StyleRef()); if (!RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) @@ -279,6 +279,11 @@ scrolling_contents_layer_ = nullptr; } +void CompositedLayerMapping::UpdateHitTestableWithoutDrawsContent( + const bool& should_hit_test) { + graphics_layer_->SetHitTestableWithoutDrawsContent(should_hit_test); +} + void CompositedLayerMapping::UpdateOpacity(const ComputedStyle& style) { graphics_layer_->SetOpacity(CompositingOpacity(style.Opacity())); } @@ -1327,11 +1332,6 @@ // layers. bool contents_visible = owning_layer_.HasVisibleContent() || HasVisibleNonCompositingDescendant(&owning_layer_); - // TODO(sunxd): Investigate and possibly implement computing hit test regions - // in PaintTouchActionRects code path, so that cc has correct pointer-events - // information. - // For now, there is no need to set graphics_layer_'s hit testable bit here, - // because it is always hit testable from cc's perspective. graphics_layer_->SetContentsVisible(contents_visible); // In BGPT mode, we do not need to update the backface visibility here, as it @@ -2172,9 +2172,7 @@ if (layer->HasContentsLayer()) layer->SetContentsRect(IntRect(IntPoint(), frame_rect.Size())); } - bool h_bar_visible = h_bar && !layer->HasContentsLayer(); - layer->SetDrawsContent(h_bar_visible); - layer->SetHitTestable(h_bar_visible); + layer->SetDrawsContent(h_bar && !layer->HasContentsLayer()); } if (GraphicsLayer* layer = LayerForVerticalScrollbar()) { @@ -2187,9 +2185,7 @@ if (layer->HasContentsLayer()) layer->SetContentsRect(IntRect(IntPoint(), frame_rect.Size())); } - bool v_bar_visible = v_bar && !layer->HasContentsLayer(); - layer->SetDrawsContent(v_bar_visible); - layer->SetHitTestable(v_bar_visible); + layer->SetDrawsContent(v_bar && !layer->HasContentsLayer()); } if (GraphicsLayer* layer = LayerForScrollCorner()) { @@ -2200,7 +2196,6 @@ ToIntSize(scroll_corner_and_resizer.Location())); layer->SetSize(gfx::Size(scroll_corner_and_resizer.Size())); layer->SetDrawsContent(!scroll_corner_and_resizer.IsEmpty()); - layer->SetHitTestable(!scroll_corner_and_resizer.IsEmpty()); } } @@ -2391,7 +2386,7 @@ if (!foreground_layer_) { foreground_layer_ = CreateGraphicsLayer(CompositingReason::kLayerForForeground); - foreground_layer_->SetHitTestable(true); + foreground_layer_->SetHitTestableWithoutDrawsContent(true); layer_changed = true; } } else if (foreground_layer_) { @@ -2479,13 +2474,12 @@ scrolling_layer_ = CreateGraphicsLayer(CompositingReason::kLayerForScrollingContainer); scrolling_layer_->SetDrawsContent(false); - scrolling_layer_->SetHitTestable(false); scrolling_layer_->SetMasksToBounds(true); // Inner layer which renders the content that scrolls. scrolling_contents_layer_ = CreateGraphicsLayer(CompositingReason::kLayerForScrollingContents); - scrolling_contents_layer_->SetHitTestable(true); + scrolling_contents_layer_->SetHitTestableWithoutDrawsContent(true); auto element_id = scrollable_area->GetCompositorElementId(); scrolling_contents_layer_->SetElementId(element_id); @@ -2642,7 +2636,6 @@ squashing_layer_ = CreateGraphicsLayer(CompositingReason::kLayerForSquashingContents); squashing_layer_->SetDrawsContent(true); - squashing_layer_->SetHitTestable(true); layers_changed = true; }
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h index 77fc7dc5..b08ba01 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping.h
@@ -435,6 +435,7 @@ // Result is transform origin in pixels. FloatPoint3D ComputeTransformOrigin(const IntRect& border_box) const; + void UpdateHitTestableWithoutDrawsContent(const bool&); void UpdateOpacity(const ComputedStyle&); void UpdateTransform(const ComputedStyle&); void UpdateLayerBlendMode(const ComputedStyle&);
diff --git a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc index 0f06016d..b315fba 100644 --- a/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc +++ b/third_party/blink/renderer/core/paint/compositing/composited_layer_mapping_test.cc
@@ -1046,7 +1046,7 @@ mapping->ForegroundLayer()->PaintingPhase()); // Regression test for crbug.com/767908: a foreground layer should also // participates hit testing. - EXPECT_TRUE(mapping->ForegroundLayer()->GetHitTestable()); + EXPECT_TRUE(mapping->ForegroundLayer()->GetHitTestableWithoutDrawsContent()); Element* negative_composited_child = GetDocument().getElementById("negative-composited-child");
diff --git a/third_party/blink/renderer/core/paint/html_canvas_painter.cc b/third_party/blink/renderer/core/paint/html_canvas_painter.cc index 18733ed..d0f90bc 100644 --- a/third_party/blink/renderer/core/paint/html_canvas_painter.cc +++ b/third_party/blink/renderer/core/paint/html_canvas_painter.cc
@@ -46,7 +46,6 @@ gfx::Vector2dF(pixel_snapped_rect.X(), pixel_snapped_rect.Y())); layer->SetBounds(gfx::Size(pixel_snapped_rect.Size())); layer->SetIsDrawable(true); - layer->SetHitTestable(true); RecordForeignLayer(context, DisplayItem::kForeignLayerCanvas, layer); return; }
diff --git a/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc b/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc index 2cc79150cd..2f9deae 100644 --- a/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc +++ b/third_party/blink/renderer/core/paint/link_highlight_impl_test.cc
@@ -273,9 +273,11 @@ // Change the touched element's height to 12px. auto& style = touch_element->getAttribute(html_names::kStyleAttr); - String new_style = style.GetString(); - new_style.append("height: 12px;"); - touch_element->setAttribute(html_names::kStyleAttr, AtomicString(new_style)); + StringBuilder new_style; + new_style.Append(style.GetString()); + new_style.Append("height: 12px;"); + touch_element->setAttribute(html_names::kStyleAttr, + new_style.ToAtomicString()); UpdateAllLifecyclePhases(); const auto& highlights =
diff --git a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc index 171fb01..1c5c5fd 100644 --- a/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc +++ b/third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc
@@ -20,15 +20,17 @@ #include "third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h" #include "third_party/blink/renderer/platform/graphics/paint/geometry_mapper.h" #include "third_party/blink/renderer/platform/testing/layer_tree_host_embedder.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { void PaintPropertyTreeBuilderTest::LoadTestData(const char* file_name) { - String full_path = test::BlinkRootDir(); - full_path.append("/renderer/core/paint/test_data/"); - full_path.append(file_name); + StringBuilder full_path; + full_path.Append(test::BlinkRootDir()); + full_path.Append("/renderer/core/paint/test_data/"); + full_path.Append(file_name); const Vector<char> input_buffer = - test::ReadFromFile(full_path)->CopyAs<Vector<char>>(); + test::ReadFromFile(full_path.ToString())->CopyAs<Vector<char>>(); SetBodyInnerHTML(String(input_buffer.data(), input_buffer.size())); }
diff --git a/third_party/blink/renderer/core/paint/theme_painter.cc b/third_party/blink/renderer/core/paint/theme_painter.cc index 9b87e00..20ed79b6 100644 --- a/third_party/blink/renderer/core/paint/theme_painter.cc +++ b/third_party/blink/renderer/core/paint/theme_painter.cc
@@ -42,7 +42,6 @@ #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/platform/graphics/graphics_context_state_saver.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" -#include "third_party/blink/renderer/platform/theme.h" #include "ui/native_theme/native_theme.h" // The methods in this file are shared by all themes on every platform.
diff --git a/third_party/blink/renderer/core/paint/theme_painter_mac.mm b/third_party/blink/renderer/core/paint/theme_painter_mac.mm index 7a1260d..e965faf9 100644 --- a/third_party/blink/renderer/core/paint/theme_painter_mac.mm +++ b/third_party/blink/renderer/core/paint/theme_painter_mac.mm
@@ -37,7 +37,6 @@ #import "third_party/blink/renderer/platform/mac/block_exceptions.h" #import "third_party/blink/renderer/platform/mac/color_mac.h" #import "third_party/blink/renderer/platform/mac/local_current_graphics_context.h" -#import "third_party/blink/renderer/platform/mac/theme_mac.h" #import "third_party/blink/renderer/platform/mac/web_core_ns_cell_extras.h" // The methods in this file are specific to the Mac OS X platform. @@ -186,11 +185,12 @@ // Now inflate it to account for the shadow. IntRect inflated_rect = r; if (r.Width() >= layout_theme_.MinimumMenuListSize(style)) - inflated_rect = ThemeMac::InflateRect( + inflated_rect = LayoutThemeMac::InflateRect( inflated_rect, size, layout_theme_.PopupButtonMargins(), zoom_level); LocalCurrentGraphicsContext local_context( - paint_info.context, ThemeMac::InflateRectForFocusRing(inflated_rect)); + paint_info.context, + LayoutThemeMac::InflateRectForFocusRing(inflated_rect)); if (zoom_level != 1.0f) { inflated_rect.SetWidth(inflated_rect.Width() / zoom_level); @@ -621,15 +621,15 @@ // Determine the width and height needed for the control and prepare the cell // for painting. NSButtonCell* checkbox_cell = - ThemeMac::Checkbox(states, zoomed_rect, zoom_factor); + LayoutThemeMac::Checkbox(states, zoomed_rect, zoom_factor); GraphicsContextStateSaver state_saver(paint_info.context); NSControlSize control_size = [checkbox_cell controlSize]; - IntSize zoomed_size = ThemeMac::CheckboxSizes()[control_size]; + IntSize zoomed_size = LayoutThemeMac::CheckboxSizes()[control_size]; zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); - IntRect inflated_rect = ThemeMac::InflateRect( - zoomed_rect, zoomed_size, ThemeMac::CheckboxMargins(control_size), + IntRect inflated_rect = LayoutThemeMac::InflateRect( + zoomed_rect, zoomed_size, LayoutThemeMac::CheckboxMargins(control_size), zoom_factor); if (zoom_factor != 1.0f) { @@ -641,8 +641,9 @@ } LocalCurrentGraphicsContext local_context( - paint_info.context, ThemeMac::InflateRectForFocusRing(inflated_rect)); - NSView* view = ThemeMac::EnsuredView(document.View()->Size()); + paint_info.context, + LayoutThemeMac::InflateRectForFocusRing(inflated_rect)); + NSView* view = LayoutThemeMac::EnsuredView(document.View()->Size()); [checkbox_cell drawWithFrame:NSRect(inflated_rect) inView:view]; if (states & kFocusControlState) [checkbox_cell cr_drawFocusRingWithFrame:NSRect(inflated_rect) inView:view]; @@ -662,16 +663,17 @@ // Determine the width and height needed for the control and prepare the cell // for painting. - NSButtonCell* radio_cell = ThemeMac::Radio(states, zoomed_rect, zoom_factor); + NSButtonCell* radio_cell = + LayoutThemeMac::Radio(states, zoomed_rect, zoom_factor); GraphicsContextStateSaver state_saver(paint_info.context); NSControlSize control_size = [radio_cell controlSize]; - IntSize zoomed_size = ThemeMac::RadioSizes()[control_size]; + IntSize zoomed_size = LayoutThemeMac::RadioSizes()[control_size]; zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); - IntRect inflated_rect = - ThemeMac::InflateRect(zoomed_rect, zoomed_size, - ThemeMac::RadioMargins(control_size), zoom_factor); + IntRect inflated_rect = LayoutThemeMac::InflateRect( + zoomed_rect, zoomed_size, LayoutThemeMac::RadioMargins(control_size), + zoom_factor); if (zoom_factor != 1.0f) { inflated_rect.SetWidth(inflated_rect.Width() / zoom_factor); @@ -682,9 +684,10 @@ } LocalCurrentGraphicsContext local_context( - paint_info.context, ThemeMac::InflateRectForFocusRing(inflated_rect)); + paint_info.context, + LayoutThemeMac::InflateRectForFocusRing(inflated_rect)); BEGIN_BLOCK_OBJC_EXCEPTIONS - NSView* view = ThemeMac::EnsuredView(document.View()->Size()); + NSView* view = LayoutThemeMac::EnsuredView(document.View()->Size()); [radio_cell drawWithFrame:NSRect(inflated_rect) inView:view]; if (states & kFocusControlState) [radio_cell cr_drawFocusRingWithFrame:NSRect(inflated_rect) inView:view]; @@ -706,12 +709,12 @@ // Determine the width and height needed for the control and prepare the cell // for painting. - NSButtonCell* button_cell = - ThemeMac::Button(style.Appearance(), states, zoomed_rect, zoom_factor); + NSButtonCell* button_cell = LayoutThemeMac::Button(style.Appearance(), states, + zoomed_rect, zoom_factor); GraphicsContextStateSaver state_saver(paint_info.context); NSControlSize control_size = [button_cell controlSize]; - IntSize zoomed_size = ThemeMac::ButtonSizes()[control_size]; + IntSize zoomed_size = LayoutThemeMac::ButtonSizes()[control_size]; // Buttons don't ever constrain width, so the zoomed width can just be // honored. zoomed_size.SetWidth(zoomed_rect.Width()); @@ -726,9 +729,9 @@ } // Now inflate it to account for the shadow. - inflated_rect = ThemeMac::InflateRect(inflated_rect, zoomed_size, - ThemeMac::ButtonMargins(control_size), - zoom_factor); + inflated_rect = LayoutThemeMac::InflateRect( + inflated_rect, zoomed_size, LayoutThemeMac::ButtonMargins(control_size), + zoom_factor); if (zoom_factor != 1.0f) { inflated_rect.SetWidth(inflated_rect.Width() / zoom_factor); @@ -740,8 +743,9 @@ } LocalCurrentGraphicsContext local_context( - paint_info.context, ThemeMac::InflateRectForFocusRing(inflated_rect)); - NSView* view = ThemeMac::EnsuredView(document.View()->Size()); + paint_info.context, + LayoutThemeMac::InflateRectForFocusRing(inflated_rect)); + NSView* view = LayoutThemeMac::EnsuredView(document.View()->Size()); [button_cell drawWithFrame:NSRect(inflated_rect) inView:view]; if (states & kFocusControlState) @@ -787,8 +791,8 @@ draw_info.state = ConvertControlStatesToThemeDrawState(kThemeIncDecButton, states); draw_info.adornment = kThemeAdornmentDefault; - ControlSize control_size = ThemeMac::ControlSizeFromPixelSize( - ThemeMac::StepperSizes(), zoomed_rect.Size(), zoom_factor); + ControlSize control_size = LayoutThemeMac::ControlSizeFromPixelSize( + LayoutThemeMac::StepperSizes(), zoomed_rect.Size(), zoom_factor); if (control_size == NSSmallControlSize) draw_info.kind = kThemeIncDecButtonSmall; else if (control_size == NSMiniControlSize)
diff --git a/third_party/blink/renderer/core/paint/video_painter.cc b/third_party/blink/renderer/core/paint/video_painter.cc index 3a1ddcd..b5764b44 100644 --- a/third_party/blink/renderer/core/paint/video_painter.cc +++ b/third_party/blink/renderer/core/paint/video_painter.cc
@@ -55,7 +55,6 @@ gfx::Vector2dF(snapped_replaced_rect.X(), snapped_replaced_rect.Y())); layer->SetBounds(gfx::Size(snapped_replaced_rect.Size())); layer->SetIsDrawable(true); - layer->SetHitTestable(true); RecordForeignLayer(context, DisplayItem::kForeignLayerVideo, layer); return; }
diff --git a/third_party/blink/renderer/core/paint/video_painter_test.cc b/third_party/blink/renderer/core/paint/video_painter_test.cc index 7cdc666..1a6fe96 100644 --- a/third_party/blink/renderer/core/paint/video_painter_test.cc +++ b/third_party/blink/renderer/core/paint/video_painter_test.cc
@@ -33,7 +33,6 @@ client_->ReadyStateChanged(); layer_ = cc::Layer::Create(); layer_->SetIsDrawable(true); - layer_->SetHitTestable(true); client_->SetCcLayer(layer_.get()); return LoadTiming::kImmediate; }
diff --git a/third_party/blink/renderer/core/resize_observer/resize_observer.h b/third_party/blink/renderer/core/resize_observer/resize_observer.h index af1f5f41..047bd3d 100644 --- a/third_party/blink/renderer/core/resize_observer/resize_observer.h +++ b/third_party/blink/renderer/core/resize_observer/resize_observer.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -69,7 +68,7 @@ using ObservationList = HeapLinkedHashSet<WeakMember<ResizeObservation>>; // Either of |callback_| and |delegate_| should be non-null. - const TraceWrapperMember<V8ResizeObserverCallback> callback_; + const Member<V8ResizeObserverCallback> callback_; const Member<Delegate> delegate_; // List of Elements we are observing. These Elements make the ResizeObserver
diff --git a/third_party/blink/renderer/core/script/html_parser_script_runner.h b/third_party/blink/renderer/core/script/html_parser_script_runner.h index b698180..f9b1dce 100644 --- a/third_party/blink/renderer/core/script/html_parser_script_runner.h +++ b/third_party/blink/renderer/core/script/html_parser_script_runner.h
@@ -31,7 +31,6 @@ #include "third_party/blink/renderer/core/html/parser/html_parser_reentry_permit.h" #include "third_party/blink/renderer/core/script/pending_script.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_client.h" #include "third_party/blink/renderer/platform/wtf/deque.h" @@ -135,11 +134,10 @@ Member<HTMLParserScriptRunnerHost> host_; // https://html.spec.whatwg.org/C/#pending-parsing-blocking-script - TraceWrapperMember<PendingScript> parser_blocking_script_; + Member<PendingScript> parser_blocking_script_; // https://html.spec.whatwg.org/C/#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing - HeapDeque<TraceWrapperMember<PendingScript>> - scripts_to_execute_after_parsing_; + HeapDeque<Member<PendingScript>> scripts_to_execute_after_parsing_; DISALLOW_COPY_AND_ASSIGN(HTMLParserScriptRunner); };
diff --git a/third_party/blink/renderer/core/script/modulator_impl_base.h b/third_party/blink/renderer/core/script/modulator_impl_base.h index 9bb58adb..53780b19 100644 --- a/third_party/blink/renderer/core/script/modulator_impl_base.h +++ b/third_party/blink/renderer/core/script/modulator_impl_base.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/bindings/core/v8/module_record.h" #include "third_party/blink/renderer/core/script/modulator.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -99,8 +98,8 @@ Member<ScriptState> script_state_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; - TraceWrapperMember<ModuleMap> map_; - TraceWrapperMember<ModuleTreeLinkerRegistry> tree_linker_registry_; + Member<ModuleMap> map_; + Member<ModuleTreeLinkerRegistry> tree_linker_registry_; Member<ModuleRecordResolver> module_record_resolver_; Member<DynamicModuleResolver> dynamic_module_resolver_;
diff --git a/third_party/blink/renderer/core/script/module_map.cc b/third_party/blink/renderer/core/script/module_map.cc index 67c7f0ed..8d33daa 100644 --- a/third_party/blink/renderer/core/script/module_map.cc +++ b/third_party/blink/renderer/core/script/module_map.cc
@@ -44,7 +44,7 @@ // Implements ModuleScriptLoaderClient void NotifyNewSingleModuleFinished(ModuleScript*) override; - TraceWrapperMember<ModuleScript> module_script_; + Member<ModuleScript> module_script_; Member<ModuleMap> map_; // Correspond to the HTML spec: "fetching" state. @@ -126,7 +126,7 @@ // entry's value changes, then queue a task on the networking task source to // proceed with running the following steps.</spec> MapImpl::AddResult result = map_.insert(request.Url(), nullptr); - TraceWrapperMember<Entry>& entry = result.stored_value->value; + Member<Entry>& entry = result.stored_value->value; if (result.is_new_entry) { entry = Entry::Create(this);
diff --git a/third_party/blink/renderer/core/script/module_map.h b/third_party/blink/renderer/core/script/module_map.h index 52457cdf..3b0b549 100644 --- a/third_party/blink/renderer/core/script/module_map.h +++ b/third_party/blink/renderer/core/script/module_map.h
@@ -8,7 +8,6 @@ #include "base/macros.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/weborigin/kurl_hash.h" @@ -57,7 +56,7 @@ Modulator* GetModulator() { return modulator_; } private: - using MapImpl = HeapHashMap<KURL, TraceWrapperMember<Entry>>; + using MapImpl = HeapHashMap<KURL, Member<Entry>>; // A module map is a map of absolute URLs to map entry. MapImpl map_;
diff --git a/third_party/blink/renderer/core/script/module_pending_script.h b/third_party/blink/renderer/core/script/module_pending_script.h index b75a48f1..a60062f 100644 --- a/third_party/blink/renderer/core/script/module_pending_script.h +++ b/third_party/blink/renderer/core/script/module_pending_script.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/script/module_script.h" #include "third_party/blink/renderer/core/script/pending_script.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -41,8 +40,8 @@ void NotifyModuleTreeLoadFinished(ModuleScript*) override; bool finished_ = false; - TraceWrapperMember<ModuleScript> module_script_; - TraceWrapperMember<ModulePendingScript> pending_script_; + Member<ModuleScript> module_script_; + Member<ModulePendingScript> pending_script_; }; // PendingScript for a module script @@ -87,7 +86,7 @@ void CheckState() const override {} - TraceWrapperMember<ModulePendingScriptTreeClient> module_tree_client_; + Member<ModulePendingScriptTreeClient> module_tree_client_; bool ready_ = false; const bool is_external_; };
diff --git a/third_party/blink/renderer/core/script/module_script.h b/third_party/blink/renderer/core/script/module_script.h index 151e712..6e771e8 100644 --- a/third_party/blink/renderer/core/script/module_script.h +++ b/third_party/blink/renderer/core/script/module_script.h
@@ -135,7 +135,7 @@ // Document -> ScriptRunner -> ScriptLoader -> ModulePendingScript // -> ModulePendingScriptTreeClient -> ModuleScript. // All the classes/references on the graphs above should be - // TraceWrapperMember<>/etc., + // Member<>/etc., // // A parse error and an error to rethrow belong to a script, not to a // |parse_error_| and |error_to_rethrow_| should belong to a script (i.e.
diff --git a/third_party/blink/renderer/core/script/script_loader.h b/third_party/blink/renderer/core/script/script_loader.h index 612174f..9597371 100644 --- a/third_party/blink/renderer/core/script/script_loader.h +++ b/third_party/blink/renderer/core/script/script_loader.h
@@ -31,7 +31,6 @@ #include "third_party/blink/renderer/core/script/script_runner.h" #include "third_party/blink/renderer/core/script/script_scheduling_type.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/loader/fetch/integrity_metadata.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h" #include "third_party/blink/renderer/platform/loader/fetch/script_fetch_options.h" @@ -192,14 +191,14 @@ // |prepared_pending_script_|. // Later, TakePendingScript() is called, and its caller holds a reference // to the PendingScript instead and |prepared_pending_script_| is cleared. - TraceWrapperMember<PendingScript> prepared_pending_script_; + Member<PendingScript> prepared_pending_script_; // If the script is controlled by ScriptRunner, then // ScriptLoader::pending_script_ holds a reference to the PendingScript and // ScriptLoader is its client. // Otherwise, HTMLParserScriptRunner or XMLParserScriptRunner holds the // reference and |pending_script_| here is null. - TraceWrapperMember<PendingScript> pending_script_; + Member<PendingScript> pending_script_; // This is used only to keep the ScriptResource of a classic script alive // and thus to keep it on MemoryCache, even after script execution, as long
diff --git a/third_party/blink/renderer/core/script/script_runner.h b/third_party/blink/renderer/core/script/script_runner.h index 9f44f22..762f910 100644 --- a/third_party/blink/renderer/core/script/script_runner.h +++ b/third_party/blink/renderer/core/script/script_runner.h
@@ -31,7 +31,6 @@ #include "base/single_thread_task_runner.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" @@ -87,13 +86,12 @@ Member<Document> document_; - HeapDeque<TraceWrapperMember<PendingScript>> pending_in_order_scripts_; - HeapHashSet<TraceWrapperMember<PendingScript>> pending_async_scripts_; + HeapDeque<Member<PendingScript>> pending_in_order_scripts_; + HeapHashSet<Member<PendingScript>> pending_async_scripts_; // http://www.whatwg.org/specs/web-apps/current-work/#set-of-scripts-that-will-execute-as-soon-as-possible - HeapDeque<TraceWrapperMember<PendingScript>> async_scripts_to_execute_soon_; - HeapDeque<TraceWrapperMember<PendingScript>> - in_order_scripts_to_execute_soon_; + HeapDeque<Member<PendingScript>> async_scripts_to_execute_soon_; + HeapDeque<Member<PendingScript>> in_order_scripts_to_execute_soon_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
diff --git a/third_party/blink/renderer/core/script/xml_parser_script_runner.h b/third_party/blink/renderer/core/script/xml_parser_script_runner.h index d682bd5..c32ae40 100644 --- a/third_party/blink/renderer/core/script/xml_parser_script_runner.h +++ b/third_party/blink/renderer/core/script/xml_parser_script_runner.h
@@ -44,7 +44,7 @@ // https://html.spec.whatwg.org/C/#pending-parsing-blocking-script // TODO(crbug/717643): Support module scripts, and turn this into - // TraceWrapperMember<>. + // Member<>. Member<PendingScript> parser_blocking_script_; Member<XMLParserScriptRunnerHost> host_;
diff --git a/third_party/blink/renderer/core/scroll/scroll_animator_mac.h b/third_party/blink/renderer/core/scroll/scroll_animator_mac.h index b9890f8..f9e6bf3d 100644 --- a/third_party/blink/renderer/core/scroll/scroll_animator_mac.h +++ b/third_party/blink/renderer/core/scroll/scroll_animator_mac.h
@@ -27,6 +27,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_SCROLL_SCROLL_ANIMATOR_MAC_H_ #include <memory> + #include "base/mac/scoped_nsobject.h" #include "base/single_thread_task_runner.h" #include "third_party/blink/renderer/core/scroll/scroll_animator_base.h" @@ -37,9 +38,9 @@ #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" #include "third_party/blink/renderer/platform/timer.h" -OBJC_CLASS BlinkScrollAnimationHelperDelegate; -OBJC_CLASS BlinkScrollbarPainterControllerDelegate; -OBJC_CLASS BlinkScrollbarPainterDelegate; +@class BlinkScrollAnimationHelperDelegate; +@class BlinkScrollbarPainterControllerDelegate; +@class BlinkScrollbarPainterDelegate; typedef id ScrollbarPainterController;
diff --git a/third_party/blink/renderer/core/streams/miscellaneous_operations.cc b/third_party/blink/renderer/core/streams/miscellaneous_operations.cc index f130b29..27fd63f 100644 --- a/third_party/blink/renderer/core/streams/miscellaneous_operations.cc +++ b/third_party/blink/renderer/core/streams/miscellaneous_operations.cc
@@ -693,4 +693,86 @@ return ScriptValue(script_state, array); } +void ScriptValueToObject(ScriptState* script_state, + ScriptValue value, + v8::Local<v8::Object>* object, + ExceptionState& exception_state) { + auto* isolate = script_state->GetIsolate(); + DCHECK(!value.IsEmpty()); + auto v8_value = value.V8Value(); + // All the object parameters in the standard are default-initialised to an + // empty object. + if (v8_value->IsUndefined()) { + *object = v8::Object::New(isolate); + return; + } + v8::TryCatch try_catch(isolate); + if (!v8_value->ToObject(script_state->GetContext()).ToLocal(object)) { + exception_state.RethrowV8Exception(try_catch.Exception()); + return; + } +} + +StrategyUnpacker::StrategyUnpacker(ScriptState* script_state, + ScriptValue strategy, + ExceptionState& exception_state) { + auto* isolate = script_state->GetIsolate(); + auto context = script_state->GetContext(); + v8::Local<v8::Object> strategy_object; + ScriptValueToObject(script_state, strategy, &strategy_object, + exception_state); + if (exception_state.HadException()) { + return; + } + + // This is used in several places. The steps here are taken from + // https://streams.spec.whatwg.org/#ws-constructor. + // 2. Let size be ? GetV(strategy, "size"). + v8::TryCatch try_catch(isolate); + if (!strategy_object->Get(context, V8AtomicString(isolate, "size")) + .ToLocal(&size_)) { + exception_state.RethrowV8Exception(try_catch.Exception()); + return; + } + + // 3. Let highWaterMark be ? GetV(strategy, "highWaterMark"). + if (!strategy_object->Get(context, V8AtomicString(isolate, "highWaterMark")) + .ToLocal(&high_water_mark_)) { + exception_state.RethrowV8Exception(try_catch.Exception()); + return; + } +} + +StrategySizeAlgorithm* StrategyUnpacker::MakeSizeAlgorithm( + ScriptState* script_state, + ExceptionState& exception_state) const { + DCHECK(!size_.IsEmpty()); + // 6. Let sizeAlgorithm be ? MakeSizeAlgorithmFromSizeFunction(size). + return MakeSizeAlgorithmFromSizeFunction(script_state, size_, + exception_state); +} + +double StrategyUnpacker::GetHighWaterMark( + ScriptState* script_state, + int default_value, + ExceptionState& exception_state) const { + DCHECK(!high_water_mark_.IsEmpty()); + // 7. If highWaterMark is undefined, let highWaterMark be 1. + if (high_water_mark_->IsUndefined()) { + return default_value; + } + + v8::TryCatch try_catch(script_state->GetIsolate()); + v8::Local<v8::Number> high_water_mark_as_number; + if (!high_water_mark_->ToNumber(script_state->GetContext()) + .ToLocal(&high_water_mark_as_number)) { + exception_state.RethrowV8Exception(try_catch.Exception()); + return 0.0; + } + + // 8. Set highWaterMark to ? ValidateAndNormalizeHighWaterMark(highWaterMark) + return ValidateAndNormalizeHighWaterMark(high_water_mark_as_number->Value(), + exception_state); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/streams/miscellaneous_operations.h b/third_party/blink/renderer/core/streams/miscellaneous_operations.h index c7cb9837..302b5f17 100644 --- a/third_party/blink/renderer/core/streams/miscellaneous_operations.h +++ b/third_party/blink/renderer/core/streams/miscellaneous_operations.h
@@ -7,6 +7,7 @@ #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/wtf/allocator.h" #include "v8/include/v8.h" namespace blink { @@ -142,6 +143,47 @@ ReadableStream* readable, ExceptionState& exception_state); +// Converts |value| to an object. |value| must not be empty. If |value| is +// undefined, an empty object will be returned. If |value| is JavaScript null, +// then an exception will be thrown. In the standard, this is performed as part +// of the GetV() operation, but in this implementation we do it explicitly +// before looking up any properties. +void ScriptValueToObject(ScriptState* script_state, + ScriptValue value, + v8::Local<v8::Object>* object, + ExceptionState& exception_state); + +// This class is used for unpacking strategies in the constructors of +// ReadableStream, WritableStream and TransformStream. For example, steps 2., +// 3., 6., 7. and 8. of https://streams.spec.whatwg.org/#ws-constructor. +class StrategyUnpacker final { + STACK_ALLOCATED(); + + public: + // Looks up the "size" and "highWaterMark" properties on |strategy|. May run + // arbitrary user code. The object cannot be used if + // exception_state.HadException() is true. + StrategyUnpacker(ScriptState*, ScriptValue strategy, ExceptionState&); + ~StrategyUnpacker() = default; + + // Performs MakeSizeAlgorithmFromSizeFunction on |size_|. Because this method + // can throw an exception, the timing when it is called is observable. + StrategySizeAlgorithm* MakeSizeAlgorithm(ScriptState*, ExceptionState&) const; + + // If |high_water_mark_| is defined, converts it to a number and call + // ValidateAndNormalizeHighWaterMark on it. Otherwise returns |default_value|. + // May run arbitrary user code. + double GetHighWaterMark(ScriptState*, + int default_value, + ExceptionState&) const; + + private: + v8::Local<v8::Value> size_; + v8::Local<v8::Value> high_water_mark_; + + DISALLOW_COPY_AND_ASSIGN(StrategyUnpacker); +}; + } // namespace blink #endif // THIRD_PARTY_BLINK_RENDERER_CORE_STREAMS_MISCELLANEOUS_OPERATIONS_H_
diff --git a/third_party/blink/renderer/core/streams/queue_with_sizes.h b/third_party/blink/renderer/core/streams/queue_with_sizes.h index 2dda8fb..e7816465 100644 --- a/third_party/blink/renderer/core/streams/queue_with_sizes.h +++ b/third_party/blink/renderer/core/streams/queue_with_sizes.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_STREAMS_QUEUE_WITH_SIZES_H_ #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.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/heap/heap_allocator.h" @@ -55,7 +54,7 @@ private: class ValueSizePair; - HeapDeque<TraceWrapperMember<ValueSizePair>> queue_; + HeapDeque<Member<ValueSizePair>> queue_; double queue_total_size_ = 0; };
diff --git a/third_party/blink/renderer/core/streams/readable_stream.h b/third_party/blink/renderer/core/streams/readable_stream.h index 3b9c1ad1..c08e40b 100644 --- a/third_party/blink/renderer/core/streams/readable_stream.h +++ b/third_party/blink/renderer/core/streams/readable_stream.h
@@ -19,7 +19,7 @@ class MessagePort; // This is an implementation of the corresponding IDL interface. -// Use TraceWrapperMember to hold a reference to an instance of this class. +// Use Member to hold a reference to an instance of this class. class CORE_EXPORT ReadableStream : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -28,7 +28,7 @@ // to a call to ReadableStreamDefaultReaderRead on the underlying stream. // // It has awkward garbage collection semantics: either it must be kept in a - // TraceWrapperMember, or the ReadableStream must outlive it. + // Member, or the ReadableStream must outlive it. // // This is a transitional interface while the streams C++ port is in progress. // Eventually callers will just use ReadableStreamDefaultReader objects
diff --git a/third_party/blink/renderer/core/streams/readable_stream_default_controller.cc b/third_party/blink/renderer/core/streams/readable_stream_default_controller.cc index 4371d75c..2fb9eac 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_default_controller.cc +++ b/third_party/blink/renderer/core/streams/readable_stream_default_controller.cc
@@ -367,7 +367,7 @@ } private: - const TraceWrapperMember<ReadableStreamDefaultController> controller_; + const Member<ReadableStreamDefaultController> controller_; }; class RejectFunction : public StreamScriptFunction { @@ -388,7 +388,7 @@ } private: - const TraceWrapperMember<ReadableStreamDefaultController> controller_; + const Member<ReadableStreamDefaultController> controller_; }; StreamThenPromise( @@ -557,7 +557,7 @@ } private: - const TraceWrapperMember<ReadableStreamDefaultController> controller_; + const Member<ReadableStreamDefaultController> controller_; }; class RejectFunction : public StreamScriptFunction { @@ -578,7 +578,7 @@ } private: - const TraceWrapperMember<ReadableStreamDefaultController> controller_; + const Member<ReadableStreamDefaultController> controller_; }; StreamThenPromise(
diff --git a/third_party/blink/renderer/core/streams/readable_stream_default_controller.h b/third_party/blink/renderer/core/streams/readable_stream_default_controller.h index b55101d..0d825561 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_default_controller.h +++ b/third_party/blink/renderer/core/streams/readable_stream_default_controller.h
@@ -7,8 +7,6 @@ #include "base/optional.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "v8/include/v8.h" namespace blink { @@ -118,12 +116,12 @@ bool is_pulling_ = false; bool is_started_ = false; bool enable_blink_lock_notifications_ = false; - TraceWrapperMember<StreamAlgorithm> cancel_algorithm_; - TraceWrapperMember<ReadableStreamNative> controlled_readable_stream_; - TraceWrapperMember<StreamAlgorithm> pull_algorithm_; - TraceWrapperMember<QueueWithSizes> queue_; + Member<StreamAlgorithm> cancel_algorithm_; + Member<ReadableStreamNative> controlled_readable_stream_; + Member<StreamAlgorithm> pull_algorithm_; + Member<QueueWithSizes> queue_; double strategy_high_water_mark_ = 0.0; - TraceWrapperMember<StrategySizeAlgorithm> strategy_size_algorithm_; + Member<StrategySizeAlgorithm> strategy_size_algorithm_; TraceWrapperV8Reference<v8::Object> lock_notify_target_; };
diff --git a/third_party/blink/renderer/core/streams/readable_stream_default_controller_interface.cc b/third_party/blink/renderer/core/streams/readable_stream_default_controller_interface.cc index 4ed6a28..6abdeda 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_default_controller_interface.cc +++ b/third_party/blink/renderer/core/streams/readable_stream_default_controller_interface.cc
@@ -181,7 +181,7 @@ } private: - TraceWrapperMember<ReadableStreamDefaultController> controller_; + Member<ReadableStreamDefaultController> controller_; }; } // namespace
diff --git a/third_party/blink/renderer/core/streams/readable_stream_default_reader.h b/third_party/blink/renderer/core/streams/readable_stream_default_reader.h index b36d29bd..1fcf7d4 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_default_reader.h +++ b/third_party/blink/renderer/core/streams/readable_stream_default_reader.h
@@ -7,8 +7,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" -#include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "v8/include/v8.h" namespace blink { @@ -64,10 +62,10 @@ friend class ReadableStreamDefaultController; friend class ReadableStreamNative; - TraceWrapperMember<StreamPromiseResolver> closed_promise_; + Member<StreamPromiseResolver> closed_promise_; bool for_author_code_ = true; - TraceWrapperMember<ReadableStreamNative> owner_readable_stream_; - HeapDeque<TraceWrapperMember<StreamPromiseResolver>> read_requests_; + Member<ReadableStreamNative> owner_readable_stream_; + HeapDeque<Member<StreamPromiseResolver>> read_requests_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/streams/readable_stream_native.cc b/third_party/blink/renderer/core/streams/readable_stream_native.cc index 4a3913f..e6932af 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_native.cc +++ b/third_party/blink/renderer/core/streams/readable_stream_native.cc
@@ -30,6 +30,611 @@ namespace blink { +struct ReadableStreamNative::PipeOptions { + PipeOptions() = default; + bool prevent_close = false; + bool prevent_abort = false; + bool prevent_cancel = false; +}; + +// PipeToEngine implements PipeTo(). All standard steps in this class come from +// https://streams.spec.whatwg.org/#readable-stream-pipe-to +// +// This implementation is simple but suboptimal because it uses V8 promises to +// drive its asynchronous state machine, allocating a lot of temporary V8 +// objects as a result. +// +// TODO(ricea): Create internal versions of ReadableStreamDefaultReader::Read() +// and WritableStreamDefaultWriter::Write() to bypass promise creation and so +// reduce the number of allocations on the hot path. +class ReadableStreamNative::PipeToEngine + : public GarbageCollectedFinalized<PipeToEngine> { + public: + PipeToEngine(ScriptState* script_state, PipeOptions pipe_options) + : script_state_(script_state), pipe_options_(pipe_options) {} + + // This is the main entrypoint for ReadableStreamPipeTo(). + ScriptPromise Start(ReadableStreamNative* readable, + WritableStreamNative* destination) { + // 1. Assert: ! IsReadableStream(source) is true. + DCHECK(readable); + + // 2. Assert: ! IsWritableStream(dest) is true. + DCHECK(destination); + + // Not relevant to C++ implementation: + // 3. Assert: Type(preventClose) is Boolean, Type(preventAbort) is Boolean, + // and Type(preventCancel) is Boolean. + + // TODO(ricea): Implement |signal|. + // 4. Assert: signal is undefined or signal is an instance of the + // AbortSignal interface. + + // 5. Assert: ! IsReadableStreamLocked(source) is false. + DCHECK(!ReadableStreamNative::IsLocked(readable)); + + // 6. Assert: ! IsWritableStreamLocked(dest) is false. + DCHECK(!WritableStreamNative::IsLocked(destination)); + + auto* isolate = script_state_->GetIsolate(); + ExceptionState exception_state(isolate, ExceptionState::kUnknownContext, "", + ""); + + // 7. If ! + // IsReadableByteStreamController(source.[[readableStreamController]]) is + // true, let reader be either ! AcquireReadableStreamBYOBReader(source) + // or ! AcquireReadableStreamDefaultReader(source), at the user agent’s + // discretion. + // 8. Otherwise, let reader be ! AcquireReadableStreamDefaultReader(source). + reader_ = ReadableStreamNative::AcquireDefaultReader( + script_state_, readable, false, exception_state); + DCHECK(!exception_state.HadException()); + + // 9. Let writer be ! AcquireWritableStreamDefaultWriter(dest). + writer_ = WritableStreamNative::AcquireDefaultWriter( + script_state_, destination, exception_state); + DCHECK(!exception_state.HadException()); + + // 10. Let shuttingDown be false. + DCHECK(!is_shutting_down_); + + // 11. Let promise be a new promise. + promise_ = MakeGarbageCollected<StreamPromiseResolver>(script_state_); + + // TODO(ricea): Implement abort: + // 12. If signal is not undefined, ... + + // 13. In parallel ... + // The rest of the algorithm is described in terms of a series of + // constraints rather than as explicit steps. + if (CheckInitialState()) { + // Need to detect closing and error when we are not reading. This + // corresponds to the following conditions from the standard: + // 1. Errors must be propagated forward: if source.[[state]] is or + // becomes "errored", ... + // and + // 3. Closing must be propagated forward: if source.[[state]] is or + // becomes "closed", ... + ThenPromise(reader_->ClosedPromise()->V8Promise(isolate), + &PipeToEngine::OnReaderClosed, &PipeToEngine::ReadableError); + + // Need to detect error when we are not writing. This corresponds to this + // condition from the standard: + // 2. Errors must be propagated backward: if dest.[[state]] is or + // becomes "errored", ... + // We do not need to detect closure of the writable end of the pipe, + // because we have it locked and so it can only be closed by us. + ThenPromise(writer_->ClosedPromise()->V8Promise(isolate), nullptr, + &PipeToEngine::WritableError); + + // Start the main read / write loop. + HandleNextEvent(Undefined()); + } + + // 14. Return promise. + return promise_->GetScriptPromise(script_state_); + } + + StreamPromiseResolver* Promise() { return promise_; } + + void Trace(Visitor* visitor) { + visitor->Trace(script_state_); + visitor->Trace(reader_); + visitor->Trace(writer_); + visitor->Trace(promise_); + visitor->Trace(last_write_); + visitor->Trace(shutdown_error_); + } + + private: + // The implementation uses method pointers to maximise code reuse. + + // |Action| represents an action that can be passed to the "Shutdown with an + // action" operation. Each Action is implemented as a method which delegates + // to some abstract operation, inferring the arguments from the state of + // |this|. + using Action = v8::Local<v8::Promise> (PipeToEngine::*)(); + + // This implementation uses ThenPromise() 7 times. Instead of creating a dozen + // separate subclasses of ScriptFunction, we use a single implementation and + // pass a method pointer at runtime to control the behaviour. Most + // PromiseReaction methods don't need to return a value, but because some do, + // the rest have to return undefined so that they can have the same method + // signature. Similarly, many of the methods ignore the argument that is + // passed to them. + using PromiseReaction = + v8::Local<v8::Value> (PipeToEngine::*)(v8::Local<v8::Value>); + + class WrappedPromiseReaction : public ScriptFunction { + public: + static v8::Local<v8::Function> Create(ScriptState* script_state, + PipeToEngine* instance, + PromiseReaction method) { + auto* reaction = MakeGarbageCollected<WrappedPromiseReaction>( + script_state, instance, method); + return reaction->BindToV8Function(); + } + + WrappedPromiseReaction(ScriptState* script_state, + PipeToEngine* instance, + PromiseReaction method) + : ScriptFunction(script_state), instance_(instance), method_(method) {} + + void CallRaw(const v8::FunctionCallbackInfo<v8::Value>& args) override { + DCHECK_EQ(args.Length(), 1); + auto result = (instance_->*method_)(args[0]); + args.GetReturnValue().Set(result); + } + + void Trace(Visitor* visitor) override { + visitor->Trace(instance_); + ScriptFunction::Trace(visitor); + } + + private: + Member<PipeToEngine> instance_; + PromiseReaction method_; + }; + + // Checks the state of the streams and executes the shutdown handlers if + // necessary. Returns true if piping can continue. + bool CheckInitialState() { + auto* isolate = script_state_->GetIsolate(); + const auto state = Readable()->state_; + + // Both streams can be errored or closed. To perform the right action the + // order of the checks must match the standard: "the following conditions + // must be applied in order." This method only checks the initial state; + // detection of state changes elsewhere is done through checking promise + // reactions. + + // a. Errors must be propagated forward: if source.[[state]] is or + // becomes "errored", + if (state == kErrored) { + ReadableError(Readable()->GetStoredError(isolate)); + return false; + } + + // 2. Errors must be propagated backward: if dest.[[state]] is or becomes + // "errored", + if (Destination()->IsErrored()) { + WritableError(Destination()->GetStoredError(isolate)); + return false; + } + + // 3. Closing must be propagated forward: if source.[[state]] is or + // becomes "closed", then + if (state == kClosed) { + ReadableClosed(); + return false; + } + + // 4. Closing must be propagated backward: if ! + // WritableStreamCloseQueuedOrInFlight(dest) is true or dest.[[state]] + // is "closed", + if (Destination()->IsClosingOrClosed()) { + WritableStartedClosed(); + return false; + } + + return true; + } + + // HandleNextEvent() has an unused argument and return value because it is a + // PromiseReaction. HandleNextEvent() and ReadFulfilled() call each other + // asynchronously in a loop until the pipe completes. + v8::Local<v8::Value> HandleNextEvent(v8::Local<v8::Value>) { + DCHECK(!is_reading_); + if (is_shutting_down_) { + return Undefined(); + } + + base::Optional<double> desired_size = writer_->GetDesiredSizeInternal(); + if (!desired_size.has_value()) { + // This can happen if abort() is queued but not yet started when + // pipeTo() is called. In that case [[storedError]] is not set yet, and + // we need to wait until it is before we can cancel the pipe. Once + // [[storedError]] has been set, the rejection handler set on the writer + // closed promise above will detect it, so all we need to do here is + // nothing. + return Undefined(); + } + + if (desired_size.value() <= 0) { + // Need to wait for backpressure to go away. + ThenPromise( + writer_->ReadyPromise()->V8Promise(script_state_->GetIsolate()), + &PipeToEngine::HandleNextEvent, &PipeToEngine::WritableError); + return Undefined(); + } + + is_reading_ = true; + ThenPromise(ReadableStreamDefaultReader::Read(script_state_, reader_) + ->V8Promise(script_state_->GetIsolate()), + &PipeToEngine::ReadFulfilled, &PipeToEngine::ReadRejected); + return Undefined(); + } + + v8::Local<v8::Value> ReadFulfilled(v8::Local<v8::Value> result) { + is_reading_ = false; + DCHECK(result->IsObject()); + auto* isolate = script_state_->GetIsolate(); + v8::Local<v8::Value> value; + bool done = false; + bool unpack_succeeded = + V8UnpackIteratorResult(script_state_, result.As<v8::Object>(), &done) + .ToLocal(&value); + DCHECK(unpack_succeeded); + if (done) { + ReadableClosed(); + return Undefined(); + } + const auto write = + WritableStreamDefaultWriter::Write(script_state_, writer_, value); + last_write_.Set(isolate, write); + ThenPromise(write, nullptr, &PipeToEngine::WritableError); + HandleNextEvent(Undefined()); + return Undefined(); + } + + v8::Local<v8::Value> ReadRejected(v8::Local<v8::Value>) { + is_reading_ = false; + ReadableError(Readable()->GetStoredError(script_state_->GetIsolate())); + return Undefined(); + } + + // If read() is in progress, then wait for it to tell us that the stream is + // closed so that we write all the data before shutdown. + v8::Local<v8::Value> OnReaderClosed(v8::Local<v8::Value>) { + if (!is_reading_) { + ReadableClosed(); + } + return Undefined(); + } + + // 1. Errors must be propagated forward: if source.[[state]] is or + // becomes "errored", then + v8::Local<v8::Value> ReadableError(v8::Local<v8::Value> error) { + // This function can be called during shutdown when the lock is released. + // Exit early in that case. + if (is_shutting_down_) { + return Undefined(); + } + + // a. If preventAbort is false, shutdown with an action of ! + // WritableStreamAbort(dest, source.[[storedError]]) and with + // source.[[storedError]]. + DCHECK(error->SameValue( + Readable()->GetStoredError(script_state_->GetIsolate()))); + if (!pipe_options_.prevent_abort) { + ShutdownWithAction(&PipeToEngine::WritableStreamAbortAction, error); + } else { + // b. Otherwise, shutdown with source.[[storedError]]. + Shutdown(error); + } + return Undefined(); + } + + // 2. Errors must be propagated backward: if dest.[[state]] is or becomes + // "errored", then + v8::Local<v8::Value> WritableError(v8::Local<v8::Value> error) { + // This function can be called during shutdown when the lock is released. + // Exit early in that case. + if (is_shutting_down_) { + return Undefined(); + } + + // a. If preventCancel is false, shutdown with an action of ! + // ReadableStreamCancel(source, dest.[[storedError]]) and with + // dest.[[storedError]]. + DCHECK(error->SameValue( + Destination()->GetStoredError(script_state_->GetIsolate()))); + if (!pipe_options_.prevent_cancel) { + ShutdownWithAction(&PipeToEngine::ReadableStreamCancelAction, error); + } else { + // b. Otherwise, shutdown with dest.[[storedError]]. + Shutdown(error); + } + return Undefined(); + } + + // 3. Closing must be propagated forward: if source.[[state]] is or + // becomes "closed", then + void ReadableClosed() { + // a. If preventClose is false, shutdown with an action of ! + // WritableStreamDefaultWriterCloseWithErrorPropagation(writer). + if (!pipe_options_.prevent_close) { + ShutdownWithAction( + &PipeToEngine:: + WritableStreamDefaultWriterCloseWithErrorPropagationAction, + v8::MaybeLocal<v8::Value>()); + } else { + // b. Otherwise, shutdown. + Shutdown(v8::MaybeLocal<v8::Value>()); + } + } + + // 4. Closing must be propagated backward: if ! + // WritableStreamCloseQueuedOrInFlight(dest) is true or dest.[[state]] is + // "closed", then + void WritableStartedClosed() { + // a. Assert: no chunks have been read or written. + // This is trivially true because this method is only called from + // CheckInitialState(). + + // b. Let destClosed be a new TypeError. + const auto dest_closed = v8::Exception::TypeError( + V8String(script_state_->GetIsolate(), "Destination stream closed")); + + // c. If preventCancel is false, shutdown with an action of ! + // ReadableStreamCancel(source, destClosed) and with destClosed. + if (!pipe_options_.prevent_cancel) { + ShutdownWithAction(&PipeToEngine::ReadableStreamCancelAction, + dest_closed); + } else { + // d. Otherwise, shutdown with destClosed. + Shutdown(dest_closed); + } + } + + // * Shutdown with an action: if any of the above requirements ask to shutdown + // with an action |action|, optionally with an error |originalError|, then: + void ShutdownWithAction(Action action, + v8::MaybeLocal<v8::Value> original_error) { + // a. If shuttingDown is true, abort these substeps. + if (is_shutting_down_) { + return; + } + + // b. Set shuttingDown to true. + is_shutting_down_ = true; + + // Store the action in case we need to call it asynchronously. This is safe + // because the |is_shutting_down_| guard flag ensures that we can only reach + // this assignment once. + shutdown_action_ = action; + + // Store |original_error| as |shutdown_error_| if it was supplied. + v8::Local<v8::Value> original_error_local; + if (original_error.ToLocal(&original_error_local)) { + shutdown_error_.Set(script_state_->GetIsolate(), original_error_local); + } + v8::Local<v8::Promise> p; + + // c. If dest.[[state]] is "writable" and ! + // WritableStreamCloseQueuedOrInFlight(dest) is false, + if (ShouldWriteQueuedChunks()) { + // i. If any chunks have been read but not yet written, write them to + // dest. + // ii. Wait until every chunk that has been read has been written + // (i.e. the corresponding promises have settled). + p = ThenPromise(WriteQueuedChunks(), &PipeToEngine::InvokeShutdownAction); + } else { + // d. Let p be the result of performing action. + p = InvokeShutdownAction(); + } + + // e. Upon fulfillment of p, finalize, passing along originalError if it + // was given. + // f. Upon rejection of p with reason newError, finalize with newError. + ThenPromise(p, &PipeToEngine::FinalizeWithOriginalErrorIfSet, + &PipeToEngine::FinalizeWithNewError); + } + + // * Shutdown: if any of the above requirements or steps ask to shutdown, + // optionally with an error error, then: + void Shutdown(v8::MaybeLocal<v8::Value> error_maybe) { + // a. If shuttingDown is true, abort these substeps. + if (is_shutting_down_) { + return; + } + + // b. Set shuttingDown to true. + is_shutting_down_ = true; + + // c. If dest.[[state]] is "writable" and ! + // WritableStreamCloseQueuedOrInFlight(dest) is false, + if (ShouldWriteQueuedChunks()) { + // Need to stash the value of |error_maybe| since we are calling + // Finalize() asynchronously. + v8::Local<v8::Value> error; + if (error_maybe.ToLocal(&error)) { + shutdown_error_.Set(script_state_->GetIsolate(), error); + } + + // i. If any chunks have been read but not yet written, write them to + // dest. + // ii. Wait until every chunk that has been read has been written + // (i.e. the corresponding promises have settled). + // d. Finalize, passing along error if it was given. + ThenPromise(WriteQueuedChunks(), + &PipeToEngine::FinalizeWithOriginalErrorIfSet); + } else { + // d. Finalize, passing along error if it was given. + Finalize(error_maybe); + } + } + + // Calls Finalize(), using the stored shutdown error rather than the value + // that was passed. + v8::Local<v8::Value> FinalizeWithOriginalErrorIfSet(v8::Local<v8::Value>) { + v8::MaybeLocal<v8::Value> error_maybe; + if (!shutdown_error_.IsEmpty()) { + error_maybe = shutdown_error_.NewLocal(script_state_->GetIsolate()); + } + Finalize(error_maybe); + return Undefined(); + } + + // Calls Finalize(), using the value that was passed as the error. + v8::Local<v8::Value> FinalizeWithNewError(v8::Local<v8::Value> new_error) { + Finalize(new_error); + return Undefined(); + } + + // * Finalize: both forms of shutdown will eventually ask to finalize, + // optionally with an error error, which means to perform the following + // steps: + void Finalize(v8::MaybeLocal<v8::Value> error_maybe) { + // a. Perform ! WritableStreamDefaultWriterRelease(writer). + WritableStreamDefaultWriter::Release(script_state_, writer_); + + // b. Perform ! ReadableStreamReaderGenericRelease(reader). + ReadableStreamNative::ReaderGenericRelease(script_state_, reader_); + + // TODO(ricea): Implement signal. + // c. If signal is not undefined, remove abortAlgorithm from signal. + + v8::Local<v8::Value> error; + if (error_maybe.ToLocal(&error)) { + // d. If error was given, reject promise with error. + promise_->Reject(script_state_, error); + } else { + // e. Otherwise, resolve promise with undefined. + promise_->ResolveWithUndefined(script_state_); + } + } + + bool ShouldWriteQueuedChunks() const { + // "If dest.[[state]] is "writable" and ! + // WritableStreamCloseQueuedOrInFlight(dest) is false" + return Destination()->IsWritable() && + !WritableStreamNative::CloseQueuedOrInFlight(Destination()); + } + + v8::Local<v8::Promise> WriteQueuedChunks() { + if (!last_write_.IsEmpty()) { + // "Wait until every chunk that has been read has been written (i.e. + // the corresponding promises have settled)" + // This implies that we behave the same whether the promise fulfills or + // rejects. IgnoreErrors() will convert a rejection into a successful + // resolution. + return ThenPromise(last_write_.NewLocal(script_state_->GetIsolate()), + nullptr, &PipeToEngine::IgnoreErrors); + } + return PromiseResolveWithUndefined(script_state_); + } + + v8::Local<v8::Value> IgnoreErrors(v8::Local<v8::Value>) { + return Undefined(); + } + + // InvokeShutdownAction(), version for calling directly. + v8::Local<v8::Promise> InvokeShutdownAction() { + return (this->*shutdown_action_)(); + } + + // InvokeShutdownAction(), version for use as a PromiseReaction. + v8::Local<v8::Value> InvokeShutdownAction(v8::Local<v8::Value>) { + return InvokeShutdownAction(); + } + + v8::Local<v8::Value> ShutdownError() const { + DCHECK(!shutdown_error_.IsEmpty()); + return shutdown_error_.NewLocal(script_state_->GetIsolate()); + } + + v8::Local<v8::Promise> WritableStreamAbortAction() { + return WritableStreamNative::Abort(script_state_, Destination(), + ShutdownError()); + } + + v8::Local<v8::Promise> ReadableStreamCancelAction() { + return ReadableStreamNative::Cancel(script_state_, Readable(), + ShutdownError()); + } + + v8::Local<v8::Promise> + WritableStreamDefaultWriterCloseWithErrorPropagationAction() { + return WritableStreamDefaultWriter::CloseWithErrorPropagation(script_state_, + writer_); + } + + // Reduces the visual noise when we are returning an undefined value. + v8::Local<v8::Value> Undefined() { + return v8::Undefined(script_state_->GetIsolate()); + } + + WritableStreamNative* Destination() { return writer_->OwnerWritableStream(); } + + const WritableStreamNative* Destination() const { + return writer_->OwnerWritableStream(); + } + + ReadableStreamNative* Readable() { return reader_->owner_readable_stream_; } + + // Performs promise.then(on_fulfilled, on_rejected). The logic in this method + // is identical to StreamPromiseThen(), but the types are different. It's not + // possible to share the logic without using complex templates, which would + // duplicate the object code anyway. + v8::Local<v8::Promise> ThenPromise(v8::Local<v8::Promise> promise, + PromiseReaction on_fulfilled, + PromiseReaction on_rejected = nullptr) { + auto context = script_state_->GetContext(); + v8::MaybeLocal<v8::Promise> result_maybe; + if (!on_fulfilled) { + DCHECK(on_rejected); + result_maybe = promise->Catch( + context, + WrappedPromiseReaction::Create(script_state_, this, on_rejected)); + } else if (on_rejected) { + result_maybe = promise->Then( + context, + WrappedPromiseReaction::Create(script_state_, this, on_fulfilled), + WrappedPromiseReaction::Create(script_state_, this, on_rejected)); + } else { + result_maybe = promise->Then( + context, + WrappedPromiseReaction::Create(script_state_, this, on_fulfilled)); + } + + v8::Local<v8::Promise> result; + if (!result_maybe.ToLocal(&result)) { + DVLOG(3) << "assuming that failure of promise->Then() is caused by " + "shutdown and ignoring it"; + // Try to create a dummy promise so that the calling code can continue. If + // we can't create one, then we can't return to the calling context so we + // have to crash. This shouldn't happen except on OOM. + result = + v8::Promise::Resolver::New(context).ToLocalChecked()->GetPromise(); + } + return result; + } + + Member<ScriptState> script_state_; + PipeOptions pipe_options_; + Member<ReadableStreamDefaultReader> reader_; + Member<WritableStreamDefaultWriter> writer_; + Member<StreamPromiseResolver> promise_; + TraceWrapperV8Reference<v8::Promise> last_write_; + Action shutdown_action_; + TraceWrapperV8Reference<v8::Value> shutdown_error_; + bool is_shutting_down_ = false; + bool is_reading_ = false; + + DISALLOW_COPY_AND_ASSIGN(PipeToEngine); +}; + class ReadableStreamNative::TeeEngine final : public GarbageCollectedFinalized<TeeEngine> { public: @@ -58,9 +663,9 @@ class PullAlgorithm; class CancelAlgorithm; - TraceWrapperMember<ReadableStreamNative> stream_; - TraceWrapperMember<ReadableStreamDefaultReader> reader_; - TraceWrapperMember<StreamPromiseResolver> cancel_promise_; + Member<ReadableStreamNative> stream_; + Member<ReadableStreamDefaultReader> reader_; + Member<StreamPromiseResolver> cancel_promise_; bool closed_ = false; // The standard contains a number of pairs of variables with one for each @@ -69,8 +674,8 @@ // to "canceled1" in the standard. bool canceled_[2] = {false, false}; TraceWrapperV8Reference<v8::Value> reason_[2]; - TraceWrapperMember<ReadableStreamNative> branch_[2]; - TraceWrapperMember<ReadableStreamDefaultController> controller_[2]; + Member<ReadableStreamNative> branch_[2]; + Member<ReadableStreamDefaultController> controller_[2]; DISALLOW_COPY_AND_ASSIGN(TeeEngine); }; @@ -190,10 +795,10 @@ } private: - TraceWrapperMember<TeeEngine> engine_; + Member<TeeEngine> engine_; }; - TraceWrapperMember<TeeEngine> engine_; + Member<TeeEngine> engine_; }; class ReadableStreamNative::TeeEngine::CancelAlgorithm final @@ -249,7 +854,7 @@ } private: - TraceWrapperMember<TeeEngine> engine_; + Member<TeeEngine> engine_; const int branch_; }; @@ -359,7 +964,7 @@ } private: - TraceWrapperMember<TeeEngine> engine_; + Member<TeeEngine> engine_; }; // 18. Upon rejection of reader.[[closedPromise]] with reason r, @@ -390,7 +995,7 @@ } private: - const TraceWrapperMember<ReadableStreamDefaultReader> reader_; + const Member<ReadableStreamDefaultReader> reader_; }; ReadableStreamNative* ReadableStreamNative::Create( @@ -518,46 +1123,23 @@ auto context = script_state->GetContext(); auto* isolate = script_state->GetIsolate(); - // TODO(ricea): Share some of this code with WritableStreamNative. - - auto underlying_source_value = raw_underlying_source.V8Value(); - if (underlying_source_value->IsUndefined()) { - underlying_source_value = v8::Object::New(isolate); - } - v8::TryCatch try_catch(isolate); v8::Local<v8::Object> underlying_source; - if (!underlying_source_value->ToObject(context).ToLocal(&underlying_source)) { - exception_state.RethrowV8Exception(try_catch.Exception()); - return; - } - - auto strategy_value = raw_strategy.V8Value(); - if (strategy_value->IsUndefined()) { - strategy_value = v8::Object::New(isolate); - } - v8::Local<v8::Object> strategy; - v8::MaybeLocal<v8::Object> strategy_maybe = strategy_value->ToObject(context); - if (!strategy_maybe.ToLocal(&strategy)) { - exception_state.RethrowV8Exception(try_catch.Exception()); + ScriptValueToObject(script_state, raw_underlying_source, &underlying_source, + exception_state); + if (exception_state.HadException()) { return; } // 2. Let size be ? GetV(strategy, "size"). - v8::Local<v8::Value> size; - if (!strategy->Get(context, V8AtomicString(isolate, "size")).ToLocal(&size)) { - exception_state.RethrowV8Exception(try_catch.Exception()); - return; - } - // 3. Let highWaterMark be ? GetV(strategy, "highWaterMark"). - v8::Local<v8::Value> high_water_mark_value; - if (!strategy->Get(context, V8AtomicString(isolate, "highWaterMark")) - .ToLocal(&high_water_mark_value)) { - exception_state.RethrowV8Exception(try_catch.Exception()); + StrategyUnpacker strategy_unpacker(script_state, raw_strategy, + exception_state); + if (exception_state.HadException()) { return; } // 4. Let type be ? GetV(underlyingSource, "type"). + v8::TryCatch try_catch(isolate); v8::Local<v8::Value> type; if (!underlying_source->Get(context, V8AtomicString(isolate, "type")) .ToLocal(&type)) { @@ -588,31 +1170,17 @@ // 7. Otherwise, if type is undefined, // a. Let sizeAlgorithm be ? MakeSizeAlgorithmFromSizeFunction(size). auto* size_algorithm = - MakeSizeAlgorithmFromSizeFunction(script_state, size, exception_state); + strategy_unpacker.MakeSizeAlgorithm(script_state, exception_state); if (exception_state.HadException()) { return; } DCHECK(size_algorithm); - // 2. If highWaterMark is undefined, let highWaterMark be 1. - double high_water_mark = 1; - if (!high_water_mark_value->IsUndefined()) { - // The conversion to Number which happens inside - // ValidateAndNormalizeHighWaterMark in the standard is performed beforehand - // here. - v8::Local<v8::Number> high_water_mark_as_number; - if (!high_water_mark_value->ToNumber(context).ToLocal( - &high_water_mark_as_number)) { - exception_state.RethrowV8Exception(try_catch.Exception()); - return; - } - high_water_mark = high_water_mark_as_number->Value(); - } - - // 3. Set highWaterMark to ? ValidateAndNormalizeHighWaterMark( - // highWaterMark). - high_water_mark = - ValidateAndNormalizeHighWaterMark(high_water_mark, exception_state); + // b. If highWaterMark is undefined, let highWaterMark be 1. + // c. Set highWaterMark to ? ValidateAndNormalizeHighWaterMark( + // highWaterMark). + double high_water_mark = + strategy_unpacker.GetHighWaterMark(script_state, 1, exception_state); if (exception_state.HadException()) { return; } @@ -700,8 +1268,37 @@ ScriptValue transform_stream, ScriptValue options, ExceptionState& exception_state) { - exception_state.ThrowTypeError("pipeThrough not yet implemented"); - return ScriptValue(); + // TODO(ricea): Get the order of operations to strictly match the standard. + ScriptValue readable; + WritableStream* writable; + PipeThroughExtractReadableWritable(script_state, this, transform_stream, + &readable, &writable, exception_state); + if (exception_state.HadException()) { + return ScriptValue(); + } + + PipeOptions pipe_options; + UnpackPipeOptions(script_state, options, &pipe_options, exception_state); + + DCHECK(RuntimeEnabledFeatures::StreamsNativeEnabled()); + + // This cast is safe because the following code will only be run when the + // native version of WritableStream is in use. + WritableStreamNative* writable_native = + static_cast<WritableStreamNative*>(writable); + + // 8. Let _promise_ be ! ReadableStreamPipeTo(*this*, _writable_, + // _preventClose_, _preventAbort_, _preventCancel_, + // _signal_). + + ScriptPromise promise = + PipeTo(script_state, this, writable_native, pipe_options); + + // 9. Set _promise_.[[PromiseIsHandled]] to *true*. + promise.MarkAsHandled(); + + // 10. Return _readable_. + return readable; } ScriptPromise ReadableStreamNative::pipeTo(ScriptState* script_state, @@ -717,8 +1314,24 @@ ScriptValue destination_value, ScriptValue options, ExceptionState& exception_state) { - exception_state.ThrowTypeError("pipeTo not yet implemented"); - return ScriptPromise(); + WritableStream* destination = PipeToCheckSourceAndDestination( + script_state, this, destination_value, exception_state); + if (exception_state.HadException()) { + return ScriptPromise(); + } + CHECK(destination); + + PipeOptions pipe_options; + UnpackPipeOptions(script_state, options, &pipe_options, exception_state); + + DCHECK(RuntimeEnabledFeatures::StreamsNativeEnabled()); + + // This cast is safe because the following code will only be run when the + // native version of WritableStream is in use. + WritableStreamNative* destination_native = + static_cast<WritableStreamNative*>(destination); + + return PipeTo(script_state, this, destination_native, pipe_options); } ScriptValue ReadableStreamNative::tee(ScriptState* script_state, @@ -828,6 +1441,14 @@ ReadableStream::Trace(visitor); } +ScriptPromise ReadableStreamNative::PipeTo(ScriptState* script_state, + ReadableStreamNative* readable, + WritableStreamNative* destination, + PipeOptions pipe_options) { + auto* engine = MakeGarbageCollected<PipeToEngine>(script_state, pipe_options); + return engine->Start(readable, destination); +} + // // Abstract Operations Used By Controllers // @@ -1190,6 +1811,61 @@ // TODO(ricea): Functions for transferable streams. // +void ReadableStreamNative::UnpackPipeOptions(ScriptState* script_state, + ScriptValue options, + PipeOptions* pipe_options, + ExceptionState& exception_state) { + auto* isolate = script_state->GetIsolate(); + v8::TryCatch block(isolate); + v8::Local<v8::Value> options_value = options.V8Value(); + v8::Local<v8::Object> options_object; + if (options_value->IsUndefined()) { + options_object = v8::Object::New(isolate); + } else if (!options_value->ToObject(script_state->GetContext()) + .ToLocal(&options_object)) { + exception_state.RethrowV8Exception(block.Exception()); + return; + } + + // 4. Set preventClose to ! ToBoolean(preventClose), set preventAbort to ! + // ToBoolean(preventAbort), and set preventCancel to ! + // ToBoolean(preventCancel). + pipe_options->prevent_close = + GetBoolean(script_state, options_object, "preventClose", exception_state); + if (exception_state.HadException()) { + return; + } + + pipe_options->prevent_abort = + GetBoolean(script_state, options_object, "preventAbort", exception_state); + if (exception_state.HadException()) { + return; + } + + pipe_options->prevent_cancel = GetBoolean(script_state, options_object, + "preventCancel", exception_state); + if (exception_state.HadException()) { + return; + } +} + +bool ReadableStreamNative::GetBoolean(ScriptState* script_state, + v8::Local<v8::Object> dictionary, + const char* property_name, + ExceptionState& exception_state) { + auto* isolate = script_state->GetIsolate(); + v8::TryCatch block(isolate); + v8::Local<v8::Value> property_value; + if (!dictionary + ->Get(script_state->GetContext(), + V8AtomicString(isolate, property_name)) + .ToLocal(&property_value)) { + exception_state.RethrowV8Exception(block.Exception()); + return false; + } + return property_value->ToBoolean(isolate)->Value(); +} + void ReadableStreamNative::CallNullaryMethod(ScriptState* script_state, v8::Local<v8::Object> object, const char* method_name) {
diff --git a/third_party/blink/renderer/core/streams/readable_stream_native.h b/third_party/blink/renderer/core/streams/readable_stream_native.h index 0ef478ff..6af6126 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_native.h +++ b/third_party/blink/renderer/core/streams/readable_stream_native.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/core/streams/readable_stream.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "v8/include/v8.h" @@ -25,6 +24,7 @@ class StreamStartAlgorithm; class UnderlyingSourceBase; class Visitor; +class WritableStreamNative; // C++ implementation of ReadableStream. // See https://streams.spec.whatwg.org/#rs-model for background. @@ -190,6 +190,8 @@ friend class ReadableStreamDefaultController; friend class ReadableStreamDefaultReader; + struct PipeOptions; + class PipeToEngine; class ReadHandleImpl; class TeeEngine; @@ -203,6 +205,12 @@ bool for_author_code, ExceptionState&); + // https://streams.spec.whatwg.org/#readable-stream-pipe-to + static ScriptPromise PipeTo(ScriptState*, + ReadableStreamNative*, + WritableStreamNative*, + PipeOptions); + // https://streams.spec.whatwg.org/#readable-stream-add-read-request static StreamPromiseResolver* AddReadRequest(ScriptState*, ReadableStreamNative*); @@ -253,6 +261,16 @@ // TODO(ricea): Functions for transferable streams. // + static void UnpackPipeOptions(ScriptState*, + ScriptValue options, + PipeOptions*, + ExceptionState&); + + static bool GetBoolean(ScriptState*, + v8::Local<v8::Object> dictionary, + const char* property_name, + ExceptionState&); + // Calls method |method_name| on |object|, passing no arguments, and ignoring // errors. Used for Blink lock notifications. static void CallNullaryMethod(ScriptState*, @@ -261,9 +279,8 @@ bool is_disturbed_ = false; State state_ = kReadable; - TraceWrapperMember<ReadableStreamDefaultController> - readable_stream_controller_; - TraceWrapperMember<ReadableStreamDefaultReader> reader_; + Member<ReadableStreamDefaultController> readable_stream_controller_; + Member<ReadableStreamDefaultReader> reader_; TraceWrapperV8Reference<v8::Value> stored_error_; };
diff --git a/third_party/blink/renderer/core/streams/readable_stream_wrapper.h b/third_party/blink/renderer/core/streams/readable_stream_wrapper.h index 108e261..134ccbc9 100644 --- a/third_party/blink/renderer/core/streams/readable_stream_wrapper.h +++ b/third_party/blink/renderer/core/streams/readable_stream_wrapper.h
@@ -14,7 +14,7 @@ namespace blink { // This is an implementation of the corresponding IDL interface. -// Use TraceWrapperMember to hold a reference to an instance of this class. +// Use Member to hold a reference to an instance of this class. class CORE_EXPORT ReadableStreamWrapper : public ReadableStream { public: // Call one of Init functions before using the instance.
diff --git a/third_party/blink/renderer/core/streams/transform_stream.h b/third_party/blink/renderer/core/streams/transform_stream.h index 602a383..76aa9962 100644 --- a/third_party/blink/renderer/core/streams/transform_stream.h +++ b/third_party/blink/renderer/core/streams/transform_stream.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/heap.h" @@ -28,13 +27,13 @@ // Creates and wraps a JavaScript TransformStream object with a transformation // defined in C++. Provides access to the readable and writable streams. // -// On-heap references to this class must always be via a TraceWrapperMember, and +// On-heap references to this class must always be via a Member, and // must always have an ancestor in the V8 heap, or the internal JavaScript // objects owned by |readable_| and |writable_| will be lost. // // To ensure that the JS TransformStream is always referenced, this class uses // two-stage construction. After calling the constructor, store the reference -// in a TraceWrapperMember before calling Init(). Init() must always be called +// in a Member before calling Init(). Init() must always be called // before using the instance. class CORE_EXPORT TransformStream final : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO(); @@ -86,8 +85,8 @@ v8::Local<v8::Object> stream, ExceptionState&); - TraceWrapperMember<ReadableStream> readable_; - TraceWrapperMember<WritableStream> writable_; + Member<ReadableStream> readable_; + Member<WritableStream> writable_; DISALLOW_COPY_AND_ASSIGN(TransformStream); };
diff --git a/third_party/blink/renderer/core/streams/transform_stream_test.cc b/third_party/blink/renderer/core/streams/transform_stream_test.cc index abeaa2f..607778d 100644 --- a/third_party/blink/renderer/core/streams/transform_stream_test.cc +++ b/third_party/blink/renderer/core/streams/transform_stream_test.cc
@@ -24,7 +24,6 @@ #include "third_party/blink/renderer/platform/bindings/microtask.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/to_v8.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/v8_binding.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "v8/include/v8.h" @@ -105,7 +104,7 @@ private: // Self-reference to keep this object referenced from V8. ScriptValue this_as_v8_value_; - TraceWrapperMember<TransformStream> stream_; + Member<TransformStream> stream_; }; Persistent<Holder> holder_;
diff --git a/third_party/blink/renderer/core/streams/underlying_source_base.h b/third_party/blink/renderer/core/streams/underlying_source_base.h index ef10266..55abd8e 100644 --- a/third_party/blink/renderer/core/streams/underlying_source_base.h +++ b/third_party/blink/renderer/core/streams/underlying_source_base.h
@@ -13,7 +13,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -60,7 +59,7 @@ } private: - TraceWrapperMember<ReadableStreamDefaultControllerInterface> controller_; + Member<ReadableStreamDefaultControllerInterface> controller_; bool is_stream_locked_ = false; };
diff --git a/third_party/blink/renderer/core/streams/writable_stream.h b/third_party/blink/renderer/core/streams/writable_stream.h index 0520505..306702d 100644 --- a/third_party/blink/renderer/core/streams/writable_stream.h +++ b/third_party/blink/renderer/core/streams/writable_stream.h
@@ -17,7 +17,7 @@ class MessagePort; // This is an implementation of the corresponding IDL interface. -// Use TraceWrapperMember to hold a reference to an instance of this class. +// Use Member to hold a reference to an instance of this class. class CORE_EXPORT WritableStream : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO();
diff --git a/third_party/blink/renderer/core/streams/writable_stream_default_controller.cc b/third_party/blink/renderer/core/streams/writable_stream_default_controller.cc index 5f7f65a..3664a32 100644 --- a/third_party/blink/renderer/core/streams/writable_stream_default_controller.cc +++ b/third_party/blink/renderer/core/streams/writable_stream_default_controller.cc
@@ -165,7 +165,7 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; + Member<WritableStreamNative> stream_; }; class RejectPromiseFunction final : public StreamScriptFunction { @@ -195,7 +195,7 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; + Member<WritableStreamNative> stream_; }; StreamThenPromise( @@ -513,7 +513,7 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; + Member<WritableStreamNative> stream_; }; class RejectFunction final : public StreamScriptFunction { @@ -535,7 +535,7 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; + Member<WritableStreamNative> stream_; }; StreamThenPromise(script_state->GetContext(), sinkClosePromise, @@ -612,8 +612,8 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; - TraceWrapperMember<WritableStreamDefaultController> controller_; + Member<WritableStreamNative> stream_; + Member<WritableStreamDefaultController> controller_; }; class RejectFunction : public StreamScriptFunction { @@ -647,8 +647,8 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; - TraceWrapperMember<WritableStreamDefaultController> controller_; + Member<WritableStreamNative> stream_; + Member<WritableStreamDefaultController> controller_; }; StreamThenPromise(
diff --git a/third_party/blink/renderer/core/streams/writable_stream_default_controller.h b/third_party/blink/renderer/core/streams/writable_stream_default_controller.h index 6f77798..cc415df8 100644 --- a/third_party/blink/renderer/core/streams/writable_stream_default_controller.h +++ b/third_party/blink/renderer/core/streams/writable_stream_default_controller.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_STREAMS_WRITABLE_STREAM_DEFAULT_CONTROLLER_H_ #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "v8/include/v8.h" namespace blink { @@ -124,20 +123,20 @@ // Most member variables correspond 1:1 with the internal slots in the // standard. See // https://streams.spec.whatwg.org/#ws-default-controller-internal-slots. - TraceWrapperMember<StreamAlgorithm> abort_algorithm_; - TraceWrapperMember<StreamAlgorithm> close_algorithm_; - TraceWrapperMember<WritableStreamNative> controlled_writable_stream_; + Member<StreamAlgorithm> abort_algorithm_; + Member<StreamAlgorithm> close_algorithm_; + Member<WritableStreamNative> controlled_writable_stream_; // |queue_| covers both the [[queue]] and [[queueTotalSize]] internal slots. // Instead of chunks in the queue being wrapped in an object, they are // stored-as-is, and the `"close"` marker in the queue is represented by an // empty queue together with the |close_queued_| flag being set. - TraceWrapperMember<QueueWithSizes> queue_; + Member<QueueWithSizes> queue_; bool close_queued_ = false; bool started_ = false; double strategy_high_water_mark_ = 0.0; - TraceWrapperMember<StrategySizeAlgorithm> strategy_size_algorithm_; - TraceWrapperMember<StreamAlgorithm> write_algorithm_; + Member<StrategySizeAlgorithm> strategy_size_algorithm_; + Member<StreamAlgorithm> write_algorithm_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/streams/writable_stream_default_writer.h b/third_party/blink/renderer/core/streams/writable_stream_default_writer.h index e988af67..1bb5bea 100644 --- a/third_party/blink/renderer/core/streams/writable_stream_default_writer.h +++ b/third_party/blink/renderer/core/streams/writable_stream_default_writer.h
@@ -7,7 +7,6 @@ #include "base/optional.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "v8/include/v8.h" namespace blink { @@ -131,9 +130,9 @@ // |closed_promise_| and |ready_promise_| are implemented as resolvers. The // names come from the slots [[closedPromise]] and [[readyPromise]] in the // standard. - TraceWrapperMember<StreamPromiseResolver> closed_promise_; - TraceWrapperMember<WritableStreamNative> owner_writable_stream_; - TraceWrapperMember<StreamPromiseResolver> ready_promise_; + Member<StreamPromiseResolver> closed_promise_; + Member<WritableStreamNative> owner_writable_stream_; + Member<StreamPromiseResolver> ready_promise_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/streams/writable_stream_native.cc b/third_party/blink/renderer/core/streams/writable_stream_native.cc index 47e0a94..40790ea 100644 --- a/third_party/blink/renderer/core/streams/writable_stream_native.cc +++ b/third_party/blink/renderer/core/streams/writable_stream_native.cc
@@ -52,7 +52,7 @@ } private: - TraceWrapperMember<StreamPromiseResolver> promise_; + Member<StreamPromiseResolver> promise_; TraceWrapperV8Reference<v8::Value> reason_; const bool was_already_erroring_; @@ -74,44 +74,23 @@ auto context = script_state->GetContext(); auto* isolate = script_state->GetIsolate(); - auto underlying_sink_value = raw_underlying_sink.V8Value(); - if (underlying_sink_value->IsUndefined()) { - underlying_sink_value = v8::Object::New(isolate); - } - v8::TryCatch try_catch(isolate); v8::Local<v8::Object> underlying_sink; - if (!underlying_sink_value->ToObject(context).ToLocal(&underlying_sink)) { - exception_state.RethrowV8Exception(try_catch.Exception()); - return; - } - - auto strategy_value = raw_strategy.V8Value(); - if (strategy_value->IsUndefined()) { - strategy_value = v8::Object::New(isolate); - } - v8::Local<v8::Object> strategy; - v8::MaybeLocal<v8::Object> strategy_maybe = strategy_value->ToObject(context); - if (!strategy_maybe.ToLocal(&strategy)) { - exception_state.RethrowV8Exception(try_catch.Exception()); + ScriptValueToObject(script_state, raw_underlying_sink, &underlying_sink, + exception_state); + if (exception_state.HadException()) { return; } // 2. Let size be ? GetV(strategy, "size"). - v8::Local<v8::Value> size; - if (!strategy->Get(context, V8AtomicString(isolate, "size")).ToLocal(&size)) { - exception_state.RethrowV8Exception(try_catch.Exception()); - return; - } - // 3. Let highWaterMark be ? GetV(strategy, "highWaterMark"). - v8::Local<v8::Value> high_water_mark_value; - if (!strategy->Get(context, V8AtomicString(isolate, "highWaterMark")) - .ToLocal(&high_water_mark_value)) { - exception_state.RethrowV8Exception(try_catch.Exception()); + StrategyUnpacker strategy_unpacker(script_state, raw_strategy, + exception_state); + if (exception_state.HadException()) { return; } // 4. Let type be ? GetV(underlyingSink, "type"). + v8::TryCatch try_catch(isolate); v8::Local<v8::Value> type; if (!underlying_sink->Get(context, V8AtomicString(isolate, "type")) .ToLocal(&type)) { @@ -127,27 +106,16 @@ // 6. Let sizeAlgorithm be ? MakeSizeAlgorithmFromSizeFunction(size). auto* size_algorithm = - MakeSizeAlgorithmFromSizeFunction(script_state, size, exception_state); + strategy_unpacker.MakeSizeAlgorithm(script_state, exception_state); if (exception_state.HadException()) { return; } DCHECK(size_algorithm); // 7. If highWaterMark is undefined, let highWaterMark be 1. - double high_water_mark = 1; - if (!high_water_mark_value->IsUndefined()) { - v8::Local<v8::Number> high_water_mark_as_number; - if (!high_water_mark_value->ToNumber(context).ToLocal( - &high_water_mark_as_number)) { - exception_state.RethrowV8Exception(try_catch.Exception()); - return; - } - high_water_mark = high_water_mark_as_number->Value(); - } - // 8. Set highWaterMark to ? ValidateAndNormalizeHighWaterMark(highWaterMark). - high_water_mark = - ValidateAndNormalizeHighWaterMark(high_water_mark, exception_state); + double high_water_mark = + strategy_unpacker.GetHighWaterMark(script_state, 1, exception_state); if (exception_state.HadException()) { return; } @@ -494,8 +462,8 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; - TraceWrapperMember<StreamPromiseResolver> promise_; + Member<WritableStreamNative> stream_; + Member<StreamPromiseResolver> promise_; }; class RejectPromiseFunction final : public StreamScriptFunction { @@ -524,8 +492,8 @@ } private: - TraceWrapperMember<WritableStreamNative> stream_; - TraceWrapperMember<StreamPromiseResolver> promise_; + Member<WritableStreamNative> stream_; + Member<StreamPromiseResolver> promise_; }; StreamThenPromise(script_state->GetContext(), promise,
diff --git a/third_party/blink/renderer/core/streams/writable_stream_native.h b/third_party/blink/renderer/core/streams/writable_stream_native.h index 16eef580..8907563 100644 --- a/third_party/blink/renderer/core/streams/writable_stream_native.h +++ b/third_party/blink/renderer/core/streams/writable_stream_native.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/streams/writable_stream.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "third_party/blink/renderer/platform/heap/member.h" @@ -189,7 +188,7 @@ void Trace(Visitor*) override; private: - using PromiseQueue = HeapDeque<TraceWrapperMember<StreamPromiseResolver>>; + using PromiseQueue = HeapDeque<Member<StreamPromiseResolver>>; class PendingAbortRequest; @@ -217,14 +216,13 @@ // |state_| is here out of order so it doesn't require 7 bytes of padding. State state_ = kWritable; - TraceWrapperMember<StreamPromiseResolver> close_request_; - TraceWrapperMember<StreamPromiseResolver> in_flight_write_request_; - TraceWrapperMember<StreamPromiseResolver> in_flight_close_request_; - TraceWrapperMember<PendingAbortRequest> pending_abort_request_; + Member<StreamPromiseResolver> close_request_; + Member<StreamPromiseResolver> in_flight_write_request_; + Member<StreamPromiseResolver> in_flight_close_request_; + Member<PendingAbortRequest> pending_abort_request_; TraceWrapperV8Reference<v8::Value> stored_error_; - TraceWrapperMember<WritableStreamDefaultController> - writable_stream_controller_; - TraceWrapperMember<WritableStreamDefaultWriter> writer_; + Member<WritableStreamDefaultController> writable_stream_controller_; + Member<WritableStreamDefaultWriter> writer_; PromiseQueue write_requests_; };
diff --git a/third_party/blink/renderer/core/streams/writable_stream_wrapper.h b/third_party/blink/renderer/core/streams/writable_stream_wrapper.h index 81f2e96a..9ee76b0 100644 --- a/third_party/blink/renderer/core/streams/writable_stream_wrapper.h +++ b/third_party/blink/renderer/core/streams/writable_stream_wrapper.h
@@ -18,7 +18,7 @@ class MessagePort; // This is an implementation of the WritableStream interface that delegates to -// the V8 Extras implementation. Use TraceWrapperMember to hold a reference to +// the V8 Extras implementation. Use Member to hold a reference to // an instance of this class. class CORE_EXPORT WritableStreamWrapper final : public WritableStream { public:
diff --git a/third_party/blink/renderer/core/svg/properties/svg_animated_property.h b/third_party/blink/renderer/core/svg/properties/svg_animated_property.h index 2c60a2c..fcb9952 100644 --- a/third_party/blink/renderer/core/svg/properties/svg_animated_property.h +++ b/third_party/blink/renderer/core/svg/properties/svg_animated_property.h
@@ -37,7 +37,6 @@ #include "third_party/blink/renderer/core/svg/properties/svg_property_info.h" #include "third_party/blink/renderer/core/svg/properties/svg_property_tear_off.h" #include "third_party/blink/renderer/core/svg/svg_parsing_error.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/member.h" namespace blink { @@ -110,7 +109,7 @@ const unsigned initial_value_storage_ : kInitialValueStorageBits; unsigned base_value_needs_synchronization_ : 1; - TraceWrapperMember<SVGElement> context_element_; + Member<SVGElement> context_element_; const QualifiedName& attribute_name_; DISALLOW_COPY_AND_ASSIGN(SVGAnimatedPropertyBase); };
diff --git a/third_party/blink/renderer/core/svg/properties/svg_property_tear_off.h b/third_party/blink/renderer/core/svg/properties/svg_property_tear_off.h index 8b857a2..d8edb88 100644 --- a/third_party/blink/renderer/core/svg/properties/svg_property_tear_off.h +++ b/third_party/blink/renderer/core/svg/properties/svg_property_tear_off.h
@@ -33,7 +33,6 @@ #include "third_party/blink/renderer/core/svg/properties/svg_property.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -74,7 +73,7 @@ void EnsureAnimValUpdated(); private: - TraceWrapperMember<SVGElement> context_element_; + Member<SVGElement> context_element_; Member<SVGAnimatedPropertyBase> binding_; PropertyIsAnimValType property_is_anim_val_; };
diff --git a/third_party/blink/renderer/core/svg/svg_matrix_tear_off.h b/third_party/blink/renderer/core/svg/svg_matrix_tear_off.h index 8c735691..1cf767e 100644 --- a/third_party/blink/renderer/core/svg/svg_matrix_tear_off.h +++ b/third_party/blink/renderer/core/svg/svg_matrix_tear_off.h
@@ -33,7 +33,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/transforms/affine_transform.h" @@ -99,7 +98,7 @@ AffineTransform static_value_; - TraceWrapperMember<SVGTransformTearOff> context_transform_; + Member<SVGTransformTearOff> context_transform_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/svg/svg_script_element.h b/third_party/blink/renderer/core/svg/svg_script_element.h index 8f472203..6299da1 100644 --- a/third_party/blink/renderer/core/svg/svg_script_element.h +++ b/third_party/blink/renderer/core/svg/svg_script_element.h
@@ -105,7 +105,7 @@ bool have_fired_load_ = false; - TraceWrapperMember<ScriptLoader> loader_; + Member<ScriptLoader> loader_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/testing/death_aware_script_wrappable.h b/third_party/blink/renderer/core/testing/death_aware_script_wrappable.h index 4105e8f..6f19681 100644 --- a/third_party/blink/renderer/core/testing/death_aware_script_wrappable.h +++ b/third_party/blink/renderer/core/testing/death_aware_script_wrappable.h
@@ -7,7 +7,6 @@ #include <signal.h> #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/heap.h" namespace blink { @@ -28,7 +27,7 @@ virtual void Trace(Visitor* visitor) { visitor->Trace(dependency_); } private: - TraceWrapperMember<DeathAwareScriptWrappable> dependency_; + Member<DeathAwareScriptWrappable> dependency_; }; } // namespace internal @@ -42,7 +41,7 @@ static bool has_died_; public: - typedef TraceWrapperMember<DeathAwareScriptWrappable> Wrapper; + typedef Member<DeathAwareScriptWrappable> Wrapper; static DeathAwareScriptWrappable* Create() { return MakeGarbageCollected<DeathAwareScriptWrappable>();
diff --git a/third_party/blink/renderer/core/testing/dictionary_test.h b/third_party/blink/renderer/core/testing/dictionary_test.h index 12e47ef..21858b4 100644 --- a/third_party/blink/renderer/core/testing/dictionary_test.h +++ b/third_party/blink/renderer/core/testing/dictionary_test.h
@@ -99,7 +99,7 @@ base::Optional<HashMap<String, String>> dictionary_member_properties_; InternalEnumOrInternalEnumSequence internal_enum_or_internal_enum_sequence_; ScriptValue any_member_; - TraceWrapperMember<V8TestCallback> callback_function_member_; + Member<V8TestCallback> callback_function_member_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/timing/dom_window_performance.h b/third_party/blink/renderer/core/timing/dom_window_performance.h index f2e38bad..af829ec5 100644 --- a/third_party/blink/renderer/core/timing/dom_window_performance.h +++ b/third_party/blink/renderer/core/timing/dom_window_performance.h
@@ -33,7 +33,7 @@ private: WindowPerformance* performance(); - TraceWrapperMember<WindowPerformance> performance_; + Member<WindowPerformance> performance_; DISALLOW_COPY_AND_ASSIGN(DOMWindowPerformance); };
diff --git a/third_party/blink/renderer/core/timing/performance.h b/third_party/blink/renderer/core/timing/performance.h index aad8b37d..a543900f 100644 --- a/third_party/blink/renderer/core/timing/performance.h +++ b/third_party/blink/renderer/core/timing/performance.h
@@ -74,8 +74,8 @@ class UserTiming; class V8ObjectBuilder; -using PerformanceEntryVector = HeapVector<TraceWrapperMember<PerformanceEntry>>; -using PerformanceEntryDeque = HeapDeque<TraceWrapperMember<PerformanceEntry>>; +using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; +using PerformanceEntryDeque = HeapDeque<Member<PerformanceEntry>>; class CORE_EXPORT Performance : public EventTargetWithInlineData { DEFINE_WRAPPERTYPEINFO(); @@ -326,7 +326,7 @@ unsigned element_timing_buffer_max_size_; PerformanceEntryVector layout_jank_buffer_; Member<PerformanceEntry> navigation_timing_; - TraceWrapperMember<UserTiming> user_timing_; + Member<UserTiming> user_timing_; Member<PerformanceEntry> first_paint_timing_; Member<PerformanceEntry> first_contentful_paint_timing_; Member<PerformanceEventTiming> first_input_timing_; @@ -334,7 +334,7 @@ TimeTicks time_origin_; PerformanceEntryTypeMask observer_filter_options_; - HeapLinkedHashSet<TraceWrapperMember<PerformanceObserver>> observers_; + HeapLinkedHashSet<Member<PerformanceObserver>> observers_; HeapLinkedHashSet<Member<PerformanceObserver>> active_observers_; HeapLinkedHashSet<Member<PerformanceObserver>> suspended_observers_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
diff --git a/third_party/blink/renderer/core/timing/performance_observer.h b/third_party/blink/renderer/core/timing/performance_observer.h index 9b98b90..ea29670f 100644 --- a/third_party/blink/renderer/core/timing/performance_observer.h +++ b/third_party/blink/renderer/core/timing/performance_observer.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/core/timing/performance_entry.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -22,7 +21,7 @@ class PerformanceObserverInit; class V8PerformanceObserverCallback; -using PerformanceEntryVector = HeapVector<TraceWrapperMember<PerformanceEntry>>; +using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; class CORE_EXPORT PerformanceObserver final : public ScriptWrappable, @@ -71,7 +70,7 @@ bool ShouldBeSuspended() const; Member<ExecutionContext> execution_context_; - TraceWrapperMember<V8PerformanceObserverCallback> callback_; + Member<V8PerformanceObserverCallback> callback_; WeakMember<Performance> performance_; PerformanceEntryVector performance_entries_; PerformanceEntryTypeMask filter_options_;
diff --git a/third_party/blink/renderer/core/timing/performance_observer_entry_list.cc b/third_party/blink/renderer/core/timing/performance_observer_entry_list.cc index f240355..61a6223 100644 --- a/third_party/blink/renderer/core/timing/performance_observer_entry_list.cc +++ b/third_party/blink/renderer/core/timing/performance_observer_entry_list.cc
@@ -6,7 +6,6 @@ #include <algorithm> #include "third_party/blink/renderer/core/timing/performance_entry.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" namespace blink {
diff --git a/third_party/blink/renderer/core/timing/performance_observer_entry_list.h b/third_party/blink/renderer/core/timing/performance_observer_entry_list.h index bdc0aa7..f7b6a54b 100644 --- a/third_party/blink/renderer/core/timing/performance_observer_entry_list.h +++ b/third_party/blink/renderer/core/timing/performance_observer_entry_list.h
@@ -13,7 +13,7 @@ namespace blink { class PerformanceEntry; -using PerformanceEntryVector = HeapVector<TraceWrapperMember<PerformanceEntry>>; +using PerformanceEntryVector = HeapVector<Member<PerformanceEntry>>; class PerformanceObserverEntryList : public ScriptWrappable { DEFINE_WRAPPERTYPEINFO();
diff --git a/third_party/blink/renderer/core/timing/worker_global_scope_performance.h b/third_party/blink/renderer/core/timing/worker_global_scope_performance.h index 2d1a86f..78af0fe 100644 --- a/third_party/blink/renderer/core/timing/worker_global_scope_performance.h +++ b/third_party/blink/renderer/core/timing/worker_global_scope_performance.h
@@ -60,7 +60,7 @@ private: WorkerPerformance* performance(WorkerGlobalScope*); - TraceWrapperMember<WorkerPerformance> performance_; + Member<WorkerPerformance> performance_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.h b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.h index 6f39524..f6fcbcb 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.h +++ b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy.h
@@ -8,7 +8,6 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_type_policy_options.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "v8/include/v8.h" @@ -56,7 +55,7 @@ private: String name_; - TraceWrapperMember<TrustedTypePolicyOptions> policy_options_; + Member<TrustedTypePolicyOptions> policy_options_; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.h b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.h index 531bf9f..530da4b 100644 --- a/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.h +++ b/third_party/blink/renderer/core/trustedtypes/trusted_type_policy_factory.h
@@ -57,7 +57,7 @@ const WrapperTypeInfo* GetWrapperTypeInfoFromScriptValue(ScriptState*, const ScriptValue&); - HeapHashMap<String, TraceWrapperMember<TrustedTypePolicy>> policy_map_; + HeapHashMap<String, Member<TrustedTypePolicy>> policy_map_; bool hadAssignmentError = false; };
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker.cc b/third_party/blink/renderer/core/workers/dedicated_worker.cc index 00fc6671..7c7d5977 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker.cc
@@ -51,20 +51,6 @@ namespace { -service_manager::mojom::blink::InterfaceProviderPtrInfo -ConnectToWorkerInterfaceProvider( - ExecutionContext* execution_context, - scoped_refptr<const SecurityOrigin> script_origin) { - DCHECK(!features::IsPlzDedicatedWorkerEnabled()); - mojom::blink::DedicatedWorkerHostFactoryPtr worker_host_factory; - execution_context->GetInterfaceProvider()->GetInterface(&worker_host_factory); - service_manager::mojom::blink::InterfaceProviderPtrInfo - interface_provider_ptr; - worker_host_factory->CreateWorkerHost( - script_origin, mojo::MakeRequest(&interface_provider_ptr)); - return interface_provider_ptr; -} - // Indicates whether the origin of worker top-level script's request URL is // same-origin as the parent execution context's origin or not. // This is used for UMA and thus the existing values should not be changed. @@ -155,6 +141,10 @@ options_(options), context_proxy_( MakeGarbageCollected<DedicatedWorkerMessagingProxy>(context, this)), + factory_client_( + Platform::Current()->CreateDedicatedWorkerHostFactoryClient( + this, + GetExecutionContext()->GetInterfaceProvider())), v8_stack_trace_id_(ThreadDebugger::From(context->GetIsolate()) ->StoreCurrentStackTrace("Worker Created")) { DCHECK(context->IsContextThread()); @@ -225,10 +215,6 @@ script_request_url_, MakeRequest(&blob_url_token)); } - DCHECK(!factory_client_); - factory_client_ = - Platform::Current()->CreateDedicatedWorkerHostFactoryClient( - this, GetExecutionContext()->GetInterfaceProvider()); factory_client_->CreateWorkerHost( script_request_url_, WebSecurityOrigin(GetExecutionContext()->GetSecurityOrigin()), @@ -236,6 +222,10 @@ // Continue in OnScriptLoadStarted() or OnScriptLoadStartFailed(). return; } + + factory_client_->CreateWorkerHostDeprecated( + WebSecurityOrigin(GetExecutionContext()->GetSecurityOrigin())); + if (base::FeatureList::IsEnabled( features::kOffMainThreadDedicatedWorkerScriptFetch) || options_->type() == "module") { @@ -309,7 +299,7 @@ void DedicatedWorker::OnWorkerHostCreated( mojo::ScopedMessagePipeHandle interface_provider) { - DCHECK(features::IsPlzDedicatedWorkerEnabled()); + DCHECK(!interface_provider_); interface_provider_ = service_manager::mojom::blink::InterfaceProviderPtrInfo( std::move(interface_provider), service_manager::mojom::blink::InterfaceProvider::Version_); @@ -437,6 +427,7 @@ ? mojom::ScriptType::kClassic : mojom::ScriptType::kModule; + DCHECK(interface_provider_); return std::make_unique<GlobalScopeCreationParams>( script_url, script_type, off_main_thread_fetch_option, options_->name(), GetExecutionContext()->UserAgent(), CreateWebWorkerFetchContext(), @@ -448,11 +439,7 @@ OriginTrialContext::GetTokens(GetExecutionContext()).get(), parent_devtools_token, std::move(settings), kV8CacheOptionsDefault, nullptr /* worklet_module_responses_map */, - interface_provider_ - ? std::move(interface_provider_) - : ConnectToWorkerInterfaceProvider( - GetExecutionContext(), SecurityOrigin::Create(script_url)), - CreateBeginFrameProviderParams(), + std::move(interface_provider_), CreateBeginFrameProviderParams(), GetExecutionContext()->GetSecurityContext().GetFeaturePolicy(), GetExecutionContext()->GetAgentClusterID()); }
diff --git a/third_party/blink/renderer/core/workers/experimental/task_worklet_global_scope.h b/third_party/blink/renderer/core/workers/experimental/task_worklet_global_scope.h index 80e5c12..221b8972 100644 --- a/third_party/blink/renderer/core/workers/experimental/task_worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/experimental/task_worklet_global_scope.h
@@ -32,7 +32,7 @@ v8::Isolate*); private: - HeapHashMap<String, TraceWrapperMember<TaskDefinition>> task_definitions_; + HeapHashMap<String, Member<TaskDefinition>> task_definitions_; }; } // namespace blink
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 73c9273..3dc75df87 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worker_global_scope.cc
@@ -423,13 +423,13 @@ : WorkerOrWorkletGlobalScope( thread->GetIsolate(), creation_params->global_scope_name, + creation_params->parent_devtools_token, creation_params->v8_cache_options, creation_params->worker_clients, std::move(creation_params->web_worker_fetch_context), thread->GetWorkerReportingProxy()), script_type_(creation_params->script_type), user_agent_(creation_params->user_agent), - parent_devtools_token_(creation_params->parent_devtools_token), thread_(thread), timers_(GetTaskRunner(TaskType::kJavascriptTimer)), time_origin_(time_origin),
diff --git a/third_party/blink/renderer/core/workers/worker_global_scope.h b/third_party/blink/renderer/core/workers/worker_global_scope.h index f3c2542..8626df0 100644 --- a/third_party/blink/renderer/core/workers/worker_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_global_scope.h
@@ -133,9 +133,6 @@ OffscreenFontSelector* GetFontSelector() { return font_selector_; } CoreProbeSink* GetProbeSink() final; - const base::UnguessableToken& GetParentDevToolsToken() { - return parent_devtools_token_; - } // EventTarget ExecutionContext* GetExecutionContext() const final; @@ -219,11 +216,10 @@ KURL url_; const mojom::ScriptType script_type_; const String user_agent_; - const base::UnguessableToken parent_devtools_token_; std::unique_ptr<WorkerSettings> worker_settings_; mutable Member<WorkerLocation> location_; - mutable TraceWrapperMember<WorkerNavigator> navigator_; + mutable Member<WorkerNavigator> navigator_; Member<TrustedTypePolicyFactory> trusted_types_; WorkerThread* thread_; @@ -238,7 +234,7 @@ int last_pending_error_event_id_ = 0; Member<OffscreenFontSelector> font_selector_; - TraceWrapperMember<WorkerAnimationFrameProvider> animation_frame_provider_; + Member<WorkerAnimationFrameProvider> animation_frame_provider_; service_manager::InterfaceProvider interface_provider_;
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 0e9290ae9..abfa7d6f 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
@@ -163,12 +163,14 @@ WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope( v8::Isolate* isolate, const String& name, + const base::UnguessableToken& parent_devtools_token, V8CacheOptions v8_cache_options, WorkerClients* worker_clients, scoped_refptr<WebWorkerFetchContext> web_worker_fetch_context, WorkerReportingProxy& reporting_proxy) : ExecutionContext(isolate), name_(name), + parent_devtools_token_(parent_devtools_token), worker_clients_(worker_clients), web_worker_fetch_context_(std::move(web_worker_fetch_context)), script_controller_(
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h index 3b34db3..c5e358d 100644 --- a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h
@@ -42,12 +42,14 @@ using SecurityContext::GetSecurityOrigin; using SecurityContext::GetContentSecurityPolicy; - WorkerOrWorkletGlobalScope(v8::Isolate*, - const String& name, - V8CacheOptions, - WorkerClients*, - scoped_refptr<WebWorkerFetchContext>, - WorkerReportingProxy&); + WorkerOrWorkletGlobalScope( + v8::Isolate*, + const String& name, + const base::UnguessableToken& parent_devtools_token, + V8CacheOptions, + WorkerClients*, + scoped_refptr<WebWorkerFetchContext>, + WorkerReportingProxy&); ~WorkerOrWorkletGlobalScope() override; // EventTarget @@ -113,6 +115,9 @@ const FetchClientSettingsObject&); const String Name() const { return name_; } + const base::UnguessableToken& GetParentDevToolsToken() { + return parent_devtools_token_; + } WorkerClients* Clients() const { return worker_clients_.Get(); } @@ -155,6 +160,7 @@ bool web_fetch_context_initialized_ = false; const String name_; + const base::UnguessableToken parent_devtools_token_; CrossThreadPersistent<WorkerClients> worker_clients_; @@ -193,7 +199,7 @@ // LocalDOMWindow::modulator_ workaround equivalent. // TODO(kouhei): Remove this. - TraceWrapperMember<Modulator> modulator_; + Member<Modulator> modulator_; }; template <>
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worklet_global_scope.cc index 40752b7d..150c23b 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope.cc +++ b/third_party/blink/renderer/core/workers/worklet_global_scope.cc
@@ -24,7 +24,6 @@ #include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h" #include "third_party/blink/renderer/core/workers/worklet_module_tree_client.h" #include "third_party/blink/renderer/core/workers/worklet_pending_tasks.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" namespace blink { @@ -64,6 +63,7 @@ : WorkerOrWorkletGlobalScope( isolate, creation_params->global_scope_name, + creation_params->parent_devtools_token, creation_params->v8_cache_options, creation_params->worker_clients, std::move(creation_params->web_worker_fetch_context),
diff --git a/third_party/blink/renderer/core/workers/worklet_global_scope.h b/third_party/blink/renderer/core/workers/worklet_global_scope.h index b152e47..6d97aed 100644 --- a/third_party/blink/renderer/core/workers/worklet_global_scope.h +++ b/third_party/blink/renderer/core/workers/worklet_global_scope.h
@@ -15,7 +15,6 @@ #include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h" #include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/casting.h"
diff --git a/third_party/blink/renderer/core/xml/parser/xml_document_parser.h b/third_party/blink/renderer/core/xml/parser/xml_document_parser.h index f14cd57..cdffa58 100644 --- a/third_party/blink/renderer/core/xml/parser/xml_document_parser.h +++ b/third_party/blink/renderer/core/xml/parser/xml_document_parser.h
@@ -37,7 +37,6 @@ #include "third_party/blink/renderer/platform/loader/fetch/resource_client.h" #include "third_party/blink/renderer/platform/text/segmented_string.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/text/cstring.h"
diff --git a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h index 73a43ce..b547544e 100644 --- a/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h +++ b/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.h
@@ -35,7 +35,6 @@ #include "third_party/blink/renderer/core/xmlhttprequest/xml_http_request_progress_event_throttle.h" #include "third_party/blink/renderer/platform/bindings/exception_code.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_string.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_response.h" @@ -306,7 +305,7 @@ // using case insensitive comparison functions if needed. AtomicString mime_type_override_; TimeDelta timeout_; - TraceWrapperMember<Blob> response_blob_; + Member<Blob> response_blob_; TaskHandle pending_abort_event_; @@ -320,7 +319,7 @@ // Avoid using a flat WTF::String here and rather use a traced v8::String // which internally builds a string rope. GC_PLUGIN_IGNORE("crbug.com/841830") TraceWrapperV8String response_text_; - TraceWrapperMember<Document> response_document_; + Member<Document> response_document_; Member<DocumentParser> response_document_parser_; scoped_refptr<SharedBuffer> binary_response_builder_; @@ -328,7 +327,7 @@ int64_t length_downloaded_to_blob_ = 0; int64_t length_downloaded_to_blob_last_reported_ = 0; - TraceWrapperMember<DOMArrayBuffer> response_array_buffer_; + Member<DOMArrayBuffer> response_array_buffer_; // Used for onprogress tracking int64_t received_length_ = 0;
diff --git a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h index 173ea67..b384136aa 100644 --- a/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h +++ b/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h
@@ -70,11 +70,10 @@ const String& name, WorkletAnimationOptions* options, int num_effects); - typedef HeapHashMap<String, TraceWrapperMember<AnimatorDefinition>> - DefinitionMap; + typedef HeapHashMap<String, Member<AnimatorDefinition>> DefinitionMap; DefinitionMap animator_definitions_; - typedef HeapHashMap<int, TraceWrapperMember<Animator>> AnimatorMap; + typedef HeapHashMap<int, Member<Animator>> AnimatorMap; AnimatorMap animators_; bool registered_ = false;
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 0ca7bae..ef8ad00 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
@@ -104,7 +104,8 @@ v8::Isolate* isolate = script_state->GetIsolate(); ASSERT_TRUE(isolate); ScriptState::Scope scope(script_state); - ASSERT_TRUE(EvaluateScriptModule(global_scope, source_code)); + ASSERT_TRUE(global_scope->ScriptController()->Evaluate( + ScriptSourceCode(source_code), SanitizeScriptErrors::kDoNotSanitize)); waitable_event->Signal(); } @@ -130,7 +131,8 @@ animate () {} }); )JS"; - ASSERT_TRUE(EvaluateScriptModule(global_scope, source_code)); + ASSERT_TRUE(global_scope->ScriptController()->Evaluate( + ScriptSourceCode(source_code), SanitizeScriptErrors::kDoNotSanitize)); AnimatorDefinition* definition = global_scope->FindDefinitionForTest("test"); @@ -141,7 +143,8 @@ // registerAnimator() with a null class definition should fail to define // an animator. String source_code = "registerAnimator('null', null);"; - ASSERT_FALSE(EvaluateScriptModule(global_scope, source_code)); + ASSERT_FALSE(global_scope->ScriptController()->Evaluate( + ScriptSourceCode(source_code), SanitizeScriptErrors::kDoNotSanitize)); EXPECT_FALSE(global_scope->FindDefinitionForTest("null")); } @@ -180,7 +183,8 @@ } }); )JS"; - ASSERT_TRUE(EvaluateScriptModule(global_scope, source_code)); + ASSERT_TRUE(global_scope->ScriptController()->Evaluate( + ScriptSourceCode(source_code), SanitizeScriptErrors::kDoNotSanitize)); ScriptValue constructed_before = global_scope->ScriptController()->EvaluateAndReturnValueForTest( @@ -256,7 +260,8 @@ registerAnimator('stateless_animator', Stateless); registerAnimator('foo', Foo); )JS"; - ASSERT_TRUE(EvaluateScriptModule(global_scope, source_code)); + ASSERT_TRUE(global_scope->ScriptController()->Evaluate( + ScriptSourceCode(source_code), SanitizeScriptErrors::kDoNotSanitize)); AnimatorDefinition* first_definition = global_scope->FindDefinitionForTest("stateful_animator"); @@ -427,25 +432,6 @@ } std::unique_ptr<WorkerReportingProxy> reporting_proxy_; - - private: - // Returns false when a script evaluation error happens. - bool EvaluateScriptModule(AnimationWorkletGlobalScope* global_scope, - const String& source_code) { - ScriptState* script_state = - global_scope->ScriptController()->GetScriptState(); - EXPECT_TRUE(script_state); - const KURL js_url("https://example.com/worklet.js"); - ModuleRecord module = ModuleRecord::Compile( - script_state->GetIsolate(), source_code, js_url, js_url, - ScriptFetchOptions(), TextPosition::MinimumPosition(), - ASSERT_NO_EXCEPTION); - EXPECT_FALSE(module.IsNull()); - ScriptValue exception = module.Instantiate(script_state); - EXPECT_TRUE(exception.IsEmpty()); - ScriptValue value = module.Evaluate(script_state); - return value.IsEmpty(); - } }; TEST_F(AnimationWorkletGlobalScopeTest, BasicParsing) {
diff --git a/third_party/blink/renderer/modules/animationworklet/animator.h b/third_party/blink/renderer/modules/animationworklet/animator.h index 478d765..ca354fb0 100644 --- a/third_party/blink/renderer/modules/animationworklet/animator.h +++ b/third_party/blink/renderer/modules/animationworklet/animator.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/modules/animationworklet/worklet_group_effect_proxy.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/graphics/animation_worklet_mutators_state.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -44,7 +43,7 @@ private: // This object keeps the definition object, and animator instance alive. // It participates in wrapper tracing as it holds onto V8 wrappers. - TraceWrapperMember<AnimatorDefinition> definition_; + Member<AnimatorDefinition> definition_; TraceWrapperV8Reference<v8::Value> instance_; Member<WorkletGroupEffectProxy> group_effect_;
diff --git a/third_party/blink/renderer/modules/animationworklet/animator_definition.h b/third_party/blink/renderer/modules/animationworklet/animator_definition.h index 59650ff..3d1647a 100644 --- a/third_party/blink/renderer/modules/animationworklet/animator_definition.h +++ b/third_party/blink/renderer/modules/animationworklet/animator_definition.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -41,9 +40,9 @@ private: // This object keeps the constructor function, animate, and state function // alive. It participates in wrapper tracing as it holds onto V8 wrappers. - TraceWrapperMember<V8AnimatorConstructor> constructor_; - TraceWrapperMember<V8AnimateCallback> animate_; - TraceWrapperMember<V8Function> state_; + Member<V8AnimatorConstructor> constructor_; + Member<V8AnimateCallback> animate_; + Member<V8Function> state_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc index 935eaf1..92034a9 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc +++ b/third_party/blink/renderer/modules/canvas/canvas2d/canvas_rendering_context_2d_test.cc
@@ -868,20 +868,21 @@ "_DisplayP3", "_ProPhoto", "_Rec2020"}; std::vector<String> alpha_status = {"_opaque", "_transparent"}; - String path = test::CoreTestDataPath(); - path.append("/png-16bit/"); + StringBuilder path; + path.Append(test::CoreTestDataPath()); + path.Append("/png-16bit/"); for (auto interlace : interlace_status) { for (auto color_profile : color_profiles) { for (auto alpha : alpha_status) { - String filename = "2x2_16bit"; - filename.append(interlace); - filename.append(color_profile); - filename.append(alpha); - filename.append(".png"); - String full_path = path; - full_path.append(filename); - TestDrawSingleHighBitDepthPNGOnCanvas(full_path, context, document, - script_state); + StringBuilder full_path; + full_path.Append(path); + full_path.Append("2x2_16bit"); + full_path.Append(interlace); + full_path.Append(color_profile); + full_path.Append(alpha); + full_path.Append(".png"); + TestDrawSingleHighBitDepthPNGOnCanvas(full_path.ToString(), context, + document, script_state); } } }
diff --git a/third_party/blink/renderer/modules/crypto/normalize_algorithm.h b/third_party/blink/renderer/modules/crypto/normalize_algorithm.h index 09be588..527807e 100644 --- a/third_party/blink/renderer/modules/crypto/normalize_algorithm.h +++ b/third_party/blink/renderer/modules/crypto/normalize_algorithm.h
@@ -38,7 +38,6 @@ #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/forward.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/csspaint/css_paint_definition.h b/third_party/blink/renderer/modules/csspaint/css_paint_definition.h index fb8a9fd2..abde5b64 100644 --- a/third_party/blink/renderer/modules/csspaint/css_paint_definition.h +++ b/third_party/blink/renderer/modules/csspaint/css_paint_definition.h
@@ -12,7 +12,6 @@ #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" #include "third_party/blink/renderer/platform/geometry/float_size.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -92,8 +91,8 @@ // This object keeps the class instance object, constructor function and // paint function alive. It participates in wrapper tracing as it holds onto // V8 wrappers. - TraceWrapperMember<V8NoArgumentConstructor> constructor_; - TraceWrapperMember<V8PaintCallback> paint_; + Member<V8NoArgumentConstructor> constructor_; + Member<V8PaintCallback> paint_; // At the moment there is only ever one instance of a paint class per type. TraceWrapperV8Reference<v8::Value> instance_;
diff --git a/third_party/blink/renderer/modules/csspaint/document_paint_definition.h b/third_party/blink/renderer/modules/csspaint/document_paint_definition.h index 894b52e..028429a 100644 --- a/third_party/blink/renderer/modules/csspaint/document_paint_definition.h +++ b/third_party/blink/renderer/modules/csspaint/document_paint_definition.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/core/css/cssom/css_style_value.h" #include "third_party/blink/renderer/modules/csspaint/css_paint_definition.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h index 49ed6f61..e4035eb 100644 --- a/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h +++ b/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h
@@ -63,8 +63,7 @@ // The implementation of the "paint definition" concept: // https://drafts.css-houdini.org/css-paint-api/#paint-definition - typedef HeapHashMap<String, TraceWrapperMember<CSSPaintDefinition>> - DefinitionMap; + typedef HeapHashMap<String, Member<CSSPaintDefinition>> DefinitionMap; DefinitionMap paint_definitions_; // Only used for main-thread bound PaintWorkletGlobalScopes.
diff --git a/third_party/blink/renderer/modules/document_metadata/copyless_paste_extractor_test.cc b/third_party/blink/renderer/modules/document_metadata/copyless_paste_extractor_test.cc index 5c866c0..738c191e 100644 --- a/third_party/blink/renderer/modules/document_metadata/copyless_paste_extractor_test.cc +++ b/third_party/blink/renderer/modules/document_metadata/copyless_paste_extractor_test.cc
@@ -12,6 +12,7 @@ #include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/testing/page_test_base.h" #include "third_party/blink/renderer/platform/json/json_values.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { @@ -458,12 +459,13 @@ } TEST_F(CopylessPasteExtractorTest, truncateLongString) { - String maxLengthString; + StringBuilder maxLengthString; for (int i = 0; i < 200; ++i) { - maxLengthString.append("a"); + maxLengthString.Append("a"); } - String tooLongString(maxLengthString); - tooLongString.append("a"); + StringBuilder tooLongString; + tooLongString.Append(maxLengthString); + tooLongString.Append("a"); SetHTMLInnerHTML( "<body>" "<script type=\"application/ld+json\">" @@ -471,7 +473,7 @@ "\n" "{\"@type\": \"Restaurant\"," "\"name\": \"" + - tooLongString + + tooLongString.ToString() + "\"" "}\n" "\n" @@ -489,7 +491,7 @@ EntityPtr restaurant = Entity::New(); restaurant->type = "Restaurant"; restaurant->properties.push_back( - createStringProperty("name", maxLengthString)); + createStringProperty("name", maxLengthString.ToString())); expected->entities.push_back(std::move(restaurant)); EXPECT_EQ(expected, extracted); @@ -533,14 +535,15 @@ } TEST_F(CopylessPasteExtractorTest, truncateTooManyValuesInField) { - String largeRepeatedField = "["; + StringBuilder largeRepeatedField; + largeRepeatedField.Append("["); for (int i = 0; i < 101; ++i) { - largeRepeatedField.append("\"a\""); + largeRepeatedField.Append("\"a\""); if (i != 100) { - largeRepeatedField.append(", "); + largeRepeatedField.Append(", "); } } - largeRepeatedField.append("]"); + largeRepeatedField.Append("]"); SetHTMLInnerHTML( "<body>" "<script type=\"application/ld+json\">" @@ -548,7 +551,7 @@ "\n" "{\"@type\": \"Restaurant\"," "\"name\": " + - largeRepeatedField + + largeRepeatedField.ToString() + "}\n" "\n" "</script>" @@ -582,11 +585,11 @@ } TEST_F(CopylessPasteExtractorTest, truncateTooManyFields) { - String tooManyFields; + StringBuilder tooManyFields; for (int i = 0; i < 20; ++i) { - tooManyFields.append(String::Format("\"%d\": \"a\"", i)); + tooManyFields.Append(String::Format("\"%d\": \"a\"", i)); if (i != 19) { - tooManyFields.append(",\n"); + tooManyFields.Append(",\n"); } } SetHTMLInnerHTML( @@ -595,7 +598,7 @@ "\n" "\n" "{\"@type\": \"Restaurant\"," + - tooManyFields + + tooManyFields.ToString() + "}\n" "\n" "</script>"
diff --git a/third_party/blink/renderer/modules/encoding/text_decoder_stream.h b/third_party/blink/renderer/modules/encoding/text_decoder_stream.h index 59941cc..81f24eee 100644 --- a/third_party/blink/renderer/modules/encoding/text_decoder_stream.h +++ b/third_party/blink/renderer/modules/encoding/text_decoder_stream.h
@@ -8,7 +8,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/core/streams/transform_stream.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/text/text_encoding.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -53,7 +52,7 @@ private: class Transformer; - const TraceWrapperMember<TransformStream> transform_; + const Member<TransformStream> transform_; const WTF::TextEncoding encoding_; const bool fatal_; const bool ignore_bom_;
diff --git a/third_party/blink/renderer/modules/encoding/text_encoder_stream.h b/third_party/blink/renderer/modules/encoding/text_encoder_stream.h index 561f25c..af1b7b6b 100644 --- a/third_party/blink/renderer/modules/encoding/text_encoder_stream.h +++ b/third_party/blink/renderer/modules/encoding/text_encoder_stream.h
@@ -8,7 +8,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_value.h" #include "third_party/blink/renderer/core/streams/transform_stream.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { @@ -43,7 +42,7 @@ private: class Transformer; - const TraceWrapperMember<TransformStream> transform_; + const Member<TransformStream> transform_; DISALLOW_COPY_AND_ASSIGN(TextEncoderStream); };
diff --git a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc index 2fe29e2..b3a3e023 100644 --- a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc +++ b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc
@@ -81,7 +81,7 @@ // static std::unique_ptr<WebEmbeddedWorker> WebEmbeddedWorker::Create( - std::unique_ptr<WebServiceWorkerContextClient> client, + WebServiceWorkerContextClient* client, std::unique_ptr<WebServiceWorkerInstalledScriptsManagerParams> installed_scripts_manager_params, mojo::ScopedMessagePipeHandle content_settings_handle, @@ -103,11 +103,11 @@ // static std::unique_ptr<WebEmbeddedWorkerImpl> WebEmbeddedWorkerImpl::CreateForTesting( - std::unique_ptr<WebServiceWorkerContextClient> client, + WebServiceWorkerContextClient* client, std::unique_ptr<ServiceWorkerInstalledScriptsManager> installed_scripts_manager) { auto worker_impl = std::make_unique<WebEmbeddedWorkerImpl>( - std::move(client), nullptr /* installed_scripts_manager_params */, + client, nullptr /* installed_scripts_manager_params */, std::make_unique<ServiceWorkerContentSettingsProxy>( nullptr /* host_info */), nullptr /* cache_storage_info */, nullptr /* interface_provider_info */); @@ -117,14 +117,14 @@ } WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl( - std::unique_ptr<WebServiceWorkerContextClient> client, + WebServiceWorkerContextClient* client, std::unique_ptr<WebServiceWorkerInstalledScriptsManagerParams> installed_scripts_manager_params, std::unique_ptr<ServiceWorkerContentSettingsProxy> content_settings_client, mojom::blink::CacheStoragePtrInfo cache_storage_info, service_manager::mojom::blink::InterfaceProviderPtrInfo interface_provider_info) - : worker_context_client_(std::move(client)), + : worker_context_client_(client), content_settings_client_(std::move(content_settings_client)), pause_after_download_state_(kDontPauseAfterDownload), waiting_for_debugger_state_(kNotWaitingForDebugger),
diff --git a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h index 3aad7d5..bd46eda 100644 --- a/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h +++ b/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h
@@ -58,7 +58,7 @@ public WorkerShadowPage::Client { public: WebEmbeddedWorkerImpl( - std::unique_ptr<WebServiceWorkerContextClient>, + WebServiceWorkerContextClient*, std::unique_ptr<WebServiceWorkerInstalledScriptsManagerParams>, std::unique_ptr<ServiceWorkerContentSettingsProxy>, mojom::blink::CacheStoragePtrInfo, @@ -80,7 +80,7 @@ void OnShadowPageInitialized() override; static std::unique_ptr<WebEmbeddedWorkerImpl> CreateForTesting( - std::unique_ptr<WebServiceWorkerContextClient>, + WebServiceWorkerContextClient*, std::unique_ptr<ServiceWorkerInstalledScriptsManager>); void WaitForShutdownForTesting(); @@ -99,7 +99,8 @@ WebEmbeddedWorkerStartData worker_start_data_; - std::unique_ptr<WebServiceWorkerContextClient> worker_context_client_; + // Client must remain valid through the entire life time of the worker. + WebServiceWorkerContextClient* const worker_context_client_; // These are valid until StartWorkerThread() is called. After the worker // thread is created, these are passed to the worker thread.
diff --git a/third_party/blink/renderer/modules/filesystem/dom_file_system.cc b/third_party/blink/renderer/modules/filesystem/dom_file_system.cc index 09590e1..1ac4b8fd 100644 --- a/third_party/blink/renderer/modules/filesystem/dom_file_system.cc +++ b/third_party/blink/renderer/modules/filesystem/dom_file_system.cc
@@ -43,6 +43,7 @@ #include "third_party/blink/renderer/modules/filesystem/file_system_dispatcher.h" #include "third_party/blink/renderer/modules/filesystem/file_writer.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.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/wtf_string.h"
diff --git a/third_party/blink/renderer/modules/filesystem/dom_file_system_base_test.cc b/third_party/blink/renderer/modules/filesystem/dom_file_system_base_test.cc index 586b10b..4b616ae7 100644 --- a/third_party/blink/renderer/modules/filesystem/dom_file_system_base_test.cc +++ b/third_party/blink/renderer/modules/filesystem/dom_file_system_base_test.cc
@@ -13,9 +13,8 @@ class DOMFileSystemBaseTest : public testing::Test { public: DOMFileSystemBaseTest() { - file_path_ = test::BlinkRootDir(); - file_path_.append( - "/renderer/modules/filesystem/dom_file_system_base_test.cc"); + file_path_ = test::BlinkRootDir() + + "/renderer/modules/filesystem/dom_file_system_base_test.cc"; GetFileMetadata(file_path_, file_metadata_); file_metadata_.platform_path = file_path_; }
diff --git a/third_party/blink/renderer/modules/filesystem/file_system_writer.h b/third_party/blink/renderer/modules/filesystem/file_system_writer.h index 7adedcc9..43306aa 100644 --- a/third_party/blink/renderer/modules/filesystem/file_system_writer.h +++ b/third_party/blink/renderer/modules/filesystem/file_system_writer.h
@@ -7,7 +7,6 @@ #include "third_party/blink/public/mojom/filesystem/file_writer.mojom-blink.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -50,7 +49,7 @@ mojom::blink::FileWriterPtr writer_; Member<ScriptPromiseResolver> pending_operation_; - TraceWrapperMember<FetchDataLoader> stream_loader_; + Member<FetchDataLoader> stream_loader_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/filesystem/file_writer.cc b/third_party/blink/renderer/modules/filesystem/file_writer.cc index d1dbb17..c91f83f 100644 --- a/third_party/blink/renderer/modules/filesystem/file_writer.cc +++ b/third_party/blink/renderer/modules/filesystem/file_writer.cc
@@ -37,6 +37,7 @@ #include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/modules/filesystem/file_system_dispatcher.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/time.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/geolocation/geo_notifier.h b/third_party/blink/renderer/modules/geolocation/geo_notifier.h index de5c1b8..beee26fe 100644 --- a/third_party/blink/renderer/modules/geolocation/geo_notifier.h +++ b/third_party/blink/renderer/modules/geolocation/geo_notifier.h
@@ -10,7 +10,6 @@ #include "third_party/blink/renderer/bindings/modules/v8/v8_position_error_callback.h" #include "third_party/blink/renderer/modules/geolocation/position_options.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/timer.h" @@ -96,8 +95,8 @@ void TimerFired(TimerBase*); Member<Geolocation> geolocation_; - TraceWrapperMember<V8PositionCallback> success_callback_; - TraceWrapperMember<V8PositionErrorCallback> error_callback_; + Member<V8PositionCallback> success_callback_; + Member<V8PositionErrorCallback> error_callback_; Member<const PositionOptions> options_; Member<Timer> timer_; Member<PositionError> fatal_error_;
diff --git a/third_party/blink/renderer/modules/geolocation/geolocation.h b/third_party/blink/renderer/modules/geolocation/geolocation.h index 80595b8..6ad28ae 100644 --- a/third_party/blink/renderer/modules/geolocation/geolocation.h +++ b/third_party/blink/renderer/modules/geolocation/geolocation.h
@@ -119,8 +119,8 @@ private: // Customized HeapHashSet class that checks notifiers' timers. Notifier's // timer may be active only when the notifier is owned by the Geolocation. - class GeoNotifierSet : private HeapHashSet<TraceWrapperMember<GeoNotifier>> { - using BaseClass = HeapHashSet<TraceWrapperMember<GeoNotifier>>; + class GeoNotifierSet : private HeapHashSet<Member<GeoNotifier>> { + using BaseClass = HeapHashSet<Member<GeoNotifier>>; public: using BaseClass::Trace; @@ -204,7 +204,7 @@ mojom::PermissionStatus); GeoNotifierSet one_shots_; - TraceWrapperMember<GeolocationWatchers> watchers_; + Member<GeolocationWatchers> watchers_; // GeoNotifiers that are in the middle of invocation. // // |HandleError(error)| and |MakeSuccessCallbacks| need to clear |one_shots_| @@ -217,7 +217,7 @@ // TODO(https://crbug.com/796145): Remove this hack once on-stack objects // get supported by either of wrapper-tracing or unified GC. GeoNotifierSet one_shots_being_invoked_; - HeapVector<TraceWrapperMember<GeoNotifier>> watchers_being_invoked_; + HeapVector<Member<GeoNotifier>> watchers_being_invoked_; Member<Geoposition> last_position_; RevocableInterfacePtr<device::mojom::blink::Geolocation> geolocation_;
diff --git a/third_party/blink/renderer/modules/geolocation/geolocation_watchers.cc b/third_party/blink/renderer/modules/geolocation/geolocation_watchers.cc index 21244f8..32f4dcfa 100644 --- a/third_party/blink/renderer/modules/geolocation/geolocation_watchers.cc +++ b/third_party/blink/renderer/modules/geolocation/geolocation_watchers.cc
@@ -74,7 +74,7 @@ } void GeolocationWatchers::CopyNotifiersToVector( - HeapVector<TraceWrapperMember<GeoNotifier>>& vector) const { + HeapVector<Member<GeoNotifier>>& vector) const { CopyValuesToVector(id_to_notifier_map_, vector); }
diff --git a/third_party/blink/renderer/modules/geolocation/geolocation_watchers.h b/third_party/blink/renderer/modules/geolocation/geolocation_watchers.h index 78bffbd..00584e0 100644 --- a/third_party/blink/renderer/modules/geolocation/geolocation_watchers.h +++ b/third_party/blink/renderer/modules/geolocation/geolocation_watchers.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_GEOLOCATION_GEOLOCATION_WATCHERS_H_ #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -33,11 +32,10 @@ auto& Notifiers() { return id_to_notifier_map_.Values(); } - void CopyNotifiersToVector( - HeapVector<TraceWrapperMember<GeoNotifier>>&) const; + void CopyNotifiersToVector(HeapVector<Member<GeoNotifier>>&) const; private: - typedef HeapHashMap<int, TraceWrapperMember<GeoNotifier>> IdToNotifierMap; + typedef HeapHashMap<int, Member<GeoNotifier>> IdToNotifierMap; typedef HeapHashMap<Member<GeoNotifier>, int> NotifierToIdMap; IdToNotifierMap id_to_notifier_map_;
diff --git a/third_party/blink/renderer/modules/geolocation/navigator_geolocation.h b/third_party/blink/renderer/modules/geolocation/navigator_geolocation.h index 1f1c136..c4c6984 100644 --- a/third_party/blink/renderer/modules/geolocation/navigator_geolocation.h +++ b/third_party/blink/renderer/modules/geolocation/navigator_geolocation.h
@@ -22,7 +22,6 @@ #include "third_party/blink/renderer/core/frame/navigator.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/supplementable.h" @@ -52,7 +51,7 @@ } private: - TraceWrapperMember<Geolocation> geolocation_; + Member<Geolocation> geolocation_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/idle/idle_detector.cc b/third_party/blink/renderer/modules/idle/idle_detector.cc index 14c681a..d60b36c 100644 --- a/third_party/blink/renderer/modules/idle/idle_detector.cc +++ b/third_party/blink/renderer/modules/idle/idle_detector.cc
@@ -13,7 +13,6 @@ #include "third_party/blink/renderer/modules/idle/idle_state.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/persistent.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/idle/idle_state.cc b/third_party/blink/renderer/modules/idle/idle_state.cc index 36b68a5..d8f8fa1a 100644 --- a/third_party/blink/renderer/modules/idle/idle_state.cc +++ b/third_party/blink/renderer/modules/idle/idle_state.cc
@@ -8,7 +8,6 @@ #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/persistent.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_cursor.h b/third_party/blink/renderer/modules/indexeddb/idb_cursor.h index 5c3306d..f5a1ba8 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_cursor.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_cursor.h
@@ -36,7 +36,6 @@ #include "third_party/blink/renderer/modules/indexeddb/indexed_db.h" #include "third_party/blink/renderer/modules/indexeddb/web_idb_cursor.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_database.h b/third_party/blink/renderer/modules/indexeddb/idb_database.h index cdf4363..6e86526 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_database.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_database.h
@@ -45,7 +45,6 @@ #include "third_party/blink/renderer/modules/indexeddb/web_idb_database_callbacks.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -190,7 +189,7 @@ std::unique_ptr<WebIDBDatabase> backend_; Member<IDBTransaction> version_change_transaction_; HeapHashMap<int64_t, Member<IDBTransaction>> transactions_; - HeapHashMap<int32_t, TraceWrapperMember<IDBObserver>> observers_; + HeapHashMap<int32_t, Member<IDBObserver>> observers_; bool close_pending_ = false;
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_observer.h b/third_party/blink/renderer/modules/indexeddb/idb_observer.h index 85bdb35..8413368 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_observer.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_observer.h
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -40,7 +39,7 @@ void Trace(blink::Visitor*) override; private: - TraceWrapperMember<V8IDBObserverCallback> callback_; + Member<V8IDBObserverCallback> callback_; HeapHashMap<int32_t, WeakMember<IDBDatabase>> observer_ids_; };
diff --git a/third_party/blink/renderer/modules/locks/lock_manager.cc b/third_party/blink/renderer/modules/locks/lock_manager.cc index 83323c7..4053763 100644 --- a/third_party/blink/renderer/modules/locks/lock_manager.cc +++ b/third_party/blink/renderer/modules/locks/lock_manager.cc
@@ -20,7 +20,6 @@ #include "third_party/blink/renderer/platform/bindings/microtask.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/functional.h" @@ -169,7 +168,7 @@ private: // Callback passed by script; invoked when the lock is granted. - TraceWrapperMember<V8LockGrantedCallback> callback_; + Member<V8LockGrantedCallback> callback_; // Rejects if the request was aborted, otherwise resolves/rejects with // |callback_|'s result.
diff --git a/third_party/blink/renderer/modules/locks/lock_manager.h b/third_party/blink/renderer/modules/locks/lock_manager.h index 1e31f6f..e8d17fc 100644 --- a/third_party/blink/renderer/modules/locks/lock_manager.h +++ b/third_party/blink/renderer/modules/locks/lock_manager.h
@@ -63,7 +63,7 @@ void RemovePendingRequest(LockRequestImpl*); bool IsPendingRequest(LockRequestImpl*); - HeapHashSet<TraceWrapperMember<LockRequestImpl>> pending_requests_; + HeapHashSet<Member<LockRequestImpl>> pending_requests_; HeapHashSet<Member<Lock>> held_locks_; mojom::blink::LockManagerPtr service_;
diff --git a/third_party/blink/renderer/modules/locks/navigator_locks.cc b/third_party/blink/renderer/modules/locks/navigator_locks.cc index 6a6f3261..52b745c9 100644 --- a/third_party/blink/renderer/modules/locks/navigator_locks.cc +++ b/third_party/blink/renderer/modules/locks/navigator_locks.cc
@@ -9,7 +9,6 @@ #include "third_party/blink/renderer/modules/locks/lock_manager.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/supplementable.h" namespace blink { @@ -54,7 +53,7 @@ } private: - mutable TraceWrapperMember<LockManager> lock_manager_; + mutable Member<LockManager> lock_manager_; }; // static
diff --git a/third_party/blink/renderer/modules/mediasession/media_session.h b/third_party/blink/renderer/modules/mediasession/media_session.h index 1f2a3b54..081504c 100644 --- a/third_party/blink/renderer/modules/mediasession/media_session.h +++ b/third_party/blink/renderer/modules/mediasession/media_session.h
@@ -11,7 +11,6 @@ #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -73,8 +72,7 @@ mojom::blink::MediaSessionPlaybackState playback_state_; Member<MediaMetadata> metadata_; - HeapHashMap<String, TraceWrapperMember<V8MediaSessionActionHandler>> - action_handlers_; + HeapHashMap<String, Member<V8MediaSessionActionHandler>> action_handlers_; mojom::blink::MediaSessionServicePtr service_; mojo::Binding<blink::mojom::blink::MediaSessionClient> client_binding_; };
diff --git a/third_party/blink/renderer/modules/mediasource/media_source.h b/third_party/blink/renderer/modules/mediasource/media_source.h index 57668c09..09ad272 100644 --- a/third_party/blink/renderer/modules/mediasource/media_source.h +++ b/third_party/blink/renderer/modules/mediasource/media_source.h
@@ -43,7 +43,6 @@ #include "third_party/blink/renderer/modules/mediasource/source_buffer.h" #include "third_party/blink/renderer/modules/mediasource/source_buffer_list.h" #include "third_party/blink/renderer/platform/bindings/exception_code.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -149,16 +148,16 @@ AtomicString ready_state_; Member<EventQueue> async_event_queue_; - // Here, using TraceWrapperMember, instead of Member, to keep + // Here, using Member, instead of Member, to keep // |attached_element_|, |source_buffers_|, |active_source_buffers_|, and their // wrappers from being collected if we are alive or traceable from a GC root. // Activity by this MediaSource or on references to objects returned by // exercising this MediaSource (such as an app manipulating a SourceBuffer // retrieved via activeSourceBuffers()) may cause events to be dispatched by // these other objects. - TraceWrapperMember<HTMLMediaElement> attached_element_; - TraceWrapperMember<SourceBufferList> source_buffers_; - TraceWrapperMember<SourceBufferList> active_source_buffers_; + Member<HTMLMediaElement> attached_element_; + Member<SourceBufferList> source_buffers_; + Member<SourceBufferList> active_source_buffers_; Member<TimeRanges> live_seekable_range_;
diff --git a/third_party/blink/renderer/modules/mediasource/source_buffer.h b/third_party/blink/renderer/modules/mediasource/source_buffer.h index 2f12339e..4da35f5 100644 --- a/third_party/blink/renderer/modules/mediasource/source_buffer.h +++ b/third_party/blink/renderer/modules/mediasource/source_buffer.h
@@ -38,7 +38,6 @@ #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" #include "third_party/blink/renderer/modules/event_target_modules.h" #include "third_party/blink/renderer/modules/mediasource/track_default_list.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -159,20 +158,20 @@ // If any portion of an attached HTMLMediaElement (HTMLME) and the MediaSource // Extensions (MSE) API is alive (having pending activity or traceable from a - // GC root), the whole group is not GC'ed. Here, using TraceWrapperMember, + // GC root), the whole group is not GC'ed. Here, using Member, // instead of Member, because |source_|'s and |track_defaults_|'s wrappers // need to remain alive at least to successfully dispatch any events enqueued // by the behavior of the HTMLME+MSE API. It makes those wrappers remain alive // as long as this SourceBuffer's wrapper is alive. - TraceWrapperMember<MediaSource> source_; - TraceWrapperMember<TrackDefaultList> track_defaults_; + Member<MediaSource> source_; + Member<TrackDefaultList> track_defaults_; Member<EventQueue> async_event_queue_; AtomicString mode_; bool updating_; double timestamp_offset_; - TraceWrapperMember<AudioTrackList> audio_tracks_; - TraceWrapperMember<VideoTrackList> video_tracks_; + Member<AudioTrackList> audio_tracks_; + Member<VideoTrackList> video_tracks_; double append_window_start_; double append_window_end_; bool first_initialization_segment_received_;
diff --git a/third_party/blink/renderer/modules/mediasource/source_buffer_list.h b/third_party/blink/renderer/modules/mediasource/source_buffer_list.h index 61a1a0ba..45ead0f 100644 --- a/third_party/blink/renderer/modules/mediasource/source_buffer_list.h +++ b/third_party/blink/renderer/modules/mediasource/source_buffer_list.h
@@ -33,7 +33,6 @@ #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/modules/event_target_modules.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -88,10 +87,10 @@ // If any portion of an attached HTMLMediaElement (HTMLME) and the MediaSource // Extensions (MSE) API is alive (having pending activity or traceable from a - // GC root), the whole group is not GC'ed. Here, using TraceWrapperMember, + // GC root), the whole group is not GC'ed. Here, using Member, // instead of Member, because the |list_|'s SourceBuffers' wrappers need to // remain alive at least to successfully dispatch any events enqueued by - // behavior of the HTMLME+MSE API. TraceWrapperMember usage here keeps the + // behavior of the HTMLME+MSE API. Member usage here keeps the // SourceBuffers in |list_|, and their wrappers, from being collected if we // are alive or traceable from a GC root. // For instance, suppose the only reference to the group of HTMLME+MSE API @@ -102,7 +101,7 @@ // listeners on objects in HTMLME+MSE are counted as references, but events // pending for dispatch to them must keep the HTML+MSE group of objects alive // through at least their dispatch. - HeapVector<TraceWrapperMember<SourceBuffer>> list_; + HeapVector<Member<SourceBuffer>> list_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/nfc/navigator_nfc.h b/third_party/blink/renderer/modules/nfc/navigator_nfc.h index 724252a..c690bb5 100644 --- a/third_party/blink/renderer/modules/nfc/navigator_nfc.h +++ b/third_party/blink/renderer/modules/nfc/navigator_nfc.h
@@ -31,7 +31,7 @@ void Trace(blink::Visitor*) override; private: - TraceWrapperMember<NFC> nfc_; + Member<NFC> nfc_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/nfc/nfc.h b/third_party/blink/renderer/modules/nfc/nfc.h index 379de74..a33da85e 100644 --- a/third_party/blink/renderer/modules/nfc/nfc.h +++ b/third_party/blink/renderer/modules/nfc/nfc.h
@@ -89,8 +89,7 @@ device::mojom::blink::NFCPtr nfc_; mojo::Binding<device::mojom::blink::NFCClient> client_binding_; HeapHashSet<Member<ScriptPromiseResolver>> requests_; - using WatchCallbacksMap = - HeapHashMap<uint32_t, TraceWrapperMember<V8MessageCallback>>; + using WatchCallbacksMap = HeapHashMap<uint32_t, Member<V8MessageCallback>>; WatchCallbacksMap callbacks_; };
diff --git a/third_party/blink/renderer/modules/payments/payment_request.h b/third_party/blink/renderer/modules/payments/payment_request.h index 95fbd3a..d95f924 100644 --- a/third_party/blink/renderer/modules/payments/payment_request.h +++ b/third_party/blink/renderer/modules/payments/payment_request.h
@@ -23,7 +23,6 @@ #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/timer.h" -#include "third_party/blink/renderer/platform/wtf/compiler.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/modules/peerconnection/rtc_data_channel.h b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.h index 90701053..0d3c4f26 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.h +++ b/third_party/blink/renderer/modules/peerconnection/rtc_data_channel.h
@@ -36,7 +36,6 @@ #include "third_party/blink/renderer/modules/event_target_modules.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/timer.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/webrtc/api/peer_connection_interface.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/remoteplayback/availability_callback_wrapper.h b/third_party/blink/renderer/modules/remoteplayback/availability_callback_wrapper.h index 1d95739..bcbb5c1a 100644 --- a/third_party/blink/renderer/modules/remoteplayback/availability_callback_wrapper.h +++ b/third_party/blink/renderer/modules/remoteplayback/availability_callback_wrapper.h
@@ -10,9 +10,7 @@ #include "base/callback.h" #include "base/macros.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink { @@ -38,7 +36,7 @@ private: // Only one of these callbacks must be set. - TraceWrapperMember<V8RemotePlaybackAvailabilityCallback> bindings_cb_; + Member<V8RemotePlaybackAvailabilityCallback> bindings_cb_; base::RepeatingClosure internal_cb_; DISALLOW_COPY_AND_ASSIGN(AvailabilityCallbackWrapper);
diff --git a/third_party/blink/renderer/modules/remoteplayback/remote_playback.h b/third_party/blink/renderer/modules/remoteplayback/remote_playback.h index 4022509..e853722 100644 --- a/third_party/blink/renderer/modules/remoteplayback/remote_playback.h +++ b/third_party/blink/renderer/modules/remoteplayback/remote_playback.h
@@ -19,10 +19,8 @@ #include "third_party/blink/renderer/core/html/media/remote_playback_controller.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/presentation/presentation_availability_observer.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -164,8 +162,7 @@ mojom::blink::PresentationConnectionState state_; mojom::blink::ScreenAvailability availability_; - HeapHashMap<int, TraceWrapperMember<AvailabilityCallbackWrapper>> - availability_callbacks_; + HeapHashMap<int, Member<AvailabilityCallbackWrapper>> availability_callbacks_; Member<HTMLMediaElement> media_element_; Member<ScriptPromiseResolver> prompt_promise_resolver_; Vector<KURL> availability_urls_;
diff --git a/third_party/blink/renderer/modules/service_worker/fetch_event.h b/third_party/blink/renderer/modules/service_worker/fetch_event.h index abc9f4c..083665e 100644 --- a/third_party/blink/renderer/modules/service_worker/fetch_event.h +++ b/third_party/blink/renderer/modules/service_worker/fetch_event.h
@@ -92,7 +92,7 @@ private: Member<FetchRespondWithObserver> observer_; - TraceWrapperMember<Request> request_; + Member<Request> request_; Member<PreloadResponseProperty> preload_response_property_; std::unique_ptr<WebURLResponse> preload_response_; Member<DataPipeBytesConsumer::CompletionNotifier> body_completion_notifier_;
diff --git a/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc b/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc index b6d18cb7..1ae16b6 100644 --- a/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc +++ b/third_party/blink/renderer/modules/service_worker/web_embedded_worker_impl_test.cc
@@ -13,6 +13,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/messaging/message_port_channel.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom-blink.h" #include "third_party/blink/public/mojom/service_worker/service_worker_installed_scripts_manager.mojom-blink.h" #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-blink.h" #include "third_party/blink/public/platform/modules/service_worker/web_service_worker_network_provider.h" @@ -228,13 +229,12 @@ class WebEmbeddedWorkerImplTest : public testing::Test { protected: void SetUp() override { - auto client = std::make_unique<MockServiceWorkerContextClient>(); auto installed_scripts_manager = std::make_unique<MockServiceWorkerInstalledScriptsManager>(); - mock_client_ = client.get(); mock_installed_scripts_manager_ = installed_scripts_manager.get(); + mock_client_ = std::make_unique<MockServiceWorkerContextClient>(); worker_ = WebEmbeddedWorkerImpl::CreateForTesting( - std::move(client), std::move(installed_scripts_manager)); + mock_client_.get(), std::move(installed_scripts_manager)); WebURL script_url = url_test_helpers::ToKURL("https://www.example.com/sw.js"); @@ -261,7 +261,7 @@ } WebEmbeddedWorkerStartData start_data_; - MockServiceWorkerContextClient* mock_client_; + std::unique_ptr<MockServiceWorkerContextClient> mock_client_; MockServiceWorkerInstalledScriptsManager* mock_installed_scripts_manager_; std::unique_ptr<WebEmbeddedWorkerImpl> worker_; }; @@ -275,11 +275,11 @@ EXPECT_CALL(*mock_client_, WorkerReadyForInspectionOnMainThread()).Times(1); worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); EXPECT_CALL(*mock_client_, WorkerContextFailedToStartOnMainThread()).Times(1); worker_->TerminateWorkerContext(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); } TEST_F(WebEmbeddedWorkerImplTest, TerminateSoonAfterStart_OMT_Fetch) { @@ -289,7 +289,7 @@ EXPECT_CALL(*mock_client_, WorkerReadyForInspectionOnMainThread()).Times(1); worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); worker_->TerminateWorkerContext(); // The worker thread was started. Wait for shutdown tasks to finish. @@ -305,11 +305,11 @@ start_data_.wait_for_debugger_mode = WebEmbeddedWorkerStartData::kWaitForDebugger; worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); EXPECT_CALL(*mock_client_, WorkerContextFailedToStartOnMainThread()).Times(1); worker_->TerminateWorkerContext(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); } TEST_F(WebEmbeddedWorkerImplTest, TerminateWhileWaitingForDebugger_OMT_Fetch) { @@ -321,7 +321,7 @@ start_data_.wait_for_debugger_mode = WebEmbeddedWorkerStartData::kWaitForDebugger; worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); worker_->TerminateWorkerContext(); // The worker thread isn't started yet so we don't have to wait for shutdown. @@ -339,13 +339,13 @@ .Times(testing::AtLeast(1)) .WillRepeatedly(testing::Return(false)); worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Terminate before loading the script. EXPECT_CALL(*mock_client_, WorkerContextFailedToStartOnMainThread()).Times(1); worker_->TerminateWorkerContext(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); } TEST_F(WebEmbeddedWorkerImplTest, TerminateWhileLoadingScript_OMT_Fetch) { @@ -360,7 +360,7 @@ .Times(testing::AtLeast(1)) .WillRepeatedly(testing::Return(false)); worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Terminate before finishing the script load. @@ -387,18 +387,18 @@ .Times(testing::AtLeast(1)) .WillRepeatedly(testing::Return(false)); worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoadedOnMainThread()).Times(1); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); // Terminate before resuming after download. EXPECT_CALL(*mock_client_, WorkerContextFailedToStartOnMainThread()).Times(1); worker_->TerminateWorkerContext(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); } TEST_F(WebEmbeddedWorkerImplTest, ScriptNotFound) { @@ -421,14 +421,14 @@ .Times(testing::AtLeast(1)) .WillRepeatedly(testing::Return(false)); worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoadedOnMainThread()).Times(0); EXPECT_CALL(*mock_client_, WorkerContextFailedToStartOnMainThread()).Times(1); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); } TEST_F(WebEmbeddedWorkerImplTest, ScriptNotFound_OMT_Fetch) { @@ -452,7 +452,7 @@ .WillRepeatedly(testing::Return(false)); // Start worker and load the script. worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); mock_client_->WaitUntilFailedToLoadClassicScript(); @@ -483,7 +483,7 @@ .Times(testing::AtLeast(1)) .WillRepeatedly(testing::Return(false)); worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. @@ -495,7 +495,7 @@ .WillRepeatedly(testing::Return(false)); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); mock_client_->WaitUntilScriptEvaluated(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Terminate the running worker thread. @@ -526,13 +526,13 @@ start_data_.pause_after_download_mode = WebEmbeddedWorkerStartData::kPauseAfterDownload; worker_->StartWorkerContext(start_data_); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Load the script. EXPECT_CALL(*mock_client_, WorkerScriptLoadedOnMainThread()).Times(1); Platform::Current()->GetURLLoaderMockFactory()->ServeAsynchronousRequests(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); // Resume after download. // This is called on the worker thread. @@ -542,7 +542,7 @@ .WillRepeatedly(testing::Return(false)); worker_->ResumeAfterDownload(); mock_client_->WaitUntilScriptEvaluated(); - testing::Mock::VerifyAndClearExpectations(mock_client_); + testing::Mock::VerifyAndClearExpectations(mock_client_.get()); testing::Mock::VerifyAndClearExpectations(mock_installed_scripts_manager_); // Terminate the running worker thread.
diff --git a/third_party/blink/renderer/modules/speech/speech_recognition.h b/third_party/blink/renderer/modules/speech/speech_recognition.h index 988bc1f..fb936e1 100644 --- a/third_party/blink/renderer/modules/speech/speech_recognition.h +++ b/third_party/blink/renderer/modules/speech/speech_recognition.h
@@ -38,7 +38,6 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/mojo/revocable_binding.h" #include "third_party/blink/renderer/platform/mojo/revocable_interface_ptr.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc b/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc index 6235942..65f9fd98 100644 --- a/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc +++ b/third_party/blink/renderer/modules/storage/cached_storage_area_test.cc
@@ -10,6 +10,7 @@ #include "third_party/blink/renderer/modules/storage/testing/mock_storage_area.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/text/string_builder.h" namespace blink { @@ -498,33 +499,36 @@ } TEST_P(StringEncoding, RoundTrip_UTF16) { - String key("key"); - key.append(UChar(0xd83d)); - key.append(UChar(0xde00)); - EXPECT_EQ( - Uint8VectorToString(StringToUint8Vector(key, GetParam()), GetParam()), - key); + StringBuilder key; + key.Append("key"); + key.Append(UChar(0xd83d)); + key.Append(UChar(0xde00)); + EXPECT_EQ(Uint8VectorToString(StringToUint8Vector(key.ToString(), GetParam()), + GetParam()), + key); } TEST_P(StringEncoding, RoundTrip_InvalidUTF16) { - String key("foo"); - key.append(UChar(0xd83d)); - key.append(UChar(0xde00)); - key.append(UChar(0xdf01)); - key.append("bar"); + StringBuilder key; + key.Append("foo"); + key.Append(UChar(0xd83d)); + key.Append(UChar(0xde00)); + key.Append(UChar(0xdf01)); + key.Append("bar"); if (GetParam() != FormatOption::kSessionStorageForceUTF8) { - EXPECT_EQ( - Uint8VectorToString(StringToUint8Vector(key, GetParam()), GetParam()), - key); + EXPECT_EQ(Uint8VectorToString( + StringToUint8Vector(key.ToString(), GetParam()), GetParam()), + key); } else { - String validKey("foo"); - validKey.append(UChar(0xd83d)); - validKey.append(UChar(0xde00)); - validKey.append(UChar(0xfffd)); - validKey.append("bar"); - EXPECT_EQ( - Uint8VectorToString(StringToUint8Vector(key, GetParam()), GetParam()), - validKey); + StringBuilder validKey; + validKey.Append("foo"); + validKey.Append(UChar(0xd83d)); + validKey.Append(UChar(0xde00)); + validKey.Append(UChar(0xfffd)); + validKey.Append("bar"); + EXPECT_EQ(Uint8VectorToString( + StringToUint8Vector(key.ToString(), GetParam()), GetParam()), + validKey.ToString()); } } @@ -532,14 +536,15 @@ TEST_F(CachedStorageAreaTest, StringEncoding_LocalStorage) { String ascii_key("simplekey"); - String non_ascii_key("key"); - non_ascii_key.append(UChar(0xd83d)); - non_ascii_key.append(UChar(0xde00)); + StringBuilder non_ascii_key; + non_ascii_key.Append("key"); + non_ascii_key.Append(UChar(0xd83d)); + non_ascii_key.Append(UChar(0xde00)); EXPECT_EQ( StringToUint8Vector(ascii_key, FormatOption::kLocalStorageDetectFormat) .size(), ascii_key.length() + 1); - EXPECT_EQ(StringToUint8Vector(non_ascii_key, + EXPECT_EQ(StringToUint8Vector(non_ascii_key.ToString(), FormatOption::kLocalStorageDetectFormat) .size(), non_ascii_key.length() * 2 + 1); @@ -547,29 +552,31 @@ TEST_F(CachedStorageAreaTest, StringEncoding_UTF8) { String ascii_key("simplekey"); - String non_ascii_key("key"); - non_ascii_key.append(UChar(0xd83d)); - non_ascii_key.append(UChar(0xde00)); + StringBuilder non_ascii_key; + non_ascii_key.Append("key"); + non_ascii_key.Append(UChar(0xd83d)); + non_ascii_key.Append(UChar(0xde00)); EXPECT_EQ( StringToUint8Vector(ascii_key, FormatOption::kSessionStorageForceUTF8) .size(), ascii_key.length()); - EXPECT_EQ( - StringToUint8Vector(non_ascii_key, FormatOption::kSessionStorageForceUTF8) - .size(), - 7u); + EXPECT_EQ(StringToUint8Vector(non_ascii_key.ToString(), + FormatOption::kSessionStorageForceUTF8) + .size(), + 7u); } TEST_F(CachedStorageAreaTest, StringEncoding_UTF16) { String ascii_key("simplekey"); - String non_ascii_key("key"); - non_ascii_key.append(UChar(0xd83d)); - non_ascii_key.append(UChar(0xde00)); + StringBuilder non_ascii_key; + non_ascii_key.Append("key"); + non_ascii_key.Append(UChar(0xd83d)); + non_ascii_key.Append(UChar(0xde00)); EXPECT_EQ( StringToUint8Vector(ascii_key, FormatOption::kSessionStorageForceUTF16) .size(), ascii_key.length() * 2); - EXPECT_EQ(StringToUint8Vector(non_ascii_key, + EXPECT_EQ(StringToUint8Vector(non_ascii_key.ToString(), FormatOption::kSessionStorageForceUTF16) .size(), non_ascii_key.length() * 2);
diff --git a/third_party/blink/renderer/modules/vr/vr_display.h b/third_party/blink/renderer/modules/vr/vr_display.h index 94a20fc..26e3e70 100644 --- a/third_party/blink/renderer/modules/vr/vr_display.h +++ b/third_party/blink/renderer/modules/vr/vr_display.h
@@ -240,8 +240,7 @@ Member<WebGLRenderingContextBase> rendering_context_; Member<XRFrameTransport> frame_transport_; - TraceWrapperMember<ScriptedAnimationController> - scripted_animation_controller_; + Member<ScriptedAnimationController> scripted_animation_controller_; bool pending_vrdisplay_raf_ = false; bool pending_presenting_vsync_ = false; bool pending_non_immersive_vsync_ = false;
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h b/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h index 72771b2ad..ed961630 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h
@@ -113,11 +113,9 @@ private: bool is_closing_ = false; - typedef HeapHashMap<String, - TraceWrapperMember<AudioWorkletProcessorDefinition>> + typedef HeapHashMap<String, Member<AudioWorkletProcessorDefinition>> ProcessorDefinitionMap; - typedef HeapVector<TraceWrapperMember<AudioWorkletProcessor>> - ProcessorInstances; + typedef HeapVector<Member<AudioWorkletProcessor>> ProcessorInstances; ProcessorDefinitionMap processor_definition_map_; ProcessorInstances processor_instances_;
diff --git a/third_party/blink/renderer/modules/webaudio/audio_worklet_processor_definition.h b/third_party/blink/renderer/modules/webaudio/audio_worklet_processor_definition.h index 0977518..c5fa9ee 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_worklet_processor_definition.h +++ b/third_party/blink/renderer/modules/webaudio/audio_worklet_processor_definition.h
@@ -8,7 +8,6 @@ #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/webaudio/audio_param_descriptor.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "v8/include/v8.h" @@ -69,8 +68,8 @@ // The definition is per global scope. The active instance of // |AudioProcessorWorklet| should be passed into these to perform JS function. - TraceWrapperMember<V8BlinkAudioWorkletProcessorConstructor> constructor_; - TraceWrapperMember<V8BlinkAudioWorkletProcessCallback> process_; + Member<V8BlinkAudioWorkletProcessorConstructor> constructor_; + Member<V8BlinkAudioWorkletProcessCallback> process_; HeapVector<Member<AudioParamDescriptor>> audio_param_descriptors_; };
diff --git a/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.h b/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.h index 48458fea..df15108 100644 --- a/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.h +++ b/third_party/blink/renderer/modules/webaudio/media_element_audio_source_node.h
@@ -137,7 +137,7 @@ UNLOCK_FUNCTION(GetMediaElementAudioSourceHandler().GetProcessLock()); private: - TraceWrapperMember<HTMLMediaElement> media_element_; + Member<HTMLMediaElement> media_element_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webdatabase/database.h b/third_party/blink/renderer/modules/webdatabase/database.h index fb327b27..d8c509f 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.h +++ b/third_party/blink/renderer/modules/webdatabase/database.h
@@ -36,7 +36,6 @@ #include "third_party/blink/renderer/modules/webdatabase/sql_transaction_backend.h" #include "third_party/blink/renderer/modules/webdatabase/sqlite/sqlite_database.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/weborigin/security_origin.h" #include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h index 1429b743..7383987 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl2_compute_rendering_context_base.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h" #include "third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink {
diff --git a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h index e704910a..383a5ebc 100644 --- a/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl2_rendering_context_base.h
@@ -8,7 +8,6 @@ #include <memory> #include "third_party/blink/renderer/modules/webgl/webgl_extension.h" #include "third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -1112,37 +1111,34 @@ GLsizei height, const char* function_name); - TraceWrapperMember<WebGLFramebuffer> read_framebuffer_binding_; - TraceWrapperMember<WebGLTransformFeedback> transform_feedback_binding_; + Member<WebGLFramebuffer> read_framebuffer_binding_; + Member<WebGLTransformFeedback> transform_feedback_binding_; // This instance isn't exposed to JavaScript, which is why it's a - // Member rather than TraceWrapperMember. + // Member rather than Member. Member<WebGLTransformFeedback> default_transform_feedback_; std::set<GLenum> supported_internal_formats_storage_; std::set<GLenum> compressed_texture_formats_etc2eac_; - TraceWrapperMember<WebGLBuffer> bound_copy_read_buffer_; - TraceWrapperMember<WebGLBuffer> bound_copy_write_buffer_; - TraceWrapperMember<WebGLBuffer> bound_pixel_pack_buffer_; - TraceWrapperMember<WebGLBuffer> bound_pixel_unpack_buffer_; - TraceWrapperMember<WebGLBuffer> bound_transform_feedback_buffer_; - TraceWrapperMember<WebGLBuffer> bound_uniform_buffer_; - TraceWrapperMember<WebGLBuffer> bound_atomic_counter_buffer_; - TraceWrapperMember<WebGLBuffer> bound_shader_storage_buffer_; + Member<WebGLBuffer> bound_copy_read_buffer_; + Member<WebGLBuffer> bound_copy_write_buffer_; + Member<WebGLBuffer> bound_pixel_pack_buffer_; + Member<WebGLBuffer> bound_pixel_unpack_buffer_; + Member<WebGLBuffer> bound_transform_feedback_buffer_; + Member<WebGLBuffer> bound_uniform_buffer_; + Member<WebGLBuffer> bound_atomic_counter_buffer_; + Member<WebGLBuffer> bound_shader_storage_buffer_; - HeapVector<TraceWrapperMember<WebGLBuffer>> - bound_indexed_atomic_counter_buffers_; - HeapVector<TraceWrapperMember<WebGLBuffer>> - bound_indexed_shader_storage_buffers_; - HeapVector<TraceWrapperMember<WebGLBuffer>> bound_indexed_uniform_buffers_; + HeapVector<Member<WebGLBuffer>> bound_indexed_atomic_counter_buffers_; + HeapVector<Member<WebGLBuffer>> bound_indexed_shader_storage_buffers_; + HeapVector<Member<WebGLBuffer>> bound_indexed_uniform_buffers_; GLint max_transform_feedback_separate_attribs_; wtf_size_t max_bound_uniform_buffer_index_; - TraceWrapperMember<WebGLQuery> current_boolean_occlusion_query_; - TraceWrapperMember<WebGLQuery> - current_transform_feedback_primitives_written_query_; - TraceWrapperMember<WebGLQuery> current_elapsed_query_; - HeapVector<TraceWrapperMember<WebGLSampler>> sampler_units_; + Member<WebGLQuery> current_boolean_occlusion_query_; + Member<WebGLQuery> current_transform_feedback_primitives_written_query_; + Member<WebGLQuery> current_elapsed_query_; + HeapVector<Member<WebGLSampler>> sampler_units_; GLint pack_row_length_; GLint pack_skip_pixels_;
diff --git a/third_party/blink/renderer/modules/webgl/webgl_context_group.h b/third_party/blink/renderer/modules/webgl/webgl_context_group.h index 38b70c8..8e114e3 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_context_group.h +++ b/third_party/blink/renderer/modules/webgl/webgl_context_group.h
@@ -70,7 +70,7 @@ uint32_t number_of_context_losses_; - HeapHashSet<TraceWrapperMember<WebGLRenderingContextBase>> contexts_; + HeapHashSet<Member<WebGLRenderingContextBase>> contexts_; DISALLOW_COPY_AND_ASSIGN(WebGLContextGroup); };
diff --git a/third_party/blink/renderer/modules/webgl/webgl_context_object.h b/third_party/blink/renderer/modules/webgl/webgl_context_object.h index 65575a2..e7c5355 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_context_object.h +++ b/third_party/blink/renderer/modules/webgl/webgl_context_object.h
@@ -27,7 +27,6 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGL_WEBGL_CONTEXT_OBJECT_H_ #include "third_party/blink/renderer/modules/webgl/webgl_object.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -54,7 +53,7 @@ gpu::gles2::GLES2Interface* GetAGLInterface() const final; private: - TraceWrapperMember<WebGLRenderingContextBase> context_; + Member<WebGLRenderingContextBase> context_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/webgl_framebuffer.cc b/third_party/blink/renderer/modules/webgl/webgl_framebuffer.cc index 4637d403..fd87ef5 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_framebuffer.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_framebuffer.cc
@@ -56,7 +56,7 @@ GLenum target, GLenum attachment) override; - TraceWrapperMember<WebGLRenderbuffer> renderbuffer_; + Member<WebGLRenderbuffer> renderbuffer_; }; WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::Create( @@ -132,7 +132,7 @@ GLenum target, GLenum attachment) override; - TraceWrapperMember<WebGLTexture> texture_; + Member<WebGLTexture> texture_; GLenum target_; GLint level_; GLint layer_;
diff --git a/third_party/blink/renderer/modules/webgl/webgl_framebuffer.h b/third_party/blink/renderer/modules/webgl/webgl_framebuffer.h index d9962803..98ec17d 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_framebuffer.h +++ b/third_party/blink/renderer/modules/webgl/webgl_framebuffer.h
@@ -154,8 +154,7 @@ GLuint object_; - typedef HeapHashMap<GLenum, TraceWrapperMember<WebGLAttachment>> - AttachmentMap; + typedef HeapHashMap<GLenum, Member<WebGLAttachment>> AttachmentMap; AttachmentMap attachments_;
diff --git a/third_party/blink/renderer/modules/webgl/webgl_program.h b/third_party/blink/renderer/modules/webgl/webgl_program.h index 776704d..6bc3aaf 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_program.h +++ b/third_party/blink/renderer/modules/webgl/webgl_program.h
@@ -29,7 +29,6 @@ #include "base/memory/scoped_refptr.h" #include "third_party/blink/renderer/modules/webgl/webgl_shader.h" #include "third_party/blink/renderer/modules/webgl/webgl_shared_platform_3d_object.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -93,9 +92,9 @@ // feedback objects. unsigned active_transform_feedback_count_; - TraceWrapperMember<WebGLShader> vertex_shader_; - TraceWrapperMember<WebGLShader> fragment_shader_; - TraceWrapperMember<WebGLShader> compute_shader_; + Member<WebGLShader> vertex_shader_; + Member<WebGLShader> fragment_shader_; + Member<WebGLShader> compute_shader_; bool info_valid_;
diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h index 7fb4669..132311a 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h
@@ -582,15 +582,13 @@ DISALLOW_NEW(); public: - TraceWrapperMember<WebGLTexture> texture2d_binding_; - TraceWrapperMember<WebGLTexture> texture_cube_map_binding_; - TraceWrapperMember<WebGLTexture> texture3d_binding_; - TraceWrapperMember<WebGLTexture> texture2d_array_binding_; - TraceWrapperMember<WebGLTexture> texture_video_image_binding_; + Member<WebGLTexture> texture2d_binding_; + Member<WebGLTexture> texture_cube_map_binding_; + Member<WebGLTexture> texture3d_binding_; + Member<WebGLTexture> texture2d_array_binding_; + Member<WebGLTexture> texture_video_image_binding_; void Trace(blink::Visitor*); - // Wrappers are traced by parent since TextureUnitState is not a heap - // object. }; scoped_refptr<StaticBitmapImage> GetImage( @@ -731,7 +729,7 @@ // to the back-buffer of m_context. scoped_refptr<DrawingBuffer> drawing_buffer_; - TraceWrapperMember<WebGLContextGroup> context_group_; + Member<WebGLContextGroup> context_group_; bool is_origin_top_left_ = false; @@ -757,10 +755,10 @@ // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and // stored values for ELEMENT_ARRAY_BUFFER - TraceWrapperMember<WebGLBuffer> bound_array_buffer_; + Member<WebGLBuffer> bound_array_buffer_; Member<WebGLVertexArrayObjectBase> default_vertex_array_object_; - TraceWrapperMember<WebGLVertexArrayObjectBase> bound_vertex_array_object_; + Member<WebGLVertexArrayObjectBase> bound_vertex_array_object_; void SetBoundVertexArrayObject(WebGLVertexArrayObjectBase*); enum VertexAttribValueType { @@ -773,9 +771,9 @@ unsigned max_vertex_attribs_; void SetVertexAttribType(GLuint index, VertexAttribValueType); - TraceWrapperMember<WebGLProgram> current_program_; - TraceWrapperMember<WebGLFramebuffer> framebuffer_binding_; - TraceWrapperMember<WebGLRenderbuffer> renderbuffer_binding_; + Member<WebGLProgram> current_program_; + Member<WebGLFramebuffer> framebuffer_binding_; + Member<WebGLRenderbuffer> renderbuffer_binding_; bool xr_compatible_; @@ -938,11 +936,11 @@ Member<T>& extension_field_; // ExtensionTracker holds it's own reference to the extension to ensure // that it is not deleted before this object's destructor is called - TraceWrapperMember<T> extension_; + Member<T> extension_; }; bool extension_enabled_[kWebGLExtensionNameCount]; - HeapVector<TraceWrapperMember<ExtensionTracker>> extensions_; + HeapVector<Member<ExtensionTracker>> extensions_; HashSet<String> disabled_extensions_; template <typename T>
diff --git a/third_party/blink/renderer/modules/webgl/webgl_shared_object.h b/third_party/blink/renderer/modules/webgl/webgl_shared_object.h index f2d4822d..0054c58 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_shared_object.h +++ b/third_party/blink/renderer/modules/webgl/webgl_shared_object.h
@@ -27,7 +27,6 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGL_WEBGL_SHARED_OBJECT_H_ #include "third_party/blink/renderer/modules/webgl/webgl_object.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" namespace blink { @@ -64,7 +63,7 @@ gpu::gles2::GLES2Interface* GetAGLInterface() const final; private: - TraceWrapperMember<WebGLContextGroup> context_group_; + Member<WebGLContextGroup> context_group_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/webgl_transform_feedback.h b/third_party/blink/renderer/modules/webgl/webgl_transform_feedback.h index a27fb6f..7908b0e 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_transform_feedback.h +++ b/third_party/blink/renderer/modules/webgl/webgl_transform_feedback.h
@@ -55,7 +55,7 @@ bool active() const { return active_; } bool paused() const { return paused_; } - const HeapVector<TraceWrapperMember<WebGLBuffer>>& + const HeapVector<Member<WebGLBuffer>>& bound_indexed_transform_feedback_buffers() const { return bound_indexed_transform_feedback_buffers_; } @@ -81,8 +81,7 @@ TFType type_; GLenum target_; - HeapVector<TraceWrapperMember<WebGLBuffer>> - bound_indexed_transform_feedback_buffers_; + HeapVector<Member<WebGLBuffer>> bound_indexed_transform_feedback_buffers_; Member<WebGLProgram> program_; unsigned program_link_count_;
diff --git a/third_party/blink/renderer/modules/webgl/webgl_vertex_array_object_base.h b/third_party/blink/renderer/modules/webgl/webgl_vertex_array_object_base.h index 9b0de361..7e8967d 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_vertex_array_object_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl_vertex_array_object_base.h
@@ -7,7 +7,6 @@ #include "third_party/blink/renderer/modules/webgl/webgl_buffer.h" #include "third_party/blink/renderer/modules/webgl/webgl_context_object.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -58,8 +57,8 @@ VaoType type_; bool has_ever_been_bound_; - TraceWrapperMember<WebGLBuffer> bound_element_array_buffer_; - HeapVector<TraceWrapperMember<WebGLBuffer>> array_buffer_list_; + Member<WebGLBuffer> bound_element_array_buffer_; + HeapVector<Member<WebGLBuffer>> array_buffer_list_; Vector<bool> attrib_enabled_; bool is_all_enabled_attrib_buffer_bound_; };
diff --git a/third_party/blink/renderer/modules/webmidi/midi_port.h b/third_party/blink/renderer/modules/webmidi/midi_port.h index 8682fe2..cf1624b 100644 --- a/third_party/blink/renderer/modules/webmidi/midi_port.h +++ b/third_party/blink/renderer/modules/webmidi/midi_port.h
@@ -38,7 +38,6 @@ #include "third_party/blink/renderer/core/execution_context/context_lifecycle_observer.h" #include "third_party/blink/renderer/modules/event_target_modules.h" #include "third_party/blink/renderer/modules/webmidi/midi_accessor.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -120,7 +119,7 @@ String name_; TypeCode type_; String version_; - TraceWrapperMember<MIDIAccess> access_; + Member<MIDIAccess> access_; midi::mojom::PortState state_; ConnectionState connection_; unsigned running_open_count_ = 0;
diff --git a/third_party/blink/renderer/modules/websockets/dom_websocket_test.cc b/third_party/blink/renderer/modules/websockets/dom_websocket_test.cc index 9e751db..b2f83b88 100644 --- a/third_party/blink/renderer/modules/websockets/dom_websocket_test.cc +++ b/third_party/blink/renderer/modules/websockets/dom_websocket_test.cc
@@ -359,8 +359,7 @@ "abcdefghijklmnopqrstuvwxyz|~"; size_t length = strlen(kValidCharacters); for (size_t i = 0; i < length; ++i) { - String s; - s.append(static_cast<UChar>(kValidCharacters[i])); + String s(kValidCharacters + i, 1u); EXPECT_TRUE(DOMWebSocket::IsValidSubprotocolString(s)); } for (size_t i = 0; i < 256; ++i) { @@ -368,8 +367,8 @@ static_cast<char>(i)) != kValidCharacters + length) { continue; } - String s; - s.append(static_cast<UChar>(i)); + char to_check = char{i}; + String s(&to_check, 1u); EXPECT_FALSE(DOMWebSocket::IsValidSubprotocolString(s)); } }
diff --git a/third_party/blink/renderer/modules/websockets/websocket_handle_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_handle_impl.cc index 165f641..730870f 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_handle_impl.cc +++ b/third_party/blink/renderer/modules/websockets/websocket_handle_impl.cc
@@ -42,8 +42,8 @@ base::SingleThreadTaskRunner* task_runner) { DCHECK(!websocket_); websocket_ = std::move(websocket); - websocket_.set_connection_error_with_reason_handler(WTF::Bind( - &WebSocketHandleImpl::OnConnectionError, WTF::Unretained(this))); + // We intentionally ignore errors on |websocket_| in favour of catching them + // on |client_binding_|, which gives more reliable ordering semantics. DCHECK(websocket_); NETWORK_DVLOG(1) << this << " connect(" << url.GetString() << ")"; @@ -60,6 +60,8 @@ } client_binding_.Bind(mojo::MakeRequest(&client_proxy, task_runner), task_runner); + client_binding_.set_connection_error_handler(WTF::Bind( + &WebSocketHandleImpl::OnConnectionError, WTF::Unretained(this))); websocket_->AddChannelRequest(url, protocols, site_for_cookies, std::move(additional_headers), std::move(client_proxy)); @@ -119,22 +121,10 @@ client_ = nullptr; } -void WebSocketHandleImpl::OnConnectionError(uint32_t custom_reason, - const std::string& description) { +void WebSocketHandleImpl::OnConnectionError() { // Our connection to the WebSocket was dropped. This could be due to // exceeding the maximum number of concurrent websockets from this process. - String failure_message; - if (custom_reason == - network::mojom::blink::WebSocket::kInsufficientResources) { - failure_message = - description.empty() - ? "Insufficient resources" - : String::FromUTF8(description.c_str(), description.size()); - } else { - DCHECK(description.empty()); - failure_message = "Unspecified reason"; - } - OnFailChannel(failure_message); + OnFailChannel("Unknown reason"); } void WebSocketHandleImpl::OnFailChannel(const String& message) {
diff --git a/third_party/blink/renderer/modules/websockets/websocket_handle_impl.h b/third_party/blink/renderer/modules/websockets/websocket_handle_impl.h index 16923af..90033fa 100644 --- a/third_party/blink/renderer/modules/websockets/websocket_handle_impl.h +++ b/third_party/blink/renderer/modules/websockets/websocket_handle_impl.h
@@ -57,8 +57,7 @@ private: void Disconnect(); - void OnConnectionError(uint32_t custom_reason, - const std::string& description); + void OnConnectionError(); // network::mojom::blink::WebSocketClient methods: void OnFailChannel(const String& reason) override;
diff --git a/third_party/blink/renderer/modules/xr/xr_canvas_input_provider.h b/third_party/blink/renderer/modules/xr/xr_canvas_input_provider.h index 7811f71..4f0d67b 100644 --- a/third_party/blink/renderer/modules/xr/xr_canvas_input_provider.h +++ b/third_party/blink/renderer/modules/xr/xr_canvas_input_provider.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_CANVAS_INPUT_PROVIDER_H_ #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/transforms/transformation_matrix.h" #include "third_party/blink/renderer/platform/wtf/forward.h" @@ -52,7 +51,7 @@ const Member<XRSession> session_; Member<HTMLCanvasElement> canvas_; Member<EventListener> listener_; - TraceWrapperMember<XRInputSource> input_source_; + Member<XRInputSource> input_source_; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/xr/xr_frame.h b/third_party/blink/renderer/modules/xr/xr_frame.h index 5d5ce35..e1204e1 100644 --- a/third_party/blink/renderer/modules/xr/xr_frame.h +++ b/third_party/blink/renderer/modules/xr/xr_frame.h
@@ -9,7 +9,6 @@ #include "device/vr/public/mojom/vr_service.mojom-blink.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/transforms/transformation_matrix.h" #include "third_party/blink/renderer/platform/wtf/forward.h"
diff --git a/third_party/blink/renderer/modules/xr/xr_frame_request_callback_collection.h b/third_party/blink/renderer/modules/xr/xr_frame_request_callback_collection.h index 28ff06d..f61136f5 100644 --- a/third_party/blink/renderer/modules/xr/xr_frame_request_callback_collection.h +++ b/third_party/blink/renderer/modules/xr/xr_frame_request_callback_collection.h
@@ -6,7 +6,6 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_XR_XR_FRAME_REQUEST_CALLBACK_COLLECTION_H_ #include "third_party/blink/renderer/platform/bindings/name_client.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" namespace blink { @@ -41,8 +40,7 @@ !WTF::IsHashTraitsEmptyValue<Traits, CallbackId>(id); } - using CallbackMap = - HeapHashMap<CallbackId, TraceWrapperMember<V8XRFrameRequestCallback>>; + using CallbackMap = HeapHashMap<CallbackId, Member<V8XRFrameRequestCallback>>; CallbackMap callbacks_; Vector<CallbackId> pending_callbacks_;
diff --git a/third_party/blink/renderer/modules/xr/xr_session.h b/third_party/blink/renderer/modules/xr/xr_session.h index 0dbbe9d..18c6811 100644 --- a/third_party/blink/renderer/modules/xr/xr_session.h +++ b/third_party/blink/renderer/modules/xr/xr_session.h
@@ -13,7 +13,6 @@ #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" #include "third_party/blink/renderer/modules/xr/xr_frame_request_callback_collection.h" #include "third_party/blink/renderer/modules/xr/xr_input_source.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/geometry/double_size.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/transforms/transformation_matrix.h" @@ -94,8 +93,7 @@ int requestAnimationFrame(V8XRFrameRequestCallback*); void cancelAnimationFrame(int id); - using InputSourceMap = - HeapHashMap<uint32_t, TraceWrapperMember<XRInputSource>>; + using InputSourceMap = HeapHashMap<uint32_t, Member<XRInputSource>>; HeapVector<Member<XRInputSource>> getInputSources() const; @@ -234,7 +232,7 @@ mojo::Binding<device::mojom::blink::XRSessionClient> client_binding_; - TraceWrapperMember<XRFrameRequestCallbackCollection> callback_collection_; + Member<XRFrameRequestCallbackCollection> callback_collection_; std::unique_ptr<TransformationMatrix> base_pose_matrix_; WTF::Vector<float> non_immersive_projection_matrix_;
diff --git a/third_party/blink/renderer/modules/xr/xr_webgl_layer.h b/third_party/blink/renderer/modules/xr/xr_webgl_layer.h index 0131a5b..49d131a 100644 --- a/third_party/blink/renderer/modules/xr/xr_webgl_layer.h +++ b/third_party/blink/renderer/modules/xr/xr_webgl_layer.h
@@ -91,7 +91,7 @@ scoped_refptr<XRWebGLDrawingBuffer::MirrorClient> mirror_client_; - TraceWrapperMember<WebGLRenderingContextBase> webgl_context_; + Member<WebGLRenderingContextBase> webgl_context_; scoped_refptr<XRWebGLDrawingBuffer> drawing_buffer_; Member<WebGLFramebuffer> framebuffer_;
diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn index 5a83754..9384159 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn
@@ -665,6 +665,7 @@ "fonts/mac/font_cache_mac.mm", "fonts/mac/font_matcher_mac.h", "fonts/mac/font_matcher_mac.mm", + "fonts/mac/font_platform_data_mac.h", "fonts/mac/font_platform_data_mac.mm", "fonts/ng_text_fragment_paint_info.h", "fonts/opentype/font_format_check.cc", @@ -1195,8 +1196,6 @@ "mac/graphics_context_canvas.mm", "mac/local_current_graphics_context.h", "mac/local_current_graphics_context.mm", - "mac/theme_mac.h", - "mac/theme_mac.mm", "mac/version_util_mac.h", "mac/version_util_mac.mm", "mac/web_core_ns_cell_extras.h", @@ -1327,9 +1326,6 @@ "text/win/hyphenation_win.cc", "text/writing_mode.h", "text/writing_mode_utils.h", - "theme.cc", - "theme.h", - "theme_types.h", "timer.cc", "timer.h", "transforms/affine_transform.cc",
diff --git a/third_party/blink/renderer/platform/bindings/TraceWrapperReference.md b/third_party/blink/renderer/platform/bindings/TraceWrapperReference.md index d8b0b2c2..ba02fbf 100644 --- a/third_party/blink/renderer/platform/bindings/TraceWrapperReference.md +++ b/third_party/blink/renderer/platform/bindings/TraceWrapperReference.md
@@ -1,229 +1,8 @@ # Wrapper Tracing Reference -This document describes wrapper tracing and how its API is supposed to be used. -Note that wrapper tracing is based on Oilpan garbage collection infrastructure, which makes [Oilpan's documentation][oilpan-docs] a good first read. +*Wrapper tracing is deprecated* and not in use anymore. Blink uses *unified heap* these days which just relies on regular Oilpan types for C++. -[TOC] +In case you are looking for how to keep JavaScript wrapper alive from C++ using tracing use the following: +- Use `Member<T>` for any managed pointer, independent of whether a JavaScript object is transitively reachable or not. With wrapper tracing interesting references required manually annotating with `TraceWrapperMember<T>`. This is not needed anymore; in fact, the type does not exist anymore. +- Use `TraceWrapperV8Reference<T>` to annotate references to V8 that this object should keep alive. -## Quickstart guide - -Wrapper tracing is used to represent reachability across V8 and Blink. -The following checklist highlights the modifications needed to make a class participate in wrapper tracing. - -1. Make sure that objects participating in tracing either inherit from `ScriptWrappable` if they can reference wrappers or are otherwise part of Oilpan's heap, e.g. by making them inherit from `GarbageCollected` or one of its friends. -2. Use `TraceWrapperMember<T>` to annotate fields that need to be followed to find other wrappers that this object should keep alive. -3. Use `TraceWrapperV8Reference<T>` to annotate references to V8 that this object should keep alive. -4. Make sure those fields are properly visited from `T::Trace`, similar to all other garbage collected types. - -The following example illustrates these steps: - -```c++ -#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" - -class SomeDOMObject : public ScriptWrappable { // (1) - DEFINE_WRAPPERTYPEINFO(); - - public: - void Trace(Visitor*) override; - - private: - Member<NonWrappable> non_wrappable_; - TraceWrapperMember<OtherWrappable> other_wrappable_; // (2) - TraceWrapperV8Reference<v8::Value> v8object_; // (3) - // ... -}; - -void SomeDOMObject::Trace(Visitor* visitor) { - visitor->Trace(non_wrappable_); - visitor->Trace(other_wrappable_); // (4) - visitor->Trace(v8object_); // (4) - ScriptWrappable::Trace(visitor); -} -``` - -For more in-depth information and how to deal with corner cases continue on reading. - -## Background - -Blink and V8 need to cooperate to collect JavaScript *wrappers*. -Each V8 *wrapper* object (*W*) in JavaScript is assigned a C++ *DOM object* (*D*) in Blink. -A single C++ *DOM object* can hold onto one or many *wrapper* objects. -During a garbage collection initiated from JavaScript, a *wrapper* then keeps the C++ *DOM object* and all its transitive dependencies, including other *wrappers*, alive, effectively tracing paths like *W<sub>x</sub> -> D<sub>1</sub> -> ⋯ -> D<sub>n</sub> -> W<sub>y</sub>*. - -Previously, this relationship was expressed using so-called object groups, effectively assigning all C++ *DOM objects* in a given DOM tree the same group. -The group would only die if all objects belonging to the same group die. -A brief introduction on the limitations on this approach can be found in [this slide deck][object-grouping-slides]. - -Wrapper tracing solves this problem by determining liveness based on reachability by tracing through the C++ *DOM objects*. -The rest of this document describes how the API is used to keep JavaScript wrapper objects alive. - -Note that *wrappables* have to be part of Oilpan and thus all [Oilpan-related rules][oilpan-docs] apply. - -[object-grouping-slides]: https://docs.google.com/presentation/d/1I6leiRm0ysSTqy7QWh33Gfp7_y4ngygyM2tDAqdF0fI/ -[oilpan-docs]: https://chromium.googlesource.com/chromium/src/+/master/third_party/blink/renderer/platform/heap/BlinkGCAPIReference.md - -## Basic usage - -The annotations that are required can be found in the following header files. -Pick the header file depending on what types are needed. - -```c++ -#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_v8_reference.h" -``` - -The following example will guide through the modifications that are needed to adjust a given class `SomeDOMObject` to participate in wrapper tracing. - -```c++ -class SomeDOMObject : public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - // ... - - private: - Member<OtherWrappable /* extending ScriptWrappable */> other_wrappable_; - Member<NonWrappable> non_wrappable_; -}; -``` - -In this scenario `SomeDOMObject` is the object that is wrapped by an object on the JavaScript side. -The next step is to identify the paths that lead to other wrappables. -In this case, only `other_wrappable_` needs to be traced to find other *wrappers* in V8. - -```c++ -class SomeDOMObject : public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - public: - void Trace(Visitor*) override; - - private: - Member<OtherWrappable> other_wrappable_; - Member<NonWrappable> non_wrappable_; -}; - -void SomeDOMObject::Trace(Visitor* visitor) { - visitor->Trace(other_wrappable_); - visitor->Trace(non_wrappable_); - ScriptWrappable::Trace(visitor); -} -``` - -Blink and V8 implement *incremental* wrapper tracing, which means that marking can be interleaved with JavaScript or even DOM operations. -This poses a challenge, because already marked objects will not be considered again if they are reached through some other path. - -For example, consider an object `A` that has already been marked and a write to a field `A.x` setting `x` to an unmarked object `Y`. -Since `A.x` is the only reference keeping `Y`, and `A` has already been marked, the garbage collector will not find `Y` and reclaim it. - -To overcome this problem we require all writes of interesting objects, i.e., writes to traced fields, to go through a write barrier. -The write barrier will check for the problem case above and make sure `Y` will be marked. -In order to automatically issue a write barrier `other_wrappable_` needs `TraceWrapperMember` type. - -```c++ -class SomeDOMObject : public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - public: - void Trace(Visitor*) override; - - private: - TraceWrapperMember<OtherWrappable> other_wrappable_; - Member<NonWrappable> non_wrappable_; -}; - -void SomeDOMObject::Trace(Visitor* visitor) { - visitor->Trace(other_wrappable_); - visitor->Trace(non_wrappable_); - ScriptWrappable::Trace(visitor); -} -``` - -`TraceWrapperMember` makes sure that any write to `other_wrappable_` will consider doing a write barrier. -Using the proper type, the write barrier is correct by construction, i.e., it will never be missed. - -## Heap collections - -Wrapper tracing is integrated into Oilpan's support for collections, so there's no additional work needed other than making sure the collection is visited in the corresponding `Trace` method. -The proper type usage for collections, e.g. `HeapVector` looks like the following. - -```c++ -class SomeDOMObject : public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - public: - void Trace(Visitor*) override; - - void AppendNewValue(OtherWrappable* newValue); - - private: - HeapVector<TraceWrapperMember<OtherWrappable>> other_wrappables_; -}; - -void SomeDOMObject::Trace(Visitor* visitor) { - visitor->Trace(other_wrappables_); - ScriptWrappable::Trace(visitor); -} -``` - -`TraceWrapperMember` can be constructed in place, so using `append` and -friends will work out of the box, e.g. - -```c++ -void SomeDOMObject::AppendNewValue(OtherWrappable* newValue) { - other_wrappables_.append(newValue); -} -``` - -### Swapping `HeapVector` containing `TraceWrapperMember` and `Member` - -It is possible to swap two `HeapVectors` containing `TraceWrapperMember` and -`Member` by using `blink::swap`. The underlying swap will avoid copies and -write barriers if possible. - -```c++ -// Swap two wrapper traced heap vectors. -HeapVector<TraceWrapperMember<Wrappable>> a; -HeapVector<TraceWrapperMember<Wrappable>> b; -blink::swap(a, b); - -// Swap in a non-traced heap vector into a wrapper traced one. -HeapVector<TraceWrapperMember<Wrappable>> c; -HeapVector<Member<Wrappable>> temporary; -blink::swap(c, temporary); -``` - -## Tracing through non-`ScriptWrappable` types - -Sometimes it is necessary to trace through types that do not inherit from `ScriptWrappable`. -For example, consider the object graph `A -> B -> C` where both `A` and `C` are `ScriptWrappable`s that need to be traced. - -In this case, the same rules as with `ScriptWrappables` apply, except for the difference that these classes need to inherit from some other class that is managed by Oilpan, e.g. `GarbageCollected`. - -## Explicit write barriers - -Sometimes it is necessary to stick with the regular types or raw pointers and issue the write barriers explicitly. -In this case, tracing needs to be adjusted to tell the system that all barriers will be done manually. - -```c++ -class ManualWrappable : public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - public: - void Trace(Visitor*) override; - - void SetNew(OtherWrappable* newValue) { - other_wrappable_ = newValue; - SriptWrappableVisitor::WriteBarrier(other_wrappable_); - } - - private: - Member<OtherWrappable>> other_wrappable_; -}; - -void ManualWrappable::Trace(Visitor* visitor) { - visitor->TraceWithWrappers(other_wrappable_.Get()); - ScriptWrappable::Trace(visitor); -} -```
diff --git a/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc b/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc index a75d4dd..e56d983 100644 --- a/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc +++ b/third_party/blink/renderer/platform/bindings/active_script_wrappable_base.cc
@@ -46,7 +46,7 @@ continue; ScriptWrappable* script_wrappable = active_wrappable->ToScriptWrappable(); - visitor->TraceWithWrappers(script_wrappable); + visitor->Trace(script_wrappable); } }
diff --git a/third_party/blink/renderer/platform/bindings/trace_wrapper_member.h b/third_party/blink/renderer/platform/bindings/trace_wrapper_member.h deleted file mode 100644 index c4a74f1..0000000 --- a/third_party/blink/renderer/platform/bindings/trace_wrapper_member.h +++ /dev/null
@@ -1,78 +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 THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_TRACE_WRAPPER_MEMBER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_TRACE_WRAPPER_MEMBER_H_ - -#include "third_party/blink/renderer/platform/heap/heap_allocator.h" - -namespace blink { - -template <typename T> -class Member; - -// TraceWrapperMember is used for Member fields that should participate in -// wrapper tracing, i.e., strongly hold a ScriptWrappable alive. All -// TraceWrapperMember fields must be traced in the class' |Trace| method. -template <class T> -class TraceWrapperMember : public Member<T> { - DISALLOW_NEW(); - - public: - TraceWrapperMember() : Member<T>(nullptr) {} - - TraceWrapperMember(T* raw) : Member<T>(raw) {} - - TraceWrapperMember(WTF::HashTableDeletedValueType x) : Member<T>(x) {} - - TraceWrapperMember(const TraceWrapperMember& other) { *this = other; } - - TraceWrapperMember& operator=(const TraceWrapperMember& other) { - Member<T>::operator=(other); - DCHECK_EQ(other.Get(), this->Get()); - return *this; - } - - TraceWrapperMember& operator=(const Member<T>& other) { - Member<T>::operator=(other); - DCHECK_EQ(other.Get(), this->Get()); - return *this; - } - - TraceWrapperMember& operator=(T* other) { - Member<T>::operator=(other); - DCHECK_EQ(other, this->Get()); - return *this; - } - - TraceWrapperMember& operator=(std::nullptr_t) { - // No need for a write barrier when assigning nullptr. - Member<T>::operator=(nullptr); - return *this; - } -}; - -// HeapVectorBacking<TraceWrapperMember<T>> need to map to -// HeapVectorBacking<Member<T>> for performing the swap method below. -template <typename T, typename Traits> -struct GCInfoTrait<HeapVectorBacking<TraceWrapperMember<T>, Traits>> - : public GCInfoTrait< - HeapVectorBacking<Member<T>, WTF::VectorTraits<Member<T>>>> {}; - -// Swaps two HeapVectors, one containing TraceWrapperMember and one with -// regular Members. The custom swap function is required as TraceWrapperMember -// potentially requires emitting a write barrier. -template <typename T> -void swap(HeapVector<TraceWrapperMember<T>>& a, HeapVector<Member<T>>& b) { - // HeapVector<Member<T>> and HeapVector<TraceWrapperMember<T>> have the - // same size and semantics. This cast and swap assumes that GCInfo for both - // TraceWrapperMember and Member match in vector backings. - HeapVector<Member<T>>& a_ = reinterpret_cast<HeapVector<Member<T>>&>(a); - a_.swap(b); - // TODO(mlippautz): Remove this method -} - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_BINDINGS_TRACE_WRAPPER_MEMBER_H_
diff --git a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h index d44383a..cc5a69c 100644 --- a/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h +++ b/third_party/blink/renderer/platform/bindings/v8_dom_wrapper.h
@@ -40,7 +40,6 @@ #include "third_party/blink/renderer/platform/bindings/v8_binding.h" #include "third_party/blink/renderer/platform/heap/unified_heap_marking_visitor.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "v8/include/v8.h"
diff --git a/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc b/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc index 45c8cc6..a9ce328a 100644 --- a/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc +++ b/third_party/blink/renderer/platform/bindings/wrapper_type_info.cc
@@ -41,18 +41,4 @@ } } -void WrapperTypeInfo::TraceWithWrappers(Visitor* visitor, void* impl) const { - switch (wrapper_class_id) { - case WrapperTypeInfo::kNodeClassId: - case WrapperTypeInfo::kObjectClassId: - visitor->TraceWithWrappers(reinterpret_cast<ScriptWrappable*>(impl)); - break; - case WrapperTypeInfo::kCustomWrappableId: - visitor->TraceWithWrappers(reinterpret_cast<CustomWrappable*>(impl)); - break; - default: - NOTREACHED(); - } -} - } // namespace blink
diff --git a/third_party/blink/renderer/platform/bindings/wrapper_type_info.h b/third_party/blink/renderer/platform/bindings/wrapper_type_info.h index e755189..6bdd8b74 100644 --- a/third_party/blink/renderer/platform/bindings/wrapper_type_info.h +++ b/third_party/blink/renderer/platform/bindings/wrapper_type_info.h
@@ -154,7 +154,6 @@ // Garbage collection support for when the type depends the WrapperTypeInfo // object. PLATFORM_EXPORT void Trace(Visitor*, void*) const; - PLATFORM_EXPORT void TraceWithWrappers(Visitor*, void*) const; // This field must be the first member of the struct WrapperTypeInfo. // See also static_assert() in .cpp file.
diff --git a/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.cc b/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.cc index b7b6d66..166fe77 100644 --- a/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.cc +++ b/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.cc
@@ -5,6 +5,8 @@ #include "third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.h" #include "mojo/public/mojom/base/shared_memory.mojom-blink.h" #include "third_party/blink/public/mojom/font_unique_name_lookup/font_unique_name_lookup.mojom-blink.h" +#include "third_party/blink/public/platform/interface_provider.h" +#include "third_party/blink/public/platform/platform.h" namespace blink { @@ -12,7 +14,7 @@ sk_sp<SkTypeface> FontUniqueNameLookupAndroid::MatchUniqueName( const String& font_unique_name) { - if (!EnsureMatchingServiceConnected<mojom::blink::FontUniqueNameLookupPtr>()) + if (!EnsureMatchingServiceConnected()) return nullptr; base::Optional<FontTableMatcher::MatchResult> match_result = font_table_matcher_->MatchName(font_unique_name.Utf8().data()); @@ -22,4 +24,26 @@ match_result->ttc_index); } +bool FontUniqueNameLookupAndroid::EnsureMatchingServiceConnected() { + if (font_table_matcher_) + return true; + + mojom::blink::FontUniqueNameLookupPtr service; + Platform::Current()->GetInterfaceProvider()->GetInterface( + mojo::MakeRequest(&service)); + + base::ReadOnlySharedMemoryRegion region_ptr; + if (!service->GetUniqueNameLookupTable(®ion_ptr)) { + // Tests like StyleEngineTest do not set up a full browser where Blink can + // connect to a browser side service for font lookups. Placing a DCHECK here + // is too strict for such a case. + LOG(ERROR) << "Unable to connect to browser side service for src: local() " + "font lookup."; + return false; + } + + font_table_matcher_ = std::make_unique<FontTableMatcher>(region_ptr.Map()); + return true; +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.h b/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.h index 4447709..738fb2d 100644 --- a/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.h +++ b/third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.h
@@ -19,6 +19,8 @@ sk_sp<SkTypeface> MatchUniqueName(const String& font_unique_name) override; private: + bool EnsureMatchingServiceConnected(); + DISALLOW_COPY_AND_ASSIGN(FontUniqueNameLookupAndroid); };
diff --git a/third_party/blink/renderer/platform/fonts/font_platform_data.cc b/third_party/blink/renderer/platform/fonts/font_platform_data.cc index 0d948a2..b31daf89 100644 --- a/third_party/blink/renderer/platform/fonts/font_platform_data.cc +++ b/third_party/blink/renderer/platform/fonts/font_platform_data.cc
@@ -89,7 +89,7 @@ FontPlatformData::FontPlatformData(const FontPlatformData& source) : typeface_(source.typeface_), -#if !defined(OS_WIN) +#if !defined(OS_WIN) && !defined(OS_MACOSX) family_(source.family_), #endif text_size_(source.text_size_), @@ -111,7 +111,7 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float text_size) : FontPlatformData(src.typeface_, -#if !defined(OS_WIN) +#if !defined(OS_WIN) && !defined(OS_MACOSX) src.family_.data(), #else CString(), @@ -129,7 +129,7 @@ bool synthetic_italic, FontOrientation orientation) : typeface_(typeface), -#if !defined(OS_WIN) +#if !defined(OS_WIN) && !defined(OS_MACOSX) family_(family), #endif text_size_(text_size), @@ -180,7 +180,7 @@ return *this; typeface_ = other.typeface_; -#if !defined(OS_WIN) +#if !defined(OS_WIN) && !defined(OS_MACOSX) family_ = other.family_; #endif text_size_ = other.text_size_;
diff --git a/third_party/blink/renderer/platform/fonts/font_platform_data.h b/third_party/blink/renderer/platform/fonts/font_platform_data.h index b4eaf2e3..8df5288 100644 --- a/third_party/blink/renderer/platform/fonts/font_platform_data.h +++ b/third_party/blink/renderer/platform/fonts/font_platform_data.h
@@ -49,12 +49,7 @@ #include "third_party/skia/include/core/SkTypeface.h" #if defined(OS_MACOSX) -OBJC_CLASS NSFont; - -typedef struct CGFont* CGFontRef; typedef const struct __CTFont* CTFontRef; - -#include <objc/objc-auto.h> #endif // defined(OS_MACOSX) class SkFont; @@ -65,7 +60,6 @@ class Font; class HarfBuzzFace; -class FontVariationSettings; class PLATFORM_EXPORT FontPlatformData { USING_FAST_MALLOC(FontPlatformData); @@ -84,14 +78,6 @@ bool synthetic_italic, FontOrientation = FontOrientation::kHorizontal); FontPlatformData(const FontPlatformData& src, float text_size); -#if defined(OS_MACOSX) - FontPlatformData(NSFont*, - float size, - bool synthetic_bold, - bool synthetic_italic, - FontOrientation, - FontVariationSettings*); -#endif FontPlatformData(const sk_sp<SkTypeface>, const CString& name, float text_size, @@ -171,7 +157,7 @@ #endif sk_sp<SkTypeface> typeface_; -#if !defined(OS_WIN) +#if !defined(OS_WIN) && !defined(OS_MACOSX) CString family_; #endif
diff --git a/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc b/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc index 1b5e433..6655884f 100644 --- a/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc +++ b/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc
@@ -4,8 +4,6 @@ #include "third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h" #include "base/macros.h" -#include "third_party/blink/public/platform/interface_provider.h" -#include "third_party/blink/public/platform/platform.h" #if defined(OS_ANDROID) #include "third_party/blink/public/mojom/font_unique_name_lookup/font_unique_name_lookup.mojom-blink.h" @@ -13,7 +11,6 @@ #elif defined(OS_LINUX) #include "third_party/blink/renderer/platform/fonts/linux/font_unique_name_lookup_linux.h" #elif defined(OS_WIN) -#include "third_party/blink/public/mojom/dwrite_font_proxy/dwrite_font_proxy.mojom-blink.h" #include "third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.h" #endif @@ -36,37 +33,4 @@ #endif } -#if defined(OS_WIN) || defined(OS_ANDROID) -template <class ServicePtrType> -bool FontUniqueNameLookup::EnsureMatchingServiceConnected() { - if (font_table_matcher_) - return true; - - ServicePtrType service; - Platform::Current()->GetInterfaceProvider()->GetInterface( - mojo::MakeRequest(&service)); - - base::ReadOnlySharedMemoryRegion region_ptr; - if (!service->GetUniqueNameLookupTable(®ion_ptr)) { - // Tests like StyleEngineTest do not set up a full browser where Blink can - // connect to a browser side service for font lookups. Placing a DCHECK here - // is too strict for such a case. - LOG(ERROR) << "Unable to connect to browser side service for src: local() " - "font lookup."; - return false; - } - - font_table_matcher_ = std::make_unique<FontTableMatcher>(region_ptr.Map()); - return true; -} -#endif - -#if defined(OS_ANDROID) -template bool FontUniqueNameLookup::EnsureMatchingServiceConnected< - mojom::blink::FontUniqueNameLookupPtr>(); -#elif defined(OS_WIN) -template bool FontUniqueNameLookup::EnsureMatchingServiceConnected< - mojom::blink::DWriteFontProxyPtr>(); -#endif - } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h b/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h index dab629ed..3f7390f 100644 --- a/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h +++ b/third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_UNIQUE_NAME_LOOKUP_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_UNIQUE_NAME_LOOKUP_H_ +#include "base/callback.h" #include "base/macros.h" #include "build/build_config.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" @@ -35,14 +36,30 @@ virtual ~FontUniqueNameLookup() = default; + // Below: Methods for asynchronously retrieving the FontUniqueNameLookup + // table. Currently needed on Windows, on other platforms the implementation + // is synchronous. + + // Determines whether fonts can be uniquely matched synchronously. + virtual bool IsFontUniqueNameLookupReadyForSyncLookup() { return true; } + + // If fonts cannot be uniquely matched synchronously, send a Mojo IPC call to + // prepare the lookup table, and wait for the callback. Once the callback has + // been called, IsFontUniqueNameLookupReadyForSyncLookup() will become true. + // PrepareFontUniqueNameLookup() must not be called if + // IsFontUniqueNameLookupReadyForSyncLookup() is true already. + using NotifyFontUniqueNameLookupReady = base::OnceCallback<void()>; + virtual void PrepareFontUniqueNameLookup( + NotifyFontUniqueNameLookupReady callback) { + NOTREACHED(); + } + protected: FontUniqueNameLookup(); // Windows and Android share the concept of connecting to a Mojo service for // retrieving a ReadOnlySharedMemoryRegion with the lookup table in it. #if defined(OS_WIN) || defined(OS_ANDROID) - template <class ServicePtrType> - bool EnsureMatchingServiceConnected(); std::unique_ptr<FontTableMatcher> font_table_matcher_; #endif
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm index 3db8f050..f50fc362 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm +++ b/third_party/blink/renderer/platform/fonts/mac/font_cache_mac.mm
@@ -39,6 +39,7 @@ #include "third_party/blink/renderer/platform/fonts/font_face_creation_params.h" #include "third_party/blink/renderer/platform/fonts/font_platform_data.h" #include "third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.h" +#include "third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h" #include "third_party/blink/renderer/platform/fonts/simple_font_data.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/scheduler/public/thread.h" @@ -216,14 +217,14 @@ !IsAppKitFontWeightBold(substitute_font_weight) && ![substitute_font.familyName isEqual:@"Apple Color Emoji"]; - FontPlatformData alternate_font( + std::unique_ptr<FontPlatformData> alternate_font = FontPlatformDataFromNSFont( substitute_font, platform_data.size(), synthetic_bold, (traits & NSFontItalicTrait) && !(substitute_font_traits & NSFontItalicTrait), platform_data.Orientation(), nullptr); // No variation paramaters in fallback. - return FontDataFromFontPlatformData(&alternate_font, kDoNotRetain); + return FontDataFromFontPlatformData(alternate_font.get(), kDoNotRetain); } scoped_refptr<SimpleFontData> FontCache::GetLastResortFallbackFont( @@ -292,10 +293,9 @@ // font loading failing. Out-of-process loading occurs for registered fonts // stored in non-system locations. When loading fails, we do not want to use // the returned FontPlatformData since it will not have a valid SkTypeface. - std::unique_ptr<FontPlatformData> platform_data = - std::make_unique<FontPlatformData>( - platform_font, size, synthetic_bold, synthetic_italic, - font_description.Orientation(), font_description.VariationSettings()); + std::unique_ptr<FontPlatformData> platform_data = FontPlatformDataFromNSFont( + platform_font, size, synthetic_bold, synthetic_italic, + font_description.Orientation(), font_description.VariationSettings()); if (!platform_data->Typeface()) { return nullptr; }
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h new file mode 100644 index 0000000..b1224be --- /dev/null +++ b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h
@@ -0,0 +1,54 @@ +/* + * Copyright (c) 2019, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_MAC_FONT_PLATFORM_DATA_MAC_H_ +#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_MAC_FONT_PLATFORM_DATA_MAC_H_ + +#include <memory> + +@class NSFont; + +namespace blink { + +enum class FontOrientation; +class FontPlatformData; +class FontVariationSettings; + +std::unique_ptr<FontPlatformData> FontPlatformDataFromNSFont( + NSFont*, + float size, + bool synthetic_bold, + bool synthetic_italic, + FontOrientation, + FontVariationSettings*); + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_MAC_FONT_PLATFORM_DATA_MAC_H_
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm index 303f9013..f3a7b80 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm +++ b/third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.mm
@@ -21,7 +21,7 @@ * */ -#import "third_party/blink/renderer/platform/fonts/font_platform_data.h" +#import "third_party/blink/renderer/platform/fonts/mac/font_platform_data_mac.h" #import <AppKit/NSFont.h> #import <AvailabilityMacros.h> @@ -33,6 +33,7 @@ #import "third_party/blink/public/platform/mac/web_sandbox_support.h" #import "third_party/blink/public/platform/platform.h" #import "third_party/blink/renderer/platform/fonts/font.h" +#import "third_party/blink/renderer/platform/fonts/font_platform_data.h" #import "third_party/blink/renderer/platform/fonts/opentype/font_settings.h" #import "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h" #import "third_party/blink/renderer/platform/web_test_support.h" @@ -110,6 +111,46 @@ return return_font; } +std::unique_ptr<FontPlatformData> FontPlatformDataFromNSFont( + NSFont* ns_font, + float size, + bool synthetic_bold, + bool synthetic_italic, + FontOrientation orientation, + FontVariationSettings* variation_settings) { + DCHECK(ns_font); + sk_sp<SkTypeface> typeface; + if (CanLoadInProcess(ns_font)) { + typeface.reset(SkCreateTypefaceFromCTFont(base::mac::NSToCFCast(ns_font))); + } else { + // In process loading fails for cases where third party font manager + // software registers fonts in non system locations such as /Library/Fonts + // and ~/Library Fonts, see crbug.com/72727 or crbug.com/108645. + typeface = LoadFromBrowserProcess(ns_font, size); + } + + if (variation_settings && variation_settings->size() < UINT16_MAX) { + SkFontArguments::Axis axes[variation_settings->size()]; + for (size_t i = 0; i < variation_settings->size(); ++i) { + AtomicString feature_tag = variation_settings->at(i).Tag(); + axes[i] = {AtomicStringToFourByteTag(feature_tag), + SkFloatToScalar(variation_settings->at(i).Value())}; + } + sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); + // TODO crbug.com/670246: Refactor this to a future Skia API that acccepts + // axis parameters on system fonts directly. + typeface = fm->makeFromStream( + typeface->openStream(nullptr)->duplicate(), + SkFontArguments().setAxes(axes, variation_settings->size())); + } + + return std::make_unique<FontPlatformData>( + std::move(typeface), + CString(), // family_ doesn't exist on Mac, this avoids conversion from + // NSString which requires including a //base header + size, synthetic_bold, synthetic_italic, orientation); +} + void FontPlatformData::SetupSkFont(SkFont* skfont, float, const Font* font) const { @@ -167,43 +208,4 @@ skfont->setHinting(SkFontHinting::kNone); } -FontPlatformData::FontPlatformData(NSFont* ns_font, - float size, - bool synthetic_bold, - bool synthetic_italic, - FontOrientation orientation, - FontVariationSettings* variation_settings) - : text_size_(size), - synthetic_bold_(synthetic_bold), - synthetic_italic_(synthetic_italic), - orientation_(orientation), - is_hash_table_deleted_value_(false) { - DCHECK(ns_font); - sk_sp<SkTypeface> typeface; - if (CanLoadInProcess(ns_font)) { - typeface.reset(SkCreateTypefaceFromCTFont(base::mac::NSToCFCast(ns_font))); - } else { - // In process loading fails for cases where third party font manager - // software registers fonts in non system locations such as /Library/Fonts - // and ~/Library Fonts, see crbug.com/72727 or crbug.com/108645. - typeface = LoadFromBrowserProcess(ns_font, size); - } - - if (variation_settings && variation_settings->size() < UINT16_MAX) { - SkFontArguments::Axis axes[variation_settings->size()]; - for (size_t i = 0; i < variation_settings->size(); ++i) { - AtomicString feature_tag = variation_settings->at(i).Tag(); - axes[i] = {AtomicStringToFourByteTag(feature_tag), - SkFloatToScalar(variation_settings->at(i).Value())}; - } - sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault()); - // TODO crbug.com/670246: Refactor this to a future Skia API that acccepts - // axis parameters on system fonts directly. - typeface = fm->makeFromStream( - typeface->openStream(nullptr)->duplicate(), - SkFontArguments().setAxes(axes, variation_settings->size())); - } - typeface_ = typeface; -} - } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/orientation_iterator_test.cc b/third_party/blink/renderer/platform/fonts/orientation_iterator_test.cc index 7e9ff0a..23f34ddf 100644 --- a/third_party/blink/renderer/platform/fonts/orientation_iterator_test.cc +++ b/third_party/blink/renderer/platform/fonts/orientation_iterator_test.cc
@@ -6,6 +6,8 @@ #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" + namespace blink { struct OrientationTestRun { @@ -26,10 +28,11 @@ class OrientationIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<OrientationTestRun>& runs) { - String text(g_empty_string16_bit); + StringBuilder text; + text.Ensure16Bit(); Vector<OrientationExpectedRun> expect; for (auto& run : runs) { - text.append(String::FromUTF8(run.text)); + text.Append(String::FromUTF8(run.text)); expect.push_back(OrientationExpectedRun(text.length(), run.code)); } OrientationIterator orientation_iterator(text.Characters16(), text.length(),
diff --git a/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc b/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc index 80bfbff..592f73c5 100644 --- a/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc +++ b/third_party/blink/renderer/platform/fonts/script_run_iterator_test.cc
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/threading.h" @@ -107,7 +108,8 @@ } static String ToTestString(const std::string& input) { - String result(g_empty_string16_bit); + StringBuilder result; + result.Ensure16Bit(); bool in_set = false; int seen = 0; int code = 0; @@ -168,7 +170,7 @@ case '>': DCHECK_NE(seen, 0); code |= TableLookup(list); - result.append(static_cast<UChar>(kMockCharMin + code)); + result.Append(static_cast<UChar>(kMockCharMin + code)); in_set = false; break; default: @@ -221,10 +223,10 @@ DLOG(ERROR) << "Illegal mock string set char: '" << c << "'"; } if (!in_set) { - result.append(static_cast<UChar>(kMockCharMin + code)); + result.Append(static_cast<UChar>(kMockCharMin + code)); } } - return result; + return result.ToString(); } // We determine properties based on the offset from kMockCharMin: @@ -286,10 +288,11 @@ class ScriptRunIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<ScriptTestRun>& runs) { - String text(g_empty_string16_bit); + StringBuilder text; + text.Ensure16Bit(); Vector<ScriptExpectedRun> expect; for (auto& run : runs) { - text.append(String::FromUTF8(run.text)); + text.Append(String::FromUTF8(run.text)); expect.push_back(ScriptExpectedRun(text.length(), run.code)); } ScriptRunIterator script_run_iterator(text.Characters16(), text.length()); @@ -299,10 +302,11 @@ // FIXME crbug.com/527329 - CheckMockRuns should be replaced by finding // suitable equivalent real codepoint sequences instead. void CheckMockRuns(const Vector<ScriptTestRun>& runs) { - String text(g_empty_string16_bit); + StringBuilder text; + text.Ensure16Bit(); Vector<ScriptExpectedRun> expect; for (const ScriptTestRun& run : runs) { - text.append(MockScriptData::ToTestString(run.text)); + text.Append(MockScriptData::ToTestString(run.text)); expect.push_back(ScriptExpectedRun(text.length(), run.code)); }
diff --git a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc index d824cf4..1a07e62c 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
@@ -50,7 +50,6 @@ #include "third_party/blink/renderer/platform/fonts/small_caps_iterator.h" #include "third_party/blink/renderer/platform/fonts/utf16_text_iterator.h" #include "third_party/blink/renderer/platform/text/text_break_iterator.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/deque.h" #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
diff --git a/third_party/blink/renderer/platform/fonts/shaping/run_segmenter_test.cc b/third_party/blink/renderer/platform/fonts/shaping/run_segmenter_test.cc index 35c150d..8ab1e186 100644 --- a/third_party/blink/renderer/platform/fonts/shaping/run_segmenter_test.cc +++ b/third_party/blink/renderer/platform/fonts/shaping/run_segmenter_test.cc
@@ -8,6 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/fonts/orientation_iterator.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -44,11 +45,12 @@ protected: void CheckRuns(const Vector<SegmenterTestRun>& runs, FontOrientation orientation) { - String text(g_empty_string16_bit); + StringBuilder text; + text.Ensure16Bit(); Vector<SegmenterExpectedRun> expect; for (auto& run : runs) { unsigned length_before = text.length(); - text.append(String::FromUTF8(run.text.c_str())); + text.Append(String::FromUTF8(run.text.c_str())); expect.push_back(SegmenterExpectedRun(length_before, text.length(), run.script, run.render_orientation, run.font_fallback_priority));
diff --git a/third_party/blink/renderer/platform/fonts/small_caps_iterator_test.cc b/third_party/blink/renderer/platform/fonts/small_caps_iterator_test.cc index ec0ccf03..312d4ab 100644 --- a/third_party/blink/renderer/platform/fonts/small_caps_iterator_test.cc +++ b/third_party/blink/renderer/platform/fonts/small_caps_iterator_test.cc
@@ -6,6 +6,8 @@ #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" + namespace blink { struct SmallCapsTestRun { @@ -26,10 +28,11 @@ class SmallCapsIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<SmallCapsTestRun>& runs) { - String text(g_empty_string16_bit); + StringBuilder text; + text.Ensure16Bit(); Vector<SmallCapsExpectedRun> expect; for (auto& run : runs) { - text.append(String::FromUTF8(run.text)); + text.Append(String::FromUTF8(run.text)); expect.push_back(SmallCapsExpectedRun(text.length(), run.code)); } SmallCapsIterator small_caps_iterator(text.Characters16(), text.length());
diff --git a/third_party/blink/renderer/platform/fonts/symbols_iterator_test.cc b/third_party/blink/renderer/platform/fonts/symbols_iterator_test.cc index 3f446c9..cf4937b 100644 --- a/third_party/blink/renderer/platform/fonts/symbols_iterator_test.cc +++ b/third_party/blink/renderer/platform/fonts/symbols_iterator_test.cc
@@ -7,6 +7,7 @@ #include <string> #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -29,10 +30,11 @@ class SymbolsIteratorTest : public testing::Test { protected: void CheckRuns(const Vector<FallbackTestRun>& runs) { - String text(g_empty_string16_bit); + StringBuilder text; + text.Ensure16Bit(); Vector<FallbackExpectedRun> expect; for (auto& run : runs) { - text.append(String::FromUTF8(run.text.c_str())); + text.Append(String::FromUTF8(run.text.c_str())); expect.push_back( FallbackExpectedRun(text.length(), run.font_fallback_priority)); }
diff --git a/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator.cc b/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator.cc index a43813a..a482b0a6 100644 --- a/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator.cc +++ b/third_party/blink/renderer/platform/fonts/utf16_ragel_iterator.cc
@@ -12,6 +12,11 @@ namespace { char EmojiSegmentationCategory(UChar32 codepoint) { + if (codepoint <= 0x7F) { + if (Character::IsEmojiKeycapBase(codepoint)) + return UTF16RagelIterator::KEYCAP_BASE; + return UTF16RagelIterator::kMaxEmojiScannerCategory; + } // For the grammar to work, we need to check for more specific character // classes first, then expand towards more generic ones. So we match single // characters and small ranges first, then return EMOJI and @@ -41,8 +46,6 @@ return UTF16RagelIterator::EMOJI_MODIFIER; if (Character::IsRegionalIndicator(codepoint)) return UTF16RagelIterator::REGIONAL_INDICATOR; - if (Character::IsEmojiKeycapBase(codepoint)) - return UTF16RagelIterator::KEYCAP_BASE; if (Character::IsEmojiEmojiDefault(codepoint)) return UTF16RagelIterator::EMOJI_EMOJI_PRESENTATION;
diff --git a/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.cc b/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.cc index 715ce89..f094851b 100644 --- a/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.cc +++ b/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.cc
@@ -7,6 +7,8 @@ #include "base/files/file_path.h" #include "mojo/public/mojom/base/shared_memory.mojom-blink.h" #include "third_party/blink/public/mojom/dwrite_font_proxy/dwrite_font_proxy.mojom-blink.h" +#include "third_party/blink/public/platform/interface_provider.h" +#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/platform/histogram.h" #include "third_party/skia/include/ports/SkTypeface_win.h" @@ -32,7 +34,7 @@ sk_sp<SkTypeface> FontUniqueNameLookupWin::MatchUniqueName( const String& font_unique_name) { - if (!EnsureMatchingServiceConnected<mojom::blink::DWriteFontProxyPtr>()) + if (!EnsureMatchingServiceConnected()) return nullptr; base::Optional<FontTableMatcher::MatchResult> match_result = @@ -72,4 +74,26 @@ return local_typeface; } +bool FontUniqueNameLookupWin::EnsureMatchingServiceConnected() { + if (font_table_matcher_) + return true; + + mojom::blink::DWriteFontProxyPtr service; + Platform::Current()->GetInterfaceProvider()->GetInterface( + mojo::MakeRequest(&service)); + + base::ReadOnlySharedMemoryRegion region_ptr; + if (!service->GetUniqueNameLookupTable(®ion_ptr)) { + // Tests like StyleEngineTest do not set up a full browser where Blink can + // connect to a browser side service for font lookups. Placing a DCHECK here + // is too strict for such a case. + LOG(ERROR) << "Unable to connect to browser side service for src: local() " + "font lookup."; + return false; + } + + font_table_matcher_ = std::make_unique<FontTableMatcher>(region_ptr.Map()); + return true; +} + } // namespace blink
diff --git a/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.h b/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.h index 4593b9c..2ef0638 100644 --- a/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.h +++ b/third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.h
@@ -17,6 +17,8 @@ sk_sp<SkTypeface> MatchUniqueName(const String& font_unique_name) override; private: + bool EnsureMatchingServiceConnected(); + DISALLOW_COPY_AND_ASSIGN(FontUniqueNameLookupWin); };
diff --git a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc index ba79034a2..1c27aba 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc +++ b/third_party/blink/renderer/platform/graphics/canvas_2d_layer_bridge.cc
@@ -299,7 +299,6 @@ if (IsAccelerated() && !layer_) { layer_ = cc::TextureLayer::CreateForMailbox(this); layer_->SetIsDrawable(true); - layer_->SetHitTestable(true); layer_->SetContentsOpaque(ColorParams().GetOpacityMode() == kOpaque); layer_->SetBlendBackgroundColor(ColorParams().GetOpacityMode() != kOpaque); layer_->SetNearestNeighbor(resource_host_->FilterQuality() ==
diff --git a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h index 1d0ecf24..8d95154 100644 --- a/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h +++ b/third_party/blink/renderer/platform/graphics/canvas_resource_dispatcher.h
@@ -12,7 +12,6 @@ #include "mojo/public/cpp/bindings/binding.h" #include "services/viz/public/interfaces/compositing/compositor_frame_sink.mojom-blink.h" #include "third_party/blink/public/mojom/frame_sinks/embedded_frame_sink.mojom-blink.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc index 1caf485d..015bbac 100644 --- a/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc +++ b/third_party/blink/renderer/platform/graphics/compositing/content_layer_client_impl.cc
@@ -200,7 +200,6 @@ layer_bounds.OffsetFromOrigin()); cc_picture_layer_->SetBounds(layer_bounds.size()); cc_picture_layer_->SetIsDrawable(true); - cc_picture_layer_->SetHitTestable(true); base::Optional<RasterUnderInvalidationCheckingParams> params; if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled()) {
diff --git a/third_party/blink/renderer/platform/graphics/contiguous_container.h b/third_party/blink/renderer/platform/graphics/contiguous_container.h index 847b27f..25fd22f4 100644 --- a/third_party/blink/renderer/platform/graphics/contiguous_container.h +++ b/third_party/blink/renderer/platform/graphics/contiguous_container.h
@@ -14,7 +14,6 @@ #include "base/macros.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/compiler.h" #include "third_party/blink/renderer/platform/wtf/type_traits.h" #include "third_party/blink/renderer/platform/wtf/vector.h"
diff --git a/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc b/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc index f6c28059..bdd0ab8 100644 --- a/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc +++ b/third_party/blink/renderer/platform/graphics/dark_mode_image_classifier_test.cc
@@ -66,8 +66,7 @@ protected: scoped_refptr<BitmapImage> LoadImage(const std::string& file_name) { - String file_path = test::BlinkWebTestsDir(); - file_path.append(file_name.c_str()); + String file_path = test::BlinkWebTestsDir() + file_name.c_str(); scoped_refptr<SharedBuffer> image_data = test::ReadFromFile(file_path); EXPECT_TRUE(image_data.get() && image_data.get()->size());
diff --git a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc index 99e3da7..4717d68 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/drawing_buffer.cc
@@ -924,7 +924,6 @@ layer_ = cc::TextureLayer::CreateForMailbox(this); layer_->SetIsDrawable(true); - layer_->SetHitTestable(true); layer_->SetContentsOpaque(!want_alpha_channel_); layer_->SetBlendBackgroundColor(want_alpha_channel_); // If premultiplied_alpha_false_texture_ exists, then premultiplied_alpha_
diff --git a/third_party/blink/renderer/platform/graphics/gpu/image_layer_bridge.cc b/third_party/blink/renderer/platform/graphics/gpu/image_layer_bridge.cc index a0aa6435..1fc321b4 100644 --- a/third_party/blink/renderer/platform/graphics/gpu/image_layer_bridge.cc +++ b/third_party/blink/renderer/platform/graphics/gpu/image_layer_bridge.cc
@@ -28,7 +28,6 @@ : opacity_mode_(opacity_mode) { layer_ = cc::TextureLayer::CreateForMailbox(this); layer_->SetIsDrawable(true); - layer_->SetHitTestable(true); layer_->SetNearestNeighbor(filter_quality_ == kNone_SkFilterQuality); if (opacity_mode_ == kOpaque) { layer_->SetContentsOpaque(true);
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.cc b/third_party/blink/renderer/platform/graphics/graphics_layer.cc index a0959355..7eb93baa 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.cc +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.cc
@@ -75,7 +75,7 @@ draws_content_(false), paints_hit_test_(false), contents_visible_(true), - hit_testable_(false), + hit_testable_without_draws_content_(false), needs_check_raster_invalidation_(false), has_scroll_parent_(false), has_clip_parent_(false), @@ -94,7 +94,6 @@ #endif layer_ = cc::PictureLayer::Create(this); CcLayer()->SetIsDrawable(draws_content_ && contents_visible_); - CcLayer()->SetHitTestable(hit_testable_); CcLayer()->SetLayerClient(weak_ptr_factory_.GetWeakPtr()); UpdateTrackingRasterInvalidations(); @@ -545,7 +544,6 @@ // contents_layer, for the correctness of early exit conditions in // SetDrawsContent() and SetContentsVisible(). contents_layer_->SetIsDrawable(contents_visible_); - contents_layer_->SetHitTestable(contents_visible_); // Insert the content layer first. Video elements require this, because they // have shadow content that must display in front of the video. @@ -834,11 +832,11 @@ CcLayer()->SetIsRootForIsolatedGroup(isolated); } -void GraphicsLayer::SetHitTestable(bool should_hit_test) { - if (hit_testable_ == should_hit_test) +void GraphicsLayer::SetHitTestableWithoutDrawsContent(bool should_hit_test) { + if (hit_testable_without_draws_content_ == should_hit_test) return; - hit_testable_ = should_hit_test; - CcLayer()->SetHitTestable(should_hit_test); + hit_testable_without_draws_content_ = should_hit_test; + CcLayer()->SetHitTestableWithoutDrawsContent(should_hit_test); } void GraphicsLayer::SetContentsNeedsDisplay() {
diff --git a/third_party/blink/renderer/platform/graphics/graphics_layer.h b/third_party/blink/renderer/platform/graphics/graphics_layer.h index 99b75a9..a4b051e3 100644 --- a/third_party/blink/renderer/platform/graphics/graphics_layer.h +++ b/third_party/blink/renderer/platform/graphics/graphics_layer.h
@@ -194,8 +194,10 @@ bool IsRootForIsolatedGroup() const; void SetIsRootForIsolatedGroup(bool); - void SetHitTestable(bool); - bool GetHitTestable() const { return hit_testable_; } + void SetHitTestableWithoutDrawsContent(bool); + bool GetHitTestableWithoutDrawsContent() const { + return hit_testable_without_draws_content_; + } void SetFilters(CompositorFilterOperations); void SetBackdropFilters(CompositorFilterOperations, const gfx::RRectF&); @@ -374,7 +376,7 @@ bool draws_content_ : 1; bool paints_hit_test_ : 1; bool contents_visible_ : 1; - bool hit_testable_ : 1; + bool hit_testable_without_draws_content_ : 1; bool needs_check_raster_invalidation_ : 1; bool has_scroll_parent_ : 1;
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 4eca594..c7d946f 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
@@ -27,6 +27,7 @@ #include <memory> #include "base/location.h" +#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" @@ -243,7 +244,16 @@ cc::PaintImage::kDefaultGeneratorClientId); } -TEST_F(ImageFrameGeneratorTest, incompleteDecodeBecomesCompleteMultiThreaded) { +#if defined(OS_ANDROID) || defined(OS_LINUX) +// TODO(crbug.com/948641) +#define MAYBE_incompleteDecodeBecomesCompleteMultiThreaded \ + DISABLED_incompleteDecodeBecomesCompleteMultiThreaded +#else +#define MAYBE_incompleteDecodeBecomesCompleteMultiThreaded \ + incompleteDecodeBecomesCompleteMultiThreaded +#endif // defined(OS_ANDROID) || defined(OS_LINUX) +TEST_F(ImageFrameGeneratorTest, + MAYBE_incompleteDecodeBecomesCompleteMultiThreaded) { SetFrameStatus(ImageFrame::kFramePartial); char buffer[100 * 100 * 4];
diff --git a/third_party/blink/renderer/platform/graphics/surface_layer_bridge.cc b/third_party/blink/renderer/platform/graphics/surface_layer_bridge.cc index 90975021..7955701 100644 --- a/third_party/blink/renderer/platform/graphics/surface_layer_bridge.cc +++ b/third_party/blink/renderer/platform/graphics/surface_layer_bridge.cc
@@ -155,7 +155,6 @@ surface_layer_->SetStretchContentToFillBounds(true); surface_layer_->SetIsDrawable(true); - surface_layer_->SetHitTestable(true); surface_layer_->SetMayContainVideo(true); if (observer_) {
diff --git a/third_party/blink/renderer/platform/graphics/test/fake_web_graphics_context_3d_provider.h b/third_party/blink/renderer/platform/graphics/test/fake_web_graphics_context_3d_provider.h index e28077f..5a7af03 100644 --- a/third_party/blink/renderer/platform/graphics/test/fake_web_graphics_context_3d_provider.h +++ b/third_party/blink/renderer/platform/graphics/test/fake_web_graphics_context_3d_provider.h
@@ -14,7 +14,7 @@ #include "third_party/blink/public/platform/web_graphics_context_3d_provider.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/gpu/GrContext.h" -#include "third_party/skia/include/gpu/mock/GrMockTypes.h" +#include "third_party/skia/include/gpu/gl/GrGLInterface.h" namespace blink { @@ -24,10 +24,8 @@ cc::ImageDecodeCache* cache = nullptr) : gl_(gl), image_decode_cache_(cache ? cache : &stub_image_decode_cache_) { - GrMockOptions mockOptions; - mockOptions.fConfigOptions[kBGRA_8888_GrPixelConfig] = - mockOptions.fConfigOptions[kRGBA_8888_GrPixelConfig]; - gr_context_ = GrContext::MakeMock(&mockOptions); + sk_sp<const GrGLInterface> gl_interface(GrGLCreateNullInterface()); + gr_context_ = GrContext::MakeGL(std::move(gl_interface)); // enable all gpu features. for (unsigned feature = 0; feature < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++feature) {
diff --git a/third_party/blink/renderer/platform/heap/heap_allocator.h b/third_party/blink/renderer/platform/heap/heap_allocator.h index 4c04c8d..04159a8e 100644 --- a/third_party/blink/renderer/platform/heap/heap_allocator.h +++ b/third_party/blink/renderer/platform/heap/heap_allocator.h
@@ -137,7 +137,7 @@ } template <typename T> - static void BackingWriteBarrier(TraceWrapperMember<T>* address, size_t size) { + static void BackingWriteBarrier(Member<T>* address, size_t size) { MarkingVisitor::WriteBarrier(address); } @@ -717,18 +717,6 @@ }; template <typename T> -struct VectorTraits<blink::TraceWrapperMember<T>> - : VectorTraitsBase<blink::TraceWrapperMember<T>> { - STATIC_ONLY(VectorTraits); - static const bool kNeedsDestruction = false; - static const bool kCanInitializeWithMemset = true; - static const bool kCanClearUnusedSlotsWithMemset = true; - static const bool kCanMoveWithMemcpy = true; - static const bool kCanCopyWithMemcpy = true; - static const bool kCanSwapUsingCopyOrMove = true; -}; - -template <typename T> struct VectorTraits<blink::WeakMember<T>> : VectorTraitsBase<blink::WeakMember<T>> { STATIC_ONLY(VectorTraits); @@ -864,39 +852,6 @@ }; template <typename T> -struct HashTraits<blink::TraceWrapperMember<T>> - : SimpleClassHashTraits<blink::TraceWrapperMember<T>> { - STATIC_ONLY(HashTraits); - // FIXME: Implement proper const'ness for iterator types. Requires support - // in the marking Visitor. - using PeekInType = T*; - using IteratorGetType = blink::TraceWrapperMember<T>*; - using IteratorConstGetType = const blink::TraceWrapperMember<T>*; - using IteratorReferenceType = blink::TraceWrapperMember<T>&; - using IteratorConstReferenceType = const blink::TraceWrapperMember<T>&; - static IteratorReferenceType GetToReferenceConversion(IteratorGetType x) { - return *x; - } - static IteratorConstReferenceType GetToReferenceConstConversion( - IteratorConstGetType x) { - return *x; - } - - using PeekOutType = T*; - - template <typename U> - static void Store(const U& value, blink::TraceWrapperMember<T>& storage) { - storage = value; - } - - static PeekOutType Peek(const blink::TraceWrapperMember<T>& value) { - return value; - } - - static blink::TraceWrapperMember<T> EmptyValue() { return nullptr; } -}; - -template <typename T> struct HashTraits<blink::WeakMember<T>> : SimpleClassHashTraits<blink::WeakMember<T>> { STATIC_ONLY(HashTraits);
diff --git a/third_party/blink/renderer/platform/heap/incremental_marking_test.cc b/third_party/blink/renderer/platform/heap/incremental_marking_test.cc index 8d8881e..a39cd7e 100644 --- a/third_party/blink/renderer/platform/heap/incremental_marking_test.cc +++ b/third_party/blink/renderer/platform/heap/incremental_marking_test.cc
@@ -70,7 +70,6 @@ void* callback_data) final {} void RegisterWeakCallback(void* closure, WeakCallback) final {} void Visit(const TraceWrapperV8Reference<v8::Value>&) final {} - void VisitWithWrappers(void*, TraceDescriptor) final {} private: std::vector<void*>* objects_;
diff --git a/third_party/blink/renderer/platform/heap/marking_verifier.h b/third_party/blink/renderer/platform/heap/marking_verifier.h index 959586a..f4095b9 100644 --- a/third_party/blink/renderer/platform/heap/marking_verifier.h +++ b/third_party/blink/renderer/platform/heap/marking_verifier.h
@@ -55,7 +55,6 @@ } void RegisterWeakCallback(void*, WeakCallback) final {} void Visit(const TraceWrapperV8Reference<v8::Value>&) final {} - void VisitWithWrappers(void*, TraceDescriptor) final {} private: void VerifyChild(void* object, void* base_object_payload) {
diff --git a/third_party/blink/renderer/platform/heap/marking_visitor.h b/third_party/blink/renderer/platform/heap/marking_visitor.h index ff4198a..ca797f6 100644 --- a/third_party/blink/renderer/platform/heap/marking_visitor.h +++ b/third_party/blink/renderer/platform/heap/marking_visitor.h
@@ -80,10 +80,6 @@ desc.callback); } - void VisitWithWrappers(void*, TraceDescriptor) final { - // Ignore as the object is also passed to Visit(void*, TraceDescriptor). - } - void VisitWeak(void* object, void** object_slot, TraceDescriptor desc,
diff --git a/third_party/blink/renderer/platform/heap/member.h b/third_party/blink/renderer/platform/heap/member.h index 1e5da80..6c74635 100644 --- a/third_party/blink/renderer/platform/heap/member.h +++ b/third_party/blink/renderer/platform/heap/member.h
@@ -22,8 +22,6 @@ template <typename T> class Persistent; -template <typename T> -class TraceWrapperMember; enum class TracenessMemberConfiguration { kTraced, @@ -551,12 +549,6 @@ }; template <typename T> -struct DefaultHash<blink::TraceWrapperMember<T>> { - STATIC_ONLY(DefaultHash); - using Hash = MemberHash<T>; -}; - -template <typename T> struct IsTraceable<blink::Member<T>> { STATIC_ONLY(IsTraceable); static const bool value = true; @@ -580,12 +572,6 @@ static const bool value = true; }; -template <typename T> -struct IsTraceable<blink::TraceWrapperMember<T>> { - STATIC_ONLY(IsTraceable); - static const bool value = true; -}; - template <typename T, typename Traits, typename Allocator> class ConstructTraits<blink::Member<T>, Traits, Allocator> { STATIC_ONLY(ConstructTraits);
diff --git a/third_party/blink/renderer/platform/heap/page_memory.h b/third_party/blink/renderer/platform/heap/page_memory.h index aca70268..0780971 100644 --- a/third_party/blink/renderer/platform/heap/page_memory.h +++ b/third_party/blink/renderer/platform/heap/page_memory.h
@@ -10,7 +10,6 @@ #include "third_party/blink/renderer/platform/heap/heap_page.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/heap/threading_traits.h b/third_party/blink/renderer/platform/heap/threading_traits.h index 036118b..832b212 100644 --- a/third_party/blink/renderer/platform/heap/threading_traits.h +++ b/third_party/blink/renderer/platform/heap/threading_traits.h
@@ -18,8 +18,6 @@ template <typename T> class SameThreadCheckedMember; -template <typename T> -class TraceWrapperMember; // ThreadAffinity indicates which threads objects can be used on. We // distinguish between objects that can be used on the main thread @@ -92,12 +90,6 @@ }; template <typename T> -struct ThreadingTrait<TraceWrapperMember<T>> { - STATIC_ONLY(ThreadingTrait); - static const ThreadAffinity kAffinity = ThreadingTrait<T>::kAffinity; -}; - -template <typename T> struct ThreadingTrait<WeakMember<T>> { STATIC_ONLY(ThreadingTrait); static const ThreadAffinity kAffinity = ThreadingTrait<T>::kAffinity;
diff --git a/third_party/blink/renderer/platform/heap/visitor.h b/third_party/blink/renderer/platform/heap/visitor.h index 68ef181..fd95a7c 100644 --- a/third_party/blink/renderer/platform/heap/visitor.h +++ b/third_party/blink/renderer/platform/heap/visitor.h
@@ -55,8 +55,6 @@ template <typename T> class SameThreadCheckedMember; template <typename T> -class TraceWrapperMember; -template <typename T> class TraceWrapperV8Reference; // The TraceMethodDelegate is used to convert a trace method for type T to a @@ -205,29 +203,6 @@ // Cross-component tracing interface. - template <typename T> - void Trace(const TraceWrapperMember<T>& t) { - DCHECK(!t.IsHashTableDeletedValue()); - TraceWithWrappers(t.Get()); - } - - template <typename T> - void TraceWithWrappers(T* t) { - static_assert(sizeof(T), "T must be fully defined"); - static_assert(IsGarbageCollectedType<T>::value, - "T needs to be a garbage collected object"); - if (!t) - return; - - // Dispatch two both, the TraceDescritpor and the TraceWrapperDescriptor, - // versions of the visitor. This way the wrapper-tracing world can ignore - // the TraceDescriptor versions. - Visit(const_cast<void*>(reinterpret_cast<const void*>(t)), - TraceDescriptorFor(t)); - VisitWithWrappers(const_cast<void*>(reinterpret_cast<const void*>(t)), - TraceDescriptorFor(t)); - } - template <typename V8Type> void Trace(const TraceWrapperV8Reference<V8Type>& v8reference) { Visit(v8reference.template Cast<v8::Value>()); @@ -237,9 +212,6 @@ // Visits an object through a strong reference. virtual void Visit(void*, TraceDescriptor) = 0; - // Subgraph of objects that are interested in wrappers. Note that the same - // object is also passed to Visit(void*, TraceDescriptor). - virtual void VisitWithWrappers(void*, TraceDescriptor) = 0; // Visits an object through a weak reference. virtual void VisitWeak(void*, void**, TraceDescriptor, WeakCallback) = 0;
diff --git a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc index 7178c121..fa3aaab 100644 --- a/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc +++ b/third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc
@@ -8,6 +8,7 @@ #include "png.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/image-decoders/image_decoder_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/time.h" #include "third_party/skia/include/core/SkImage.h" @@ -1186,10 +1187,12 @@ for (String color_space : color_spaces) { for (String alpha : alpha_status) { PNGSample png_sample; - png_sample.filename.append("_"); - png_sample.filename.append(color_space); - png_sample.filename.append(alpha); - png_sample.filename.append(".png"); + StringBuilder filename; + filename.Append("_"); + filename.Append(color_space); + filename.Append(alpha); + filename.Append(".png"); + png_sample.filename = filename.ToString(); png_sample.color_space = color_space; png_sample.is_transparent = (alpha == "_transparent"); @@ -1218,8 +1221,7 @@ FillPNGSamplesSourcePixels(png_samples); String path = "/images/resources/png-16bit/"; for (PNGSample& png_sample : png_samples) { - String full_path = path; - full_path.append(png_sample.filename); + String full_path = path + png_sample.filename; png_sample.png_contents = ReadFile(full_path.Ascii().data()); auto decoder = Create16BitPNGDecoder(); TestHighBitDepthPNGDecoding(png_sample, decoder.get()); @@ -1233,8 +1235,7 @@ String path = "/images/resources/png-16bit/"; for (PNGSample& png_sample : png_samples) { - String full_path = path; - full_path.append(png_sample.filename); + String full_path = path + png_sample.filename; png_sample.png_contents = ReadFile(full_path.Ascii().data()); ASSERT_TRUE(png_sample.png_contents.get());
diff --git a/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer.h b/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer.h index b6dcef60..bb59397 100644 --- a/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer.h +++ b/third_party/blink/renderer/platform/loader/fetch/buffering_bytes_consumer.h
@@ -8,7 +8,6 @@ #include <memory> #include "base/memory/scoped_refptr.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h" #include "third_party/blink/renderer/platform/platform_export.h" @@ -63,7 +62,7 @@ void OnStateChange() override; void BufferData(); - const TraceWrapperMember<BytesConsumer> bytes_consumer_; + const Member<BytesConsumer> bytes_consumer_; Deque<Vector<char>> buffer_; size_t offset_for_first_chunk_ = 0; bool is_buffering_ = true;
diff --git a/third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h b/third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h index 68d694c..61ac0cd 100644 --- a/third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h +++ b/third_party/blink/renderer/platform/loader/fetch/bytes_consumer.h
@@ -10,7 +10,6 @@ #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/network/encoded_form_data.h" #include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { @@ -24,8 +23,6 @@ // BytesConsumer has four states: waiting, readable, closed and errored. Once // the state becomes closed or errored, it will never change. |readable| means // that the BytesConsumer is ready to read non-empty bytes synchronously. -// A BytesConsumer should be retained by TraceWrapperMember, not Member, as -// a subclass has a reference to a v8::Value. class PLATFORM_EXPORT BytesConsumer : public GarbageCollectedFinalized<BytesConsumer> { public:
diff --git a/third_party/blink/renderer/platform/loader/fetch/fetch_context.h b/third_party/blink/renderer/platform/loader/fetch/fetch_context.h index 686955a2..ad006a3 100644 --- a/third_party/blink/renderer/platform/loader/fetch/fetch_context.h +++ b/third_party/blink/renderer/platform/loader/fetch/fetch_context.h
@@ -38,7 +38,6 @@ #include "base/single_thread_task_runner.h" #include "services/network/public/mojom/request_context_frame_type.mojom-shared.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-shared.h" -#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-blink.h" #include "third_party/blink/public/mojom/web_feature/web_feature.mojom-blink.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/resource_request_blocked_reason.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h index 288e1d0..f0e46972 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h
@@ -33,7 +33,7 @@ #include "base/single_thread_task_runner.h" #include "services/network/public/cpp/cors/preflight_timing_info.h" #include "third_party/blink/public/mojom/blob/blob_registry.mojom-blink.h" -#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-blink.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom-blink.h" #include "third_party/blink/renderer/platform/heap/persistent.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_parameters.h" #include "third_party/blink/renderer/platform/loader/fetch/preload_key.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h index 99b27d9..8d3e8afc 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h
@@ -5,7 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_RESOURCE_FETCHER_PROPERTIES_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_RESOURCE_FETCHER_PROPERTIES_H_ -#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom-shared.h" +#include "third_party/blink/public/mojom/service_worker/controller_service_worker_mode.mojom-blink.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_status.h"
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc b/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc index 88cb7d9..1f2be7f 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_loader_test.cc
@@ -267,11 +267,11 @@ EXPECT_EQ(resource->GetStatus(), ResourceStatus::kCached); scoped_refptr<const SharedBuffer> buffer = resource->ResourceBuffer(); - String data; + StringBuilder data; for (const auto& span : *buffer) { - data.append(String(span.data(), span.size())); + data.Append(span.data(), span.size()); } - EXPECT_EQ(data, "hello"); + EXPECT_EQ(data.ToString(), "hello"); } TEST_F(ResourceLoaderTest, LoadDataURL_AsyncAndNonStream) { @@ -294,11 +294,11 @@ // The resource has a parsed body. EXPECT_EQ(resource->GetStatus(), ResourceStatus::kCached); scoped_refptr<const SharedBuffer> buffer = resource->ResourceBuffer(); - String data; + StringBuilder data; for (const auto& span : *buffer) { - data.append(String(span.data(), span.size())); + data.Append(span.data(), span.size()); } - EXPECT_EQ(data, "Hello World!"); + EXPECT_EQ(data.ToString(), "Hello World!"); } // Helper class which stores a BytesConsumer passed by RawResource and reads the @@ -409,11 +409,11 @@ // The resource has a parsed body. EXPECT_EQ(resource->GetStatus(), ResourceStatus::kCached); scoped_refptr<const SharedBuffer> buffer = resource->ResourceBuffer(); - String data; + StringBuilder data; for (const auto& span : *buffer) { - data.append(String(span.data(), span.size())); + data.Append(span.data(), span.size()); } - EXPECT_EQ(data, "Hello World!"); + EXPECT_EQ(data.ToString(), "Hello World!"); } TEST_F(ResourceLoaderTest, LoadDataURL_SyncEmptyData) { @@ -476,11 +476,11 @@ task_runner->RunUntilIdle(); EXPECT_EQ(resource->GetStatus(), ResourceStatus::kCached); scoped_refptr<const SharedBuffer> buffer = resource->ResourceBuffer(); - String data; + StringBuilder data; for (const auto& span : *buffer) { - data.append(String(span.data(), span.size())); + data.Append(span.data(), span.size()); } - EXPECT_EQ(data, "Hello World!"); + EXPECT_EQ(data.ToString(), "Hello World!"); } TEST_F(ResourceLoaderTest, LoadDataURL_DefersAsyncAndStream) {
diff --git a/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc b/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc index fb07c02..b288ac0 100644 --- a/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/response_body_loader_test.cc
@@ -13,6 +13,7 @@ #include "third_party/blink/renderer/platform/loader/testing/bytes_consumer_test_reader.h" #include "third_party/blink/renderer/platform/loader/testing/replaying_bytes_consumer.h" #include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" namespace blink { @@ -38,7 +39,7 @@ TestClient(Option option) : option_(option) {} ~TestClient() override {} - String GetData() const { return data_; } + String GetData() { return data_.ToString(); } bool LoadingIsFinished() const { return finished_; } bool LoadingIsFailed() const { return failed_; } bool LoadingIsCancelled() const { return cancelled_; } @@ -46,7 +47,7 @@ void DidReceiveData(base::span<const char> data) override { DCHECK(!finished_); DCHECK(!failed_); - data_.append(String(data.data(), data.size())); + data_.Append(data.data(), data.size()); switch (option_) { case Option::kNone: break; @@ -80,7 +81,7 @@ private: const Option option_; Member<ResponseBodyLoader> loader_; - String data_; + StringBuilder data_; bool finished_ = false; bool failed_ = false; bool cancelled_ = false; @@ -156,7 +157,7 @@ EXPECT_FALSE(client->LoadingIsFinished()); EXPECT_FALSE(client->LoadingIsFailed()); - EXPECT_EQ(String(), client->GetData()); + EXPECT_TRUE(client->GetData().IsEmpty()); body_loader->Start(); @@ -185,7 +186,7 @@ EXPECT_FALSE(client->LoadingIsFinished()); EXPECT_FALSE(client->LoadingIsFailed()); - EXPECT_EQ(String(), client->GetData()); + EXPECT_TRUE(client->GetData().IsEmpty()); body_loader->Start(); @@ -213,7 +214,7 @@ EXPECT_FALSE(client->LoadingIsFinished()); EXPECT_FALSE(client->LoadingIsFailed()); - EXPECT_EQ(String(), client->GetData()); + EXPECT_TRUE(client->GetData().IsEmpty()); body_loader->Start(); @@ -244,7 +245,7 @@ EXPECT_FALSE(client->LoadingIsFinished()); EXPECT_FALSE(client->LoadingIsFailed()); - EXPECT_EQ(String(), client->GetData()); + EXPECT_TRUE(client->GetData().IsEmpty()); EXPECT_FALSE(body_loader->IsAborted()); body_loader->Start(); @@ -276,7 +277,7 @@ EXPECT_FALSE(client->LoadingIsFinished()); EXPECT_FALSE(client->LoadingIsFailed()); - EXPECT_EQ(String(), client->GetData()); + EXPECT_TRUE(client->GetData().IsEmpty()); EXPECT_FALSE(body_loader->IsSuspended()); body_loader->Start(); @@ -340,7 +341,7 @@ EXPECT_FALSE(client->LoadingIsFinished()); EXPECT_FALSE(client->LoadingIsFailed()); - EXPECT_EQ(String(), client->GetData()); + EXPECT_TRUE(client->GetData().IsEmpty()); body_loader->Start(); @@ -381,7 +382,7 @@ EXPECT_FALSE(client->LoadingIsFinished()); EXPECT_FALSE(client->LoadingIsFailed()); - EXPECT_EQ(String(), client->GetData()); + EXPECT_TRUE(client->GetData().IsEmpty()); body_loader->Start();
diff --git a/third_party/blink/renderer/platform/mac/color_mac.h b/third_party/blink/renderer/platform/mac/color_mac.h index 682ffbf..0723b924d 100644 --- a/third_party/blink/renderer/platform/mac/color_mac.h +++ b/third_party/blink/renderer/platform/mac/color_mac.h
@@ -31,7 +31,7 @@ #include "third_party/blink/renderer/platform/graphics/color.h" -OBJC_CLASS NSColor; +@class NSColor; namespace blink {
diff --git a/third_party/blink/renderer/platform/mac/local_current_graphics_context.h b/third_party/blink/renderer/platform/mac/local_current_graphics_context.h index 03d8e8e..cd0708d 100644 --- a/third_party/blink/renderer/platform/mac/local_current_graphics_context.h +++ b/third_party/blink/renderer/platform/mac/local_current_graphics_context.h
@@ -25,7 +25,7 @@ #include "third_party/blink/renderer/platform/mac/graphics_context_canvas.h" #include "third_party/blink/renderer/platform/platform_export.h" -OBJC_CLASS NSGraphicsContext; +@class NSGraphicsContext; namespace cc { class PaintCanvas; @@ -52,6 +52,10 @@ IntRect inflated_dirty_rect_; GraphicsContextCanvas graphics_context_canvas_; + // Inflate an IntRect to account for any bleeding that would happen due to + // anti-aliasing. + IntRect InflateRectForAA(const IntRect&); + DISALLOW_COPY_AND_ASSIGN(LocalCurrentGraphicsContext); }; }
diff --git a/third_party/blink/renderer/platform/mac/local_current_graphics_context.mm b/third_party/blink/renderer/platform/mac/local_current_graphics_context.mm index 350c68d8..a1e83f1 100644 --- a/third_party/blink/renderer/platform/mac/local_current_graphics_context.mm +++ b/third_party/blink/renderer/platform/mac/local_current_graphics_context.mm
@@ -23,7 +23,6 @@ #include "skia/ext/platform_canvas.h" #include "third_party/blink/renderer/platform/graphics/graphics_context.h" #include "third_party/blink/renderer/platform/graphics/paint/paint_canvas.h" -#include "third_party/blink/renderer/platform/mac/theme_mac.h" #include "third_party/skia/include/core/SkRegion.h" namespace blink { @@ -59,7 +58,7 @@ float device_scale_factor, const IntRect& dirty_rect) : did_set_graphics_context_(false), - inflated_dirty_rect_(ThemeMac::InflateRectForAA(dirty_rect)), + inflated_dirty_rect_(InflateRectForAA(dirty_rect)), graphics_context_canvas_( canvas, LocalToClampedDeviceRect(canvas, inflated_dirty_rect_), @@ -97,4 +96,10 @@ return cg_context; } + +IntRect LocalCurrentGraphicsContext::InflateRectForAA(const IntRect& rect) { + const int kMargin = 2; + return IntRect(rect.X() - kMargin, rect.Y() - kMargin, + rect.Width() + 2 * kMargin, rect.Height() + 2 * kMargin); +} }
diff --git a/third_party/blink/renderer/platform/mac/theme_mac.h b/third_party/blink/renderer/platform/mac/theme_mac.h deleted file mode 100644 index 4548eee..0000000 --- a/third_party/blink/renderer/platform/mac/theme_mac.h +++ /dev/null
@@ -1,126 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_MAC_THEME_MAC_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_MAC_THEME_MAC_H_ - -#import <AppKit/AppKit.h> - -#include "third_party/blink/renderer/platform/theme.h" - -namespace blink { - -class ThemeMac : public Theme { - public: - ThemeMac() {} - ~ThemeMac() override {} - - int BaselinePositionAdjustment(ControlPart) const override; - - FontDescription ControlFont(ControlPart, - const FontDescription&, - float zoom_factor) const override; - - LengthSize GetControlSize(ControlPart, - const FontDescription&, - const LengthSize&, - float zoom_factor) const override; - LengthSize MinimumControlSize(ControlPart, - const FontDescription&, - float zoom_factor) const override; - - LengthBox ControlPadding(ControlPart, - const FontDescription&, - const Length& zoomed_box_top, - const Length& zoomed_box_right, - const Length& zoomed_box_bottom, - const Length& zoomed_box_left, - float zoom_factor) const override; - LengthBox ControlBorder(ControlPart, - const FontDescription&, - const LengthBox& zoomed_box, - float zoom_factor) const override; - - bool ControlRequiresPreWhiteSpace(ControlPart part) const override { - return part == kPushButtonPart; - } - - void AddVisualOverflow(ControlPart, - ControlStates, - float zoom_factor, - IntRect& border_box) const override; - - // Inflate an IntRect to accout for specific padding around margins. - enum { kTopMargin = 0, kRightMargin = 1, kBottomMargin = 2, kLeftMargin = 3 }; - static PLATFORM_EXPORT IntRect InflateRect(const IntRect&, - const IntSize&, - const int* margins, - float zoom_level = 1.0f); - - // Inflate an IntRect to account for any bleeding that would happen due to - // anti-aliasing. - static PLATFORM_EXPORT IntRect InflateRectForAA(const IntRect&); - - // Inflate an IntRect to account for its focus ring. - // TODO: Consider using computing the focus ring's bounds with - // -[NSCell focusRingMaskBoundsForFrame:inView:]). - static PLATFORM_EXPORT IntRect InflateRectForFocusRing(const IntRect&); - - static PLATFORM_EXPORT LengthSize CheckboxSize(const FontDescription&, - const LengthSize& zoomed_size, - float zoom_factor); - static PLATFORM_EXPORT NSButtonCell* Checkbox(ControlStates, - const IntRect& zoomed_rect, - float zoom_factor); - static PLATFORM_EXPORT const IntSize* CheckboxSizes(); - static PLATFORM_EXPORT const int* CheckboxMargins(NSControlSize); - static PLATFORM_EXPORT NSView* EnsuredView(const IntSize&); - - static PLATFORM_EXPORT const IntSize* RadioSizes(); - static PLATFORM_EXPORT const int* RadioMargins(NSControlSize); - static PLATFORM_EXPORT LengthSize RadioSize(const FontDescription&, - const LengthSize& zoomed_size, - float zoom_factor); - static PLATFORM_EXPORT NSButtonCell* Radio(ControlStates, - const IntRect& zoomed_rect, - float zoom_factor); - - static PLATFORM_EXPORT const IntSize* ButtonSizes(); - static PLATFORM_EXPORT const int* ButtonMargins(NSControlSize); - static PLATFORM_EXPORT NSButtonCell* Button(ControlPart, - ControlStates, - const IntRect& zoomed_rect, - float zoom_factor); - - static PLATFORM_EXPORT NSControlSize - ControlSizeFromPixelSize(const IntSize* sizes, - const IntSize& min_zoomed_size, - float zoom_factor); - static PLATFORM_EXPORT const IntSize* StepperSizes(); -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_MAC_THEME_MAC_H_
diff --git a/third_party/blink/renderer/platform/mac/theme_mac.mm b/third_party/blink/renderer/platform/mac/theme_mac.mm deleted file mode 100644 index bb48e46..0000000 --- a/third_party/blink/renderer/platform/mac/theme_mac.mm +++ /dev/null
@@ -1,556 +0,0 @@ -/* - * Copyright (C) 2008, 2010, 2011, 2012 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#import "third_party/blink/renderer/platform/mac/theme_mac.h" - -#import <Carbon/Carbon.h> -#import "third_party/blink/renderer/platform/graphics/graphics_context_state_saver.h" -#import "third_party/blink/renderer/platform/mac/block_exceptions.h" -#import "third_party/blink/renderer/platform/mac/local_current_graphics_context.h" -#import "third_party/blink/renderer/platform/mac/version_util_mac.h" -#import "third_party/blink/renderer/platform/mac/web_core_ns_cell_extras.h" -#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" - -// This is a view whose sole purpose is to tell AppKit that it's flipped. -@interface BlinkFlippedControl : NSControl -@end - -@implementation BlinkFlippedControl - -- (BOOL)isFlipped { - return YES; -} - -- (NSText*)currentEditor { - return nil; -} - -- (BOOL)_automaticFocusRingDisabled { - return YES; -} - -@end - -namespace blink { - -Theme* PlatformTheme() { - DEFINE_STATIC_LOCAL(ThemeMac, theme_mac, ()); - return &theme_mac; -} - -// Helper functions used by a bunch of different control parts. - -static NSControlSize ControlSizeForFont( - const FontDescription& font_description) { - int font_size = font_description.ComputedPixelSize(); - if (font_size >= 16) - return NSRegularControlSize; - if (font_size >= 11) - return NSSmallControlSize; - return NSMiniControlSize; -} - -static LengthSize SizeFromNSControlSize(NSControlSize ns_control_size, - const LengthSize& zoomed_size, - float zoom_factor, - const IntSize* sizes) { - IntSize control_size = sizes[ns_control_size]; - if (zoom_factor != 1.0f) - control_size = IntSize(control_size.Width() * zoom_factor, - control_size.Height() * zoom_factor); - LengthSize result = zoomed_size; - if (zoomed_size.Width().IsIntrinsicOrAuto() && control_size.Width() > 0) - result.SetWidth(Length::Fixed(control_size.Width())); - if (zoomed_size.Height().IsIntrinsicOrAuto() && control_size.Height() > 0) - result.SetHeight(Length::Fixed(control_size.Height())); - return result; -} - -static LengthSize SizeFromFont(const FontDescription& font_description, - const LengthSize& zoomed_size, - float zoom_factor, - const IntSize* sizes) { - return SizeFromNSControlSize(ControlSizeForFont(font_description), - zoomed_size, zoom_factor, sizes); -} - -NSControlSize ThemeMac::ControlSizeFromPixelSize(const IntSize* sizes, - const IntSize& min_zoomed_size, - float zoom_factor) { - if (min_zoomed_size.Width() >= - static_cast<int>(sizes[NSRegularControlSize].Width() * zoom_factor) && - min_zoomed_size.Height() >= - static_cast<int>(sizes[NSRegularControlSize].Height() * zoom_factor)) - return NSRegularControlSize; - if (min_zoomed_size.Width() >= - static_cast<int>(sizes[NSSmallControlSize].Width() * zoom_factor) && - min_zoomed_size.Height() >= - static_cast<int>(sizes[NSSmallControlSize].Height() * zoom_factor)) - return NSSmallControlSize; - return NSMiniControlSize; -} - -static void SetControlSize(NSCell* cell, - const IntSize* sizes, - const IntSize& min_zoomed_size, - float zoom_factor) { - ControlSize size = - ThemeMac::ControlSizeFromPixelSize(sizes, min_zoomed_size, zoom_factor); - // Only update if we have to, since AppKit does work even if the size is the - // same. - if (size != [cell controlSize]) - [cell setControlSize:(NSControlSize)size]; -} - -static void UpdateStates(NSCell* cell, ControlStates states) { - // Hover state is not supported by Aqua. - - // Pressed state - bool old_pressed = [cell isHighlighted]; - bool pressed = states & kPressedControlState; - if (pressed != old_pressed) - [cell setHighlighted:pressed]; - - // Enabled state - bool old_enabled = [cell isEnabled]; - bool enabled = states & kEnabledControlState; - if (enabled != old_enabled) - [cell setEnabled:enabled]; - - // Checked and Indeterminate - bool old_indeterminate = [cell state] == NSMixedState; - bool indeterminate = (states & kIndeterminateControlState); - bool checked = states & kCheckedControlState; - bool old_checked = [cell state] == NSOnState; - if (old_indeterminate != indeterminate || checked != old_checked) - [cell setState:indeterminate ? NSMixedState - : (checked ? NSOnState : NSOffState)]; - - // Window inactive state does not need to be checked explicitly, since we - // paint parented to a view in a window whose key state can be detected. -} - -// Return a fake NSView whose sole purpose is to tell AppKit that it's flipped. -NSView* ThemeMac::EnsuredView(const IntSize& size) { - // Use a fake flipped view. - static NSView* flipped_view = [[BlinkFlippedControl alloc] init]; - [flipped_view setFrameSize:NSSizeFromCGSize(CGSize(size))]; - - return flipped_view; -} - -// static -IntRect ThemeMac::InflateRect(const IntRect& zoomed_rect, - const IntSize& zoomed_size, - const int* margins, - float zoom_factor) { - // Only do the inflation if the available width/height are too small. - // Otherwise try to fit the glow/check space into the available box's - // width/height. - int width_delta = zoomed_rect.Width() - - (zoomed_size.Width() + margins[kLeftMargin] * zoom_factor + - margins[kRightMargin] * zoom_factor); - int height_delta = zoomed_rect.Height() - - (zoomed_size.Height() + margins[kTopMargin] * zoom_factor + - margins[kBottomMargin] * zoom_factor); - IntRect result(zoomed_rect); - if (width_delta < 0) { - result.SetX(result.X() - margins[kLeftMargin] * zoom_factor); - result.SetWidth(result.Width() - width_delta); - } - if (height_delta < 0) { - result.SetY(result.Y() - margins[kTopMargin] * zoom_factor); - result.SetHeight(result.Height() - height_delta); - } - return result; -} - -// static -IntRect ThemeMac::InflateRectForAA(const IntRect& rect) { - const int kMargin = 2; - return IntRect(rect.X() - kMargin, rect.Y() - kMargin, - rect.Width() + 2 * kMargin, rect.Height() + 2 * kMargin); -} - -// static -IntRect ThemeMac::InflateRectForFocusRing(const IntRect& rect) { - // Just put a margin of 16 units around the rect. The UI elements that use - // this don't appropriately scale their focus rings appropriately (e.g, paint - // pickers), or switch to non-native widgets when scaled (e.g, check boxes - // and radio buttons). - const int kMargin = 16; - IntRect result; - result.SetX(rect.X() - kMargin); - result.SetY(rect.Y() - kMargin); - result.SetWidth(rect.Width() + 2 * kMargin); - result.SetHeight(rect.Height() + 2 * kMargin); - return result; -} - -// Checkboxes - -const IntSize* ThemeMac::CheckboxSizes() { - static const IntSize kSizes[3] = {IntSize(14, 14), IntSize(12, 12), - IntSize(10, 10)}; - return kSizes; -} - -const int* ThemeMac::CheckboxMargins(NSControlSize control_size) { - static const int kMargins[3][4] = { - {3, 4, 4, 2}, {4, 3, 3, 3}, {4, 3, 3, 3}, - }; - return kMargins[control_size]; -} - -LengthSize ThemeMac::CheckboxSize(const FontDescription& font_description, - const LengthSize& zoomed_size, - float zoom_factor) { - // If the width and height are both specified, then we have nothing to do. - if (!zoomed_size.Width().IsIntrinsicOrAuto() && - !zoomed_size.Height().IsIntrinsicOrAuto()) - return zoomed_size; - - // Use the font size to determine the intrinsic width of the control. - return SizeFromFont(font_description, zoomed_size, zoom_factor, - CheckboxSizes()); -} - -NSButtonCell* ThemeMac::Checkbox(ControlStates states, - const IntRect& zoomed_rect, - float zoom_factor) { - static NSButtonCell* checkbox_cell; - if (!checkbox_cell) { - checkbox_cell = [[NSButtonCell alloc] init]; - [checkbox_cell setButtonType:NSSwitchButton]; - [checkbox_cell setTitle:nil]; - [checkbox_cell setAllowsMixedState:YES]; - [checkbox_cell setFocusRingType:NSFocusRingTypeExterior]; - } - - // Set the control size based off the rectangle we're painting into. - SetControlSize(checkbox_cell, CheckboxSizes(), zoomed_rect.Size(), - zoom_factor); - - // Update the various states we respond to. - UpdateStates(checkbox_cell, states); - - return checkbox_cell; -} - -const IntSize* ThemeMac::RadioSizes() { - static const IntSize kSizes[3] = {IntSize(14, 15), IntSize(12, 13), - IntSize(10, 10)}; - return kSizes; -} - -const int* ThemeMac::RadioMargins(NSControlSize control_size) { - static const int kMargins[3][4] = { - {2, 2, 4, 2}, {3, 2, 3, 2}, {1, 0, 2, 0}, - }; - return kMargins[control_size]; -} - -LengthSize ThemeMac::RadioSize(const FontDescription& font_description, - const LengthSize& zoomed_size, - float zoom_factor) { - // If the width and height are both specified, then we have nothing to do. - if (!zoomed_size.Width().IsIntrinsicOrAuto() && - !zoomed_size.Height().IsIntrinsicOrAuto()) - return zoomed_size; - - // Use the font size to determine the intrinsic width of the control. - return SizeFromFont(font_description, zoomed_size, zoom_factor, RadioSizes()); -} - -NSButtonCell* ThemeMac::Radio(ControlStates states, - const IntRect& zoomed_rect, - float zoom_factor) { - static NSButtonCell* radio_cell; - if (!radio_cell) { - radio_cell = [[NSButtonCell alloc] init]; - [radio_cell setButtonType:NSRadioButton]; - [radio_cell setTitle:nil]; - [radio_cell setFocusRingType:NSFocusRingTypeExterior]; - } - - // Set the control size based off the rectangle we're painting into. - SetControlSize(radio_cell, RadioSizes(), zoomed_rect.Size(), zoom_factor); - - // Update the various states we respond to. - // Cocoa draws NSMixedState NSRadioButton as NSOnState so we don't want that. - states &= ~kIndeterminateControlState; - UpdateStates(radio_cell, states); - - return radio_cell; -} - -// Buttons really only constrain height. They respect width. -const IntSize* ThemeMac::ButtonSizes() { - static const IntSize kSizes[3] = {IntSize(0, 21), IntSize(0, 18), - IntSize(0, 15)}; - return kSizes; -} - -const int* ThemeMac::ButtonMargins(NSControlSize control_size) { - static const int kMargins[3][4] = { - {4, 6, 7, 6}, {4, 5, 6, 5}, {0, 1, 1, 1}, - }; - return kMargins[control_size]; -} - -static void SetUpButtonCell(NSButtonCell* cell, - ControlPart part, - ControlStates states, - const IntRect& zoomed_rect, - float zoom_factor) { - // Set the control size based off the rectangle we're painting into. - const IntSize* sizes = ThemeMac::ButtonSizes(); - if (part == kSquareButtonPart || - zoomed_rect.Height() > - ThemeMac::ButtonSizes()[NSRegularControlSize].Height() * - zoom_factor) { - // Use the square button - if ([cell bezelStyle] != NSShadowlessSquareBezelStyle) - [cell setBezelStyle:NSShadowlessSquareBezelStyle]; - } else if ([cell bezelStyle] != NSRoundedBezelStyle) - [cell setBezelStyle:NSRoundedBezelStyle]; - - SetControlSize(cell, sizes, zoomed_rect.Size(), zoom_factor); - - // Update the various states we respond to. - UpdateStates(cell, states); -} - -NSButtonCell* ThemeMac::Button(ControlPart part, - ControlStates states, - const IntRect& zoomed_rect, - float zoom_factor) { - static NSButtonCell* cell = nil; - if (!cell) { - cell = [[NSButtonCell alloc] init]; - [cell setTitle:nil]; - [cell setButtonType:NSMomentaryPushInButton]; - } - SetUpButtonCell(cell, part, states, zoomed_rect, zoom_factor); - return cell; -} - -const IntSize* ThemeMac::StepperSizes() { - static const IntSize kSizes[3] = {IntSize(19, 27), IntSize(15, 22), - IntSize(13, 15)}; - return kSizes; -} - -// We don't use controlSizeForFont() for steppers because the stepper height -// should be equal to or less than the corresponding text field height, -static NSControlSize StepperControlSizeForFont( - const FontDescription& font_description) { - int font_size = font_description.ComputedPixelSize(); - if (font_size >= 27) - return NSRegularControlSize; - if (font_size >= 22) - return NSSmallControlSize; - return NSMiniControlSize; -} - -// Theme overrides - -int ThemeMac::BaselinePositionAdjustment(ControlPart part) const { - if (part == kCheckboxPart || part == kRadioPart) - return -2; - return Theme::BaselinePositionAdjustment(part); -} - -FontDescription ThemeMac::ControlFont(ControlPart part, - const FontDescription& font_description, - float zoom_factor) const { - switch (part) { - case kPushButtonPart: { - FontDescription result; - result.SetIsAbsoluteSize(true); - result.SetGenericFamily(FontDescription::kSerifFamily); - - NSFont* ns_font = [NSFont - systemFontOfSize:[NSFont systemFontSizeForControlSize: - ControlSizeForFont(font_description)]]; - result.FirstFamily().SetFamily(font_family_names::kSystemUi); - result.SetComputedSize([ns_font pointSize] * zoom_factor); - result.SetSpecifiedSize([ns_font pointSize] * zoom_factor); - return result; - } - default: - return Theme::ControlFont(part, font_description, zoom_factor); - } -} - -LengthSize ThemeMac::GetControlSize(ControlPart part, - const FontDescription& font_description, - const LengthSize& zoomed_size, - float zoom_factor) const { - switch (part) { - case kCheckboxPart: - return CheckboxSize(font_description, zoomed_size, zoom_factor); - case kRadioPart: - return RadioSize(font_description, zoomed_size, zoom_factor); - case kPushButtonPart: - // Height is reset to auto so that specified heights can be ignored. - return SizeFromFont(font_description, - LengthSize(zoomed_size.Width(), Length()), - zoom_factor, ButtonSizes()); - case kInnerSpinButtonPart: - if (!zoomed_size.Width().IsIntrinsicOrAuto() && - !zoomed_size.Height().IsIntrinsicOrAuto()) - return zoomed_size; - return SizeFromNSControlSize(StepperControlSizeForFont(font_description), - zoomed_size, zoom_factor, StepperSizes()); - default: - return zoomed_size; - } -} - -LengthSize ThemeMac::MinimumControlSize(ControlPart part, - const FontDescription& font_description, - float zoom_factor) const { - switch (part) { - case kSquareButtonPart: - case kButtonPart: - return LengthSize(Length::Fixed(0), - Length::Fixed(static_cast<int>(15 * zoom_factor))); - case kInnerSpinButtonPart: { - IntSize base = StepperSizes()[NSMiniControlSize]; - return LengthSize( - Length::Fixed(static_cast<int>(base.Width() * zoom_factor)), - Length::Fixed(static_cast<int>(base.Height() * zoom_factor))); - } - default: - return Theme::MinimumControlSize(part, font_description, zoom_factor); - } -} - -LengthBox ThemeMac::ControlBorder(ControlPart part, - const FontDescription& font_description, - const LengthBox& zoomed_box, - float zoom_factor) const { - switch (part) { - case kSquareButtonPart: - return LengthBox(0, zoomed_box.Right().Value(), 0, - zoomed_box.Left().Value()); - default: - return Theme::ControlBorder(part, font_description, zoomed_box, - zoom_factor); - } -} - -LengthBox ThemeMac::ControlPadding(ControlPart part, - const FontDescription& font_description, - const Length& zoomed_box_top, - const Length& zoomed_box_right, - const Length& zoomed_box_bottom, - const Length& zoomed_box_left, - float zoom_factor) const { - switch (part) { - case kPushButtonPart: { - // Just use 8px. AppKit wants to use 11px for mini buttons, but that - // padding is just too large for real-world Web sites (creating a huge - // necessary minimum width for buttons whose space is by definition - // constrained, since we select mini only for small cramped environments. - // This also guarantees the HTML <button> will match our rendering by - // default, since we're using a consistent padding. - const int padding = 8 * zoom_factor; - return LengthBox(2, padding, 3, padding); - } - default: - return Theme::ControlPadding(part, font_description, zoomed_box_top, - zoomed_box_right, zoomed_box_bottom, - zoomed_box_left, zoom_factor); - } -} - -void ThemeMac::AddVisualOverflow(ControlPart part, - ControlStates states, - float zoom_factor, - IntRect& zoomed_rect) const { - BEGIN_BLOCK_OBJC_EXCEPTIONS - switch (part) { - case kCheckboxPart: { - // We inflate the rect as needed to account for padding included in the - // cell to accommodate the checkbox shadow" and the check. We don't - // consider this part of the bounds of the control in WebKit. - NSCell* cell = Checkbox(states, zoomed_rect, zoom_factor); - NSControlSize control_size = [cell controlSize]; - IntSize zoomed_size = CheckboxSizes()[control_size]; - zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); - zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); - zoomed_rect = InflateRect(zoomed_rect, zoomed_size, - CheckboxMargins(control_size), zoom_factor); - break; - } - case kRadioPart: { - // We inflate the rect as needed to account for padding included in the - // cell to accommodate the radio button shadow". We don't consider this - // part of the bounds of the control in WebKit. - NSCell* cell = Radio(states, zoomed_rect, zoom_factor); - NSControlSize control_size = [cell controlSize]; - IntSize zoomed_size = RadioSizes()[control_size]; - zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); - zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); - zoomed_rect = InflateRect(zoomed_rect, zoomed_size, - RadioMargins(control_size), zoom_factor); - break; - } - case kPushButtonPart: - case kButtonPart: { - NSButtonCell* cell = Button(part, states, zoomed_rect, zoom_factor); - NSControlSize control_size = [cell controlSize]; - - // We inflate the rect as needed to account for the Aqua button's shadow. - if ([cell bezelStyle] == NSRoundedBezelStyle) { - IntSize zoomed_size = ButtonSizes()[control_size]; - zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); - // Buttons don't ever constrain width, so the zoomed width can just be - // honored. - zoomed_size.SetWidth(zoomed_rect.Width()); - zoomed_rect = InflateRect(zoomed_rect, zoomed_size, - ButtonMargins(control_size), zoom_factor); - } - break; - } - case kInnerSpinButtonPart: { - static const int kStepperMargin[4] = {0, 0, 0, 0}; - ControlSize control_size = ControlSizeFromPixelSize( - StepperSizes(), zoomed_rect.Size(), zoom_factor); - IntSize zoomed_size = StepperSizes()[control_size]; - zoomed_size.SetHeight(zoomed_size.Height() * zoom_factor); - zoomed_size.SetWidth(zoomed_size.Width() * zoom_factor); - zoomed_rect = - InflateRect(zoomed_rect, zoomed_size, kStepperMargin, zoom_factor); - break; - } - default: - break; - } - END_BLOCK_OBJC_EXCEPTIONS -} -}
diff --git a/third_party/blink/renderer/platform/supplementable.h b/third_party/blink/renderer/platform/supplementable.h index eab37b40..ff971f12 100644 --- a/third_party/blink/renderer/platform/supplementable.h +++ b/third_party/blink/renderer/platform/supplementable.h
@@ -27,7 +27,6 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_SUPPLEMENTABLE_H_ #include "base/macros.h" -#include "third_party/blink/renderer/platform/bindings/trace_wrapper_member.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" @@ -205,9 +204,8 @@ void Trace(blink::Visitor* visitor) override { visitor->Trace(supplements_); } protected: - using SupplementMap = HeapHashMap<const char*, - TraceWrapperMember<Supplement<T>>, - PtrHash<const char>>; + using SupplementMap = + HeapHashMap<const char*, Member<Supplement<T>>, PtrHash<const char>>; SupplementMap supplements_; Supplementable()
diff --git a/third_party/blink/renderer/platform/testing/viewport_layers_setup.cc b/third_party/blink/renderer/platform/testing/viewport_layers_setup.cc index f21a436f..e646556 100644 --- a/third_party/blink/renderer/platform/testing/viewport_layers_setup.cc +++ b/third_party/blink/renderer/platform/testing/viewport_layers_setup.cc
@@ -22,7 +22,6 @@ page_scale_layer_ = std::make_unique<FakeGraphicsLayer>(client_); graphics_layer_ = std::make_unique<FakeGraphicsLayer>(client_); graphics_layer_->SetDrawsContent(true); - graphics_layer_->SetHitTestable(true); clip_layer_->AddChild(scroll_elasticity_layer_.get()); scroll_elasticity_layer_->AddChild(page_scale_layer_.get()); page_scale_layer_->AddChild(graphics_layer_.get());
diff --git a/third_party/blink/renderer/platform/text/locale_mac.h b/third_party/blink/renderer/platform/text/locale_mac.h index f2ec6fe5..8392680 100644 --- a/third_party/blink/renderer/platform/text/locale_mac.h +++ b/third_party/blink/renderer/platform/text/locale_mac.h
@@ -32,15 +32,16 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_LOCALE_MAC_H_ #include <memory> + #include "base/mac/scoped_nsobject.h" #include "third_party/blink/renderer/platform/text/platform_locale.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/vector.h" -OBJC_CLASS NSCalendar; -OBJC_CLASS NSDateFormatter; -OBJC_CLASS NSLocale; +@class NSCalendar; +@class NSDateFormatter; +@class NSLocale; namespace blink {
diff --git a/third_party/blink/renderer/platform/text/text_boundaries_test.cc b/third_party/blink/renderer/platform/text/text_boundaries_test.cc index 3241d14..5a97a71 100644 --- a/third_party/blink/renderer/platform/text/text_boundaries_test.cc +++ b/third_party/blink/renderer/platform/text/text_boundaries_test.cc
@@ -21,10 +21,9 @@ input16.Ensure16Bit(); const size_t position = input16.find('|'); DCHECK(position != kNotFound) << input8 << " should have position marker(|)."; - String text16 = input16.Left(position); - text16.append(input16.Substring(position + 1)); - text16.Ensure16Bit(); - return {text16, position}; + String output = input16.Left(position) + input16.Substring(position + 1); + output.Ensure16Bit(); + return {output, position}; } std::string MakeResultText(const String& text, int start, int end) {
diff --git a/third_party/blink/renderer/platform/text/unicode_utilities_test.cc b/third_party/blink/renderer/platform/text/unicode_utilities_test.cc index 17a421e0..08ba1c8 100644 --- a/third_party/blink/renderer/platform/text/unicode_utilities_test.cc +++ b/third_party/blink/renderer/platform/text/unicode_utilities_test.cc
@@ -35,6 +35,7 @@ #include "base/stl_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/renderer/platform/wtf/text/character_names.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/vector.h" @@ -112,23 +113,25 @@ TEST(UnicodeUtilitiesTest, ContainsKanaLetters) { // Non Kana symbols - String non_kana_string; + StringBuilder non_kana_string; for (UChar character = 0; character < 0x3041; ++character) - non_kana_string.append(character); - EXPECT_FALSE(ContainsKanaLetters(non_kana_string)); + non_kana_string.Append(character); + EXPECT_FALSE(ContainsKanaLetters(non_kana_string.ToString())); // Hiragana letters. for (UChar character = 0x3041; character <= 0x3096; ++character) { - String str(non_kana_string); - str.append(character); - EXPECT_TRUE(ContainsKanaLetters(str)); + StringBuilder str; + str.Append(non_kana_string); + str.Append(character); + EXPECT_TRUE(ContainsKanaLetters(str.ToString())); } // Katakana letters. for (UChar character = 0x30A1; character <= 0x30FA; ++character) { - String str(non_kana_string); - str.append(character); - EXPECT_TRUE(ContainsKanaLetters(str)); + StringBuilder str; + str.Append(non_kana_string); + str.Append(character); + EXPECT_TRUE(ContainsKanaLetters(str.ToString())); } }
diff --git a/third_party/blink/renderer/platform/theme.cc b/third_party/blink/renderer/platform/theme.cc deleted file mode 100644 index af8d1a3..0000000 --- a/third_party/blink/renderer/platform/theme.cc +++ /dev/null
@@ -1,65 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/renderer/platform/theme.h" - -namespace blink { - -LengthBox Theme::ControlBorder(ControlPart part, - const FontDescription&, - const LengthBox& zoomed_box, - float) const { - switch (part) { - case kPushButtonPart: - case kMenulistPart: - case kSearchFieldPart: - case kCheckboxPart: - case kRadioPart: - return LengthBox(0); - default: - return zoomed_box; - } -} - -LengthBox Theme::ControlPadding(ControlPart part, - const FontDescription&, - const Length& zoomed_box_top, - const Length& zoomed_box_right, - const Length& zoomed_box_bottom, - const Length& zoomed_box_left, - float) const { - switch (part) { - case kMenulistPart: - case kMenulistButtonPart: - case kCheckboxPart: - case kRadioPart: - return LengthBox(0); - default: - return LengthBox(zoomed_box_top, zoomed_box_right, zoomed_box_bottom, - zoomed_box_left); - } -} - -} // namespace blink
diff --git a/third_party/blink/renderer/platform/theme.h b/third_party/blink/renderer/platform/theme.h deleted file mode 100644 index 69e58d34..0000000 --- a/third_party/blink/renderer/platform/theme.h +++ /dev/null
@@ -1,160 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_H_ - -#include "base/macros.h" -#include "third_party/blink/renderer/platform/fonts/font_description.h" -#include "third_party/blink/renderer/platform/geometry/int_rect.h" -#include "third_party/blink/renderer/platform/geometry/length_box.h" -#include "third_party/blink/renderer/platform/geometry/length_size.h" -#include "third_party/blink/renderer/platform/graphics/color.h" -#include "third_party/blink/renderer/platform/platform_export.h" -#include "third_party/blink/renderer/platform/theme_types.h" -#include "third_party/blink/renderer/platform/wtf/allocator.h" -#include "third_party/blink/renderer/platform/wtf/forward.h" -#include "third_party/blink/renderer/platform/wtf/time.h" - -namespace blink { - -class GraphicsContext; -class ScrollableArea; - -// Unlike other platform classes, Theme does extensively use virtual functions. -// This design allows a platform to switch between multiple themes at runtime. -class PLATFORM_EXPORT Theme { - USING_FAST_MALLOC(Theme); - - public: - Theme() = default; - virtual ~Theme() = default; - - // A method to obtain the baseline position adjustment for a "leaf" control. - // This will only be used if a baseline position cannot be determined by - // examining child content. Checkboxes and radio buttons are examples of - // controls that need to do this. The adjustment is an offset that adds to - // the baseline, e.g., marginTop() + height() + |offset|. - // The offset is not zoomed. - virtual int BaselinePositionAdjustment(ControlPart) const { return 0; } - - // A method asking if the control changes its appearance when the window is - // inactive. - virtual bool ControlHasInactiveAppearance(ControlPart) const { return false; } - - // General methods for whether or not any of the controls in the theme change - // appearance when the window is inactive or when hovered over. - virtual bool ControlsCanHaveInactiveAppearance() const { return false; } - virtual bool ControlsCanHaveHoveredAppearance() const { return false; } - - // Used by LayoutTheme::isControlStyled to figure out if the native look and - // feel should be turned off. - virtual bool ControlDrawsBorder(ControlPart) const { return true; } - virtual bool ControlDrawsBackground(ControlPart) const { return true; } - virtual bool ControlDrawsFocusOutline(ControlPart) const { return true; } - - // Methods for obtaining platform-specific colors. - virtual Color SelectionColor(ControlPart, ControlState, SelectionPart) const { - return Color(); - } - virtual Color TextSearchHighlightColor() const { return Color(); } - - // CSS system colors and fonts - virtual Color SystemColor(ThemeColor) const { return Color(); } - - // How fast the caret blinks in text fields. - virtual TimeDelta CaretBlinkInterval() const { - return TimeDelta::FromMilliseconds(500); - } - - // Methods used to adjust the ComputedStyles of controls. - - // The font description result should have a zoomed font size. - virtual FontDescription ControlFont(ControlPart, - const FontDescription& font_description, - float /*zoomFactor*/) const { - return font_description; - } - - // The size here is in zoomed coordinates already. If a new size is returned, - // it also needs to be in zoomed coordinates. - virtual LengthSize GetControlSize(ControlPart, - const FontDescription&, - const LengthSize& zoomed_size, - float /*zoomFactor*/) const { - return zoomed_size; - } - - // Returns the minimum size for a control in zoomed coordinates. - virtual LengthSize MinimumControlSize(ControlPart, - const FontDescription&, - float /*zoomFactor*/) const { - return LengthSize(Length::Fixed(0), Length::Fixed(0)); - } - - // Allows the theme to modify the existing padding/border. - virtual LengthBox ControlPadding(ControlPart, - const FontDescription&, - const Length& zoomed_box_top, - const Length& zoomed_box_right, - const Length& zoomed_box_bottom, - const Length& zoomed_box_left, - float zoom_factor) const; - virtual LengthBox ControlBorder(ControlPart, - const FontDescription&, - const LengthBox& zoomed_box, - float zoom_factor) const; - - // Whether or not whitespace: pre should be forced on always. - virtual bool ControlRequiresPreWhiteSpace(ControlPart) const { return false; } - - // Method for painting a control. The rect is in zoomed coordinates. - virtual void Paint(ControlPart, - ControlStates, - GraphicsContext&, - const IntRect& /*zoomedRect*/, - float /*zoomFactor*/, - ScrollableArea*) const {} - - // Add visual overflow (e.g., the check on an OS X checkbox). The rect passed - // in is in zoomed coordinates so the inflation should take that into account - // and make sure the inflation amount is also scaled by the zoomFactor. - virtual void AddVisualOverflow(ControlPart, - ControlStates, - float zoom_factor, - IntRect& border_box) const {} - - private: - mutable Color active_selection_color_; - mutable Color inactive_selection_color_; - - DISALLOW_COPY_AND_ASSIGN(Theme); -}; - -PLATFORM_EXPORT Theme* PlatformTheme(); - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_THEME_H_
diff --git a/third_party/blink/renderer/platform/wtf/BUILD.gn b/third_party/blink/renderer/platform/wtf/BUILD.gn index 59cc04e..7b59536c 100644 --- a/third_party/blink/renderer/platform/wtf/BUILD.gn +++ b/third_party/blink/renderer/platform/wtf/BUILD.gn
@@ -48,7 +48,6 @@ "bit_vector.h", "bloom_filter.h", "casting.h", - "compiler.h", "conditional_destructor.h", "container_annotations.h", "cpu.h",
diff --git a/third_party/blink/renderer/platform/wtf/README.md b/third_party/blink/renderer/platform/wtf/README.md index 4d9e25a..179ffb5 100644 --- a/third_party/blink/renderer/platform/wtf/README.md +++ b/third_party/blink/renderer/platform/wtf/README.md
@@ -63,7 +63,6 @@ * **Compile-time switch macros** - [compiler.h] (e.g. `OBJC_CLASS`), [cpu.h] (e.g. `WTF_CPU_ARM_NEON`), * **Miscellaneous** @@ -104,7 +103,6 @@ [functional.h]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/functional.h [threading.h]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/threading.h [threading_primitives.h]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/threading_primitives.h -[compiler.h]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/compiler.h [cpu.h]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/cpu.h [build_config.h]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/build_config.h [std_lib_extras.h]: https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/wtf/std_lib_extras.h
diff --git a/third_party/blink/renderer/platform/wtf/bloom_filter.h b/third_party/blink/renderer/platform/wtf/bloom_filter.h index 7db6c577..0bf56655 100644 --- a/third_party/blink/renderer/platform/wtf/bloom_filter.h +++ b/third_party/blink/renderer/platform/wtf/bloom_filter.h
@@ -27,7 +27,6 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_BLOOM_FILTER_H_ #include "third_party/blink/renderer/platform/wtf/allocator.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" namespace WTF {
diff --git a/third_party/blink/renderer/platform/wtf/compiler.h b/third_party/blink/renderer/platform/wtf/compiler.h deleted file mode 100644 index a0f9af7..0000000 --- a/third_party/blink/renderer/platform/wtf/compiler.h +++ /dev/null
@@ -1,43 +0,0 @@ -/* - * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_COMPILER_H_ -#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_COMPILER_H_ - -#include "base/compiler_specific.h" - -/* ==== Compiler features ==== */ - -/* OBJC_CLASS */ - -#ifndef OBJC_CLASS -#ifdef __OBJC__ -#define OBJC_CLASS @class -#else -#define OBJC_CLASS class -#endif -#endif - -#endif /* WTF_Compiler_h */
diff --git a/third_party/blink/renderer/platform/wtf/forward.h b/third_party/blink/renderer/platform/wtf/forward.h index f3ba221..d039c7f 100644 --- a/third_party/blink/renderer/platform/wtf/forward.h +++ b/third_party/blink/renderer/platform/wtf/forward.h
@@ -23,7 +23,7 @@ #include <stddef.h> #include <stdint.h> -#include "third_party/blink/renderer/platform/wtf/compiler.h" + #include "third_party/blink/renderer/platform/wtf/wtf_size_t.h" template <typename T>
diff --git a/third_party/blink/renderer/platform/wtf/text/string_builder.cc b/third_party/blink/renderer/platform/wtf/text/string_builder.cc index 1fc0c64..d2482d0 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_builder.cc +++ b/third_party/blink/renderer/platform/wtf/text/string_builder.cc
@@ -115,6 +115,10 @@ has_buffer_ = false; } +void StringBuilder::Ensure16Bit() { + EnsureBuffer16(0); +} + void StringBuilder::Clear() { ClearBuffer(); string_ = String();
diff --git a/third_party/blink/renderer/platform/wtf/text/string_builder.h b/third_party/blink/renderer/platform/wtf/text/string_builder.h index ec90d25..205eca2f 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_builder.h +++ b/third_party/blink/renderer/platform/wtf/text/string_builder.h
@@ -191,6 +191,7 @@ } bool Is8Bit() const { return is_8bit_; } + void Ensure16Bit(); void Clear(); void Swap(StringBuilder&);
diff --git a/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc b/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc index ad83044..6784019 100644 --- a/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc +++ b/third_party/blink/renderer/platform/wtf/text/string_builder_test.cc
@@ -163,7 +163,7 @@ // the StringBuilder. String string1 = builder.ToString(); EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABC"), string1); - string1.append("DEF"); + string1 = string1 + "DEF"; EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABC"), builder.ToString()); EXPECT_EQ(String("0123456789abcdefghijklmnopqrstuvwxyzABCDEF"), string1);
diff --git a/third_party/blink/renderer/platform/wtf/text/wtf_string.h b/third_party/blink/renderer/platform/wtf/text/wtf_string.h index cd26346..b22917d 100644 --- a/third_party/blink/renderer/platform/wtf/text/wtf_string.h +++ b/third_party/blink/renderer/platform/wtf/text/wtf_string.h
@@ -29,7 +29,6 @@ #include <iosfwd> #include "build/build_config.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/text/integer_to_string_conversion.h" #include "third_party/blink/renderer/platform/wtf/text/string_impl.h" #include "third_party/blink/renderer/platform/wtf/text/string_view.h"
diff --git a/third_party/blink/renderer/platform/wtf/type_traits.h b/third_party/blink/renderer/platform/wtf/type_traits.h index 455b77f..0fbd7d2 100644 --- a/third_party/blink/renderer/platform/wtf/type_traits.h +++ b/third_party/blink/renderer/platform/wtf/type_traits.h
@@ -28,7 +28,6 @@ #include "base/compiler_specific.h" #include "base/template_util.h" #include "build/build_config.h" -#include "third_party/blink/renderer/platform/wtf/compiler.h" namespace WTF {
diff --git a/third_party/blink/renderer/platform/wtf/wtf.h b/third_party/blink/renderer/platform/wtf/wtf.h index a8f024d6..c06e682 100644 --- a/third_party/blink/renderer/platform/wtf/wtf.h +++ b/third_party/blink/renderer/platform/wtf/wtf.h
@@ -31,7 +31,6 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_WTF_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_WTF_H_ -#include "third_party/blink/renderer/platform/wtf/compiler.h" #include "third_party/blink/renderer/platform/wtf/threading.h" #include "third_party/blink/renderer/platform/wtf/wtf_export.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 e93f44b..4a9876e7 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
@@ -393,12 +393,6 @@ ], }, { - 'paths': ['third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.cc'], - 'allowed': [ - 'base::MemoryPressureListener', - ], - }, - { 'paths': ['third_party/blink/renderer/core/animation'], 'allowed': [ '[a-z_]+_functions::.+',
diff --git a/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py b/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py index 7e18f3b..1d5c160 100644 --- a/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py +++ b/third_party/blink/tools/blinkpy/w3c/wpt_manifest.py
@@ -7,6 +7,12 @@ The MANIFEST.json file contains metadata about files in web-platform-tests, such as what tests exist, and extra information about each test, including test type, options, URLs to use, and reference file paths if applicable. + +Naming conventions: +* A (file) path is a relative file system path from the root of WPT. It does not + have a leading slash or a query string. +* A (test) URL is the path (with an optional query string) to the test on + wptserve. It always has a leading slash. """ import json @@ -17,7 +23,8 @@ _log = logging.getLogger(__file__) - +# The default filename of manifest expected by `wpt`. +MANIFEST_NAME = 'MANIFEST.json' # The filename used for the base manifest includes the version as a # workaround for trouble landing huge changes to the base manifest when # the version changes. See https://crbug.com/876717. @@ -25,6 +32,7 @@ # TODO(robertma): Use the official wpt.manifest module. + class WPTManifest(object): """A simple abstraction of WPT MANIFEST.json. @@ -53,8 +61,6 @@ [[reference_url1, "=="], [reference_url2, "!="], ...] """ - - def __init__(self, json_content): self.raw_dict = json.loads(json_content) self.test_types = ('manual', 'reftest', 'testharness') @@ -63,9 +69,8 @@ """Finds manifest items for the given WPT path. Args: - path_in_wpt: A file path relative to the root of WPT. Note that this - is different from a WPT URL; a file path does not have a leading - slash or a query string. + path_in_wpt: A file path relative to the root of WPT without a + leading slash or a query string. Returns: A list of manifest items, or None if not found. @@ -124,24 +129,15 @@ return frozenset(self.all_url_items().keys()) def is_test_file(self, path_in_wpt): + """Checks if path_in_wpt is a test file according to the manifest.""" return self._items_for_file_path(path_in_wpt) is not None def is_test_url(self, url): - """Checks if url is a valid test in the manifest. - - The url must be the WPT test name with a leading slash (/). - """ + """Checks if url is a valid test in the manifest.""" if url[0] != '/': raise Exception('Test url missing leading /: %s' % url) return url in self.all_urls() - def file_path_to_url_paths(self, path_in_wpt): - manifest_items = self._items_for_file_path(path_in_wpt) - assert manifest_items is not None - # Remove the leading slashes when returning. - return [self._get_url_from_item(item)[1:] - for item in manifest_items if self._is_not_jsshell(item)] - def is_slow_test(self, url): """Checks if a WPT is slow (long timeout) according to the manifest. @@ -178,25 +174,33 @@ return reftest_list @staticmethod - def ensure_manifest(host): - """Updates the MANIFEST.json file, or generates if it does not exist.""" + def ensure_manifest(host, path=None): + """Updates the MANIFEST.json file, or generates if it does not exist. + + Args: + path: The path to a WPT root (relative to web_tests, optional). + """ + if path is None: + path = host.filesystem.join('external', 'wpt') finder = PathFinder(host.filesystem) - manifest_path = finder.path_from_web_tests('external', 'wpt', 'MANIFEST.json') - base_manifest_path = finder.path_from_web_tests('external', BASE_MANIFEST_NAME) + wpt_path = finder.path_from_web_tests(path) + manifest_path = host.filesystem.join(wpt_path, MANIFEST_NAME) - if not host.filesystem.exists(base_manifest_path): - _log.error('Manifest base not found at "%s".', base_manifest_path) - host.filesystem.write_text_file(base_manifest_path, '{}') + # TODO(crbug.com/853815): perhaps also cache the manifest for wpt_internal. + if 'external' in path: + base_manifest_path = finder.path_from_web_tests('external', BASE_MANIFEST_NAME) + if not host.filesystem.exists(base_manifest_path): + _log.error('Manifest base not found at "%s".', base_manifest_path) + host.filesystem.write_text_file(base_manifest_path, '{}') - # Unconditionally replace MANIFEST.json with the base manifest even if - # the former exists, to avoid regenerating the manifest from scratch - # when the manifest version changes. Remove the destination first as - # copyfile will fail if the two files are hardlinked or symlinked. - if host.filesystem.exists(manifest_path): - host.filesystem.remove(manifest_path) - host.filesystem.copyfile(base_manifest_path, manifest_path) + # Unconditionally replace MANIFEST.json with the base manifest even if + # the former exists, to avoid regenerating the manifest from scratch + # when the manifest version changes. Remove the destination first as + # copyfile will fail if the two files are hardlinked or symlinked. + if host.filesystem.exists(manifest_path): + host.filesystem.remove(manifest_path) + host.filesystem.copyfile(base_manifest_path, manifest_path) - wpt_path = finder.path_from_web_tests('external', 'wpt') WPTManifest.generate_manifest(host, wpt_path) _log.debug('Manifest generation completed.')
diff --git a/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py b/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py index ae3155b..1bd6c428 100644 --- a/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py +++ b/third_party/blink/tools/blinkpy/w3c/wpt_manifest_unittest.py
@@ -88,24 +88,3 @@ manifest = WPTManifest(manifest_json) self.assertEqual(manifest.all_url_items(), {u'/test.any.html': [u'/test.any.html', {}]}) - - def test_file_path_to_url_paths(self): - manifest_json = ''' -{ - "items": { - "manual": {}, - "reftest": {}, - "testharness": { - "test.any.js": [ - ["/test.any.html", {}], - ["/test.any.js", {"jsshell": true}] - ] - } - } -} - ''' - manifest = WPTManifest(manifest_json) - # Leading slashes should be stripped; and jsshell tests shouldn't be - # included. - self.assertEqual(manifest.file_path_to_url_paths('test.any.js'), - [u'test.any.html'])
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 b5d5b8a..bca3d49 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/base.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/base.py
@@ -46,7 +46,7 @@ from blinkpy.common.memoized import memoized from blinkpy.common.path_finder import PathFinder from blinkpy.common.system.path import abspath_to_uri -from blinkpy.w3c.wpt_manifest import WPTManifest +from blinkpy.w3c.wpt_manifest import WPTManifest, MANIFEST_NAME from blinkpy.web_tests.layout_package.bot_test_expectations import BotTestExpectationsFactory from blinkpy.web_tests.models.test_configuration import TestConfiguration from blinkpy.web_tests.models.test_expectations import TestExpectationParser @@ -102,6 +102,15 @@ # And one for external/wpt/signed-exchange/resources/127.0.0.1.sxg.pem SXG_WPT_FINGERPRINT = '0Rt4mT6SJXojEMHTnKnlJ/hBKMBcI4kteBlhR1eTTdk=' +# The following two constants must match. When adding a new WPT root, also +# remember to add an alias rule to third_party/wpt/wpt.config.json. +WPT_DIRS = ['external/wpt'] +# WPT_REGEX captures: 1. the root directory of WPT relative to web_tests +# (without a trailing slash), 2. the path of the test within WPT (without a +# leading slash). +WPT_REGEX = re.compile(r'^(?:virtual/[^/]+/)?(external/wpt)/(.*)$') + + class Port(object): """Abstract class for Port-specific hooks for the web_test package.""" @@ -401,7 +410,6 @@ return True except OSError as e: _log.error('httpd launch error: ' + repr(e)) - pass _log.error('No httpd found. Cannot run http tests.') return False @@ -688,15 +696,13 @@ return reftest_list # Try to extract information from MANIFEST.json. - match = re.match(r'virtual/[^/]+/', test_name) - if match: - test_name = test_name[match.end(0):] - match = re.match(r'external/wpt/(.*)', test_name) + match = WPT_REGEX.match(test_name) if not match: return [] - path_in_wpt = match.group(1) - for expectation, ref_path_in_wpt in self._wpt_manifest().extract_reference_list(path_in_wpt): - ref_absolute_path = self._filesystem.join(self.web_tests_dir(), 'external/wpt' + ref_path_in_wpt) + wpt_path = match.group(1) + path_in_wpt = match.group(2) + for expectation, ref_path_in_wpt in self._wpt_manifest(wpt_path).extract_reference_list(path_in_wpt): + ref_absolute_path = self._filesystem.join(self.web_tests_dir(), wpt_path + ref_path_in_wpt) reftest_list.append((expectation, ref_absolute_path)) return reftest_list @@ -718,26 +724,29 @@ suites = self.virtual_test_suites() if paths: tests.extend(self._virtual_tests_matching_paths(paths, suites)) - if any('external' in path for path in paths): + if (any(wpt_path in path for wpt_path in WPT_DIRS for path in paths) + # TODO(robertma): Remove this special case when external/wpt is moved to wpt. + or any('external' in path for path in paths)): tests.extend(self._wpt_test_urls_matching_paths(paths)) else: tests.extend(self._all_virtual_tests(suites)) - tests.extend(['external/wpt' + test for test in self._wpt_manifest().all_urls()]) + tests.extend([wpt_path + test for wpt_path in WPT_DIRS + for test in self._wpt_manifest(wpt_path).all_urls()]) return tests def real_tests(self, paths): + """Find all real tests in paths except WPT.""" # When collecting test cases, skip these directories. - skipped_directories = set([ - 'platform', 'resources', 'support', 'script-tests', - 'reference', 'reftest', 'external' - ]) - is_non_wpt_real_test_file = lambda fs, dirname, filename: ( - self.is_test_file(fs, dirname, filename) - and not re.search(r'[/\\]external[/\\]wpt([/\\].*)?$', dirname) - ) + skipped_directories = set( + ['platform', 'resources', 'support', 'script-tests', + 'reference', 'reftest'] + # Also ignore all WPT directories. Note that this is only an + # optimization; is_non_wpt_test_file should skip WPT regardless. + + WPT_DIRS) files = find_files.find(self._filesystem, self.web_tests_dir(), paths, skipped_directories, - is_non_wpt_real_test_file, self.test_key) + lambda _, dirname, filename: self.is_non_wpt_test_file(dirname, filename), + self.test_key) return [self.relative_test_filename(f) for f in files] @staticmethod @@ -759,56 +768,44 @@ '.htm', '.php', '.svg', '.mht', '.pdf', ]) - @staticmethod - def _has_supported_extension(filesystem, filename): + def _has_supported_extension(self, filename): """Returns True if filename is one of the file extensions we want to run a test on.""" - extension = filesystem.splitext(filename)[1] - return extension in Port.supported_file_extensions + extension = self._filesystem.splitext(filename)[1] + return extension in self.supported_file_extensions - def is_test_file(self, filesystem, dirname, filename): - match = re.search(r'[/\\]external[/\\]wpt([/\\].*)?$', dirname) - if match: - if match.group(1): - path_in_wpt = match.group(1)[1:].replace('\\', '/') + '/' + filename - else: - path_in_wpt = filename - return self._wpt_manifest().is_test_file(path_in_wpt) - extension = filesystem.splitext(filename)[1] + def is_non_wpt_test_file(self, dirname, filename): + # Convert dirname to a relative path to web_tests with slashes + # normalized and ensure it has a trailing slash. + normalized_test_dir = self.relative_test_filename(dirname) + self.TEST_PATH_SEPARATOR + if any([normalized_test_dir.startswith(d + self.TEST_PATH_SEPARATOR) for d in WPT_DIRS]): + return False + extension = self._filesystem.splitext(filename)[1] if 'inspector-protocol' in dirname and extension == '.js': return True if 'devtools' in dirname and extension == '.js': return True - return Port._has_supported_extension( - filesystem, filename) and not Port.is_reference_html_file(filesystem, dirname, filename) - - def _convert_wpt_file_path_to_url_paths(self, file_path): - tests = [] - # Path separators are normalized by relative_test_filename(). - match = re.search(r'external/wpt/(.*)$', file_path) - if not match: - return [file_path] - urls = self._wpt_manifest().file_path_to_url_paths(match.group(1)) - for url in urls: - tests.append(file_path[0:match.start(1)] + url) - return tests + return (self._has_supported_extension(filename) and + not Port.is_reference_html_file(self._filesystem, dirname, filename)) @memoized - def _wpt_manifest(self): - manifest_path = self._filesystem.join(self.web_tests_dir(), 'external', 'wpt', 'MANIFEST.json') + def _wpt_manifest(self, path): + assert path in WPT_DIRS + # Convert '/' to the platform-specific separator. + path = self._filesystem.normpath(path) + manifest_path = self._filesystem.join(self.web_tests_dir(), path, MANIFEST_NAME) if not self._filesystem.exists(manifest_path): _log.error('Manifest not found at %s. Remove the --no-manifest-update argument to generate it.', manifest_path) return WPTManifest('{}') return WPTManifest(self._filesystem.read_text_file(manifest_path)) def is_slow_wpt_test(self, test_file): - match = re.match(r'virtual/[^/]+/', test_file) - if match: - test_file = test_file[match.end(0):] - # WPTManifest.is_slow_test() takes a WPT URL with the leading slash. - match = re.match(r'external/wpt(.*)', test_file) + match = WPT_REGEX.match(test_file) if not match: return False - return self._wpt_manifest().is_slow_test(match.group(1)) + wpt_path = match.group(1) + path_in_wpt = match.group(2) + # WPTManifest.is_slow_test() takes a WPT URL with the leading slash. + return self._wpt_manifest(wpt_path).is_slow_test('/' + path_in_wpt) def test_key(self, test_name): """Turns a test name into a pair of sublists: the natural sort key of the @@ -1180,7 +1177,7 @@ @staticmethod def is_wpt_test(test): """Whether a test is considered a web-platform-tests test.""" - return re.match(r'(virtual/[^/]+/)?external/wpt/', test) + return WPT_REGEX.match(test) @staticmethod def should_use_wptserve(test): @@ -1617,39 +1614,49 @@ return '*' in path def _wpt_test_urls_matching_paths(self, paths): - tests = [] + # This is to make sure "external[\\/]?" can also match to external/wpt. + # TODO(robertma): Remove this special case when external/wpt is moved to wpt. + paths = [self._filesystem.join(path, 'wpt') if path.rstrip('\\/').endswith('external') + else path for path in paths] # '/' is used throughout this function instead of filesystem.sep as the WPT manifest always # uses '/' for paths (it is not OS dependent). if self._filesystem.sep != '/': paths = [path.replace(self._filesystem.sep, '/') for path in paths] - for test_url_path in self._wpt_manifest().all_urls(): + tests = [] + for wpt_path in WPT_DIRS: + tests += self._wpt_test_urls(wpt_path, paths) + return tests + + def _wpt_test_urls(self, wpt_path, paths): + tests = [] + for test_url_path in self._wpt_manifest(wpt_path).all_urls(): if test_url_path[0] == '/': test_url_path = test_url_path[1:] - full_test_url_path = 'external/wpt/' + test_url_path + full_test_url_path = wpt_path + '/' + test_url_path for path in paths: - if 'external' not in path: + if not path.startswith(wpt_path): continue - wpt_path = path.replace('external/wpt/', '') + # Also remove the slash after wpt_path, if any. + path_in_wpt = path[len(wpt_path) + 1:] - # When `test_url_path` is test.any.html or test.any.worker.html and path is test.any.js + # When `test_url_path` is test.any.html etc., and `path_in_wpt` is test.any.js: matches_any_js_test = ( - self._wpt_manifest().is_test_file(wpt_path) - and test_url_path.startswith(re.sub(r'\.js$', '', wpt_path)) + self._wpt_manifest(wpt_path).is_test_file(path_in_wpt) + and test_url_path.startswith(re.sub(r'\.js$', '', path_in_wpt)) ) - # Get a list of directories for both paths, filter empty strings + # For all other path matches within WPT: + # Get a list of directories for both paths, filter empty strings. full_test_url_directories = filter(None, full_test_url_path.split('/')) path_directories = filter(None, path.split('/')) + test_is_in_path = path_directories == full_test_url_directories[0:len(path_directories)] - # For all other path matches within WPT - if matches_any_js_test or path_directories == full_test_url_directories[0:len(path_directories)]: - wpt_file_paths = self._convert_wpt_file_path_to_url_paths(test_url_path) - tests.extend('external/wpt/' + wpt_file_path for wpt_file_path in wpt_file_paths) - + if matches_any_js_test or test_is_in_path: + tests.append(full_test_url_path) return tests def _populate_virtual_suite(self, suite):
diff --git a/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py b/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py index 2bec6d0..38d69173 100644 --- a/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py +++ b/third_party/blink/tools/blinkpy/web_tests/port/base_unittest.py
@@ -26,7 +26,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import functools import json import optparse import unittest @@ -581,43 +580,30 @@ self.assertEqual(port.tests(['virtual/virtual_wpt_dom/external/wpt/dom/ranges/Range-attributes.html']), ['virtual/virtual_wpt_dom/external/wpt/dom/ranges/Range-attributes.html']) - def test_is_test_file(self): + def test_is_non_wpt_test_file(self): port = self.make_port(with_tests=True) - is_test_file = functools.partial(Port.is_test_file, port, port.host.filesystem) - self.assertTrue(is_test_file('', 'foo.html')) - self.assertTrue(is_test_file('', 'foo.svg')) - self.assertTrue(is_test_file('', 'test-ref-test.html')) - self.assertTrue(is_test_file('devtools', 'a.js')) - self.assertFalse(is_test_file('', 'foo.png')) - self.assertFalse(is_test_file('', 'foo-expected.html')) - self.assertFalse(is_test_file('', 'foo-expected.svg')) - self.assertFalse(is_test_file('', 'foo-expected.xht')) - self.assertFalse(is_test_file('', 'foo-expected-mismatch.html')) - self.assertFalse(is_test_file('', 'foo-expected-mismatch.svg')) - self.assertFalse(is_test_file('', 'foo-expected-mismatch.xhtml')) - self.assertFalse(is_test_file('', 'foo-ref.html')) - self.assertFalse(is_test_file('', 'foo-notref.html')) - self.assertFalse(is_test_file('', 'foo-notref.xht')) - self.assertFalse(is_test_file('', 'foo-ref.xhtml')) - self.assertFalse(is_test_file('', 'ref-foo.html')) - self.assertFalse(is_test_file('', 'notref-foo.xhr')) + self.assertTrue(port.is_non_wpt_test_file('', 'foo.html')) + self.assertTrue(port.is_non_wpt_test_file('', 'foo.svg')) + self.assertTrue(port.is_non_wpt_test_file('', 'test-ref-test.html')) + self.assertTrue(port.is_non_wpt_test_file('devtools', 'a.js')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo.png')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-expected.html')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-expected.svg')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-expected.xht')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-expected-mismatch.html')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-expected-mismatch.svg')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-expected-mismatch.xhtml')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-ref.html')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-notref.html')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-notref.xht')) + self.assertFalse(port.is_non_wpt_test_file('', 'foo-ref.xhtml')) + self.assertFalse(port.is_non_wpt_test_file('', 'ref-foo.html')) + self.assertFalse(port.is_non_wpt_test_file('', 'notref-foo.xhr')) - def test_is_test_file_in_wpt(self): - port = self.make_port(with_tests=True) - filesystem = port.host.filesystem - PortTest._add_manifest_to_mock_file_system(filesystem) - - # A file not in MANIFEST.json is not a test even if it has .html suffix. - self.assertFalse(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt/common', 'blank.html')) - - # .js is not a test in general, but it is if MANIFEST.json contains an - # entry for it. - self.assertTrue(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt/console', 'console-is-a-namespace.any.js')) - - # A file in external/wpt, not a sub directory. - self.assertFalse(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt', 'testharness_runner.html')) - # A file in external/wpt_automation. - self.assertTrue(port.is_test_file(filesystem, WEB_TEST_DIR + '/external/wpt_automation', 'foo.html')) + self.assertFalse(port.is_non_wpt_test_file(WEB_TEST_DIR + '/external/wpt/common', 'blank.html')) + self.assertFalse(port.is_non_wpt_test_file(WEB_TEST_DIR + '/external/wpt/console', 'console-is-a-namespace.any.js')) + self.assertFalse(port.is_non_wpt_test_file(WEB_TEST_DIR + '/external/wpt', 'testharness_runner.html')) + self.assertTrue(port.is_non_wpt_test_file(WEB_TEST_DIR + '/external/wpt_automation', 'foo.html')) def test_is_wpt_test(self): self.assertTrue(Port.is_wpt_test('external/wpt/dom/ranges/Range-attributes.html'))
diff --git a/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG b/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG index c5fca84..4fab442 100644 --- a/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG +++ b/third_party/blink/web_tests/FlagExpectations/enable-blink-features=LayoutNG
@@ -111,10 +111,7 @@ crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-insert-002e.xht [ Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-nested-002.xht [ Pass ] crbug.com/591099 external/wpt/css/CSS2/normal-flow/block-in-inline-remove-006.xht [ Pass ] -crbug.com/591099 external/wpt/css/CSS2/text/white-space-003.xht [ Pass ] crbug.com/591099 external/wpt/css/CSS2/text/white-space-mixed-003.xht [ Pass ] -crbug.com/591099 external/wpt/css/CSS2/text/white-space-pre-element-001.xht [ Pass ] -crbug.com/591099 external/wpt/css/CSS2/text/white-space-processing-040.xht [ Pass ] crbug.com/591099 external/wpt/css/css-animations/Element-getAnimations-dynamic-changes.tentative.html [ Failure ] crbug.com/591099 external/wpt/css/css-animations/Element-getAnimations.tentative.html [ Pass ] crbug.com/591099 external/wpt/css/css-contain/contain-size-grid-002.html [ Failure ] @@ -306,7 +303,6 @@ crbug.com/591099 external/wpt/css/cssom-view/elementsFromPoint-inline-vrl-ltr.html [ Pass ] crbug.com/591099 external/wpt/css/cssom-view/elementsFromPoint-inline-vrl-rtl.html [ Pass ] crbug.com/591099 external/wpt/css/cssom-view/offsetTopLeftInline.html [ Pass ] -crbug.com/591099 external/wpt/css/filter-effects/css-filters-animation-opacity.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-004.html [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-align-self-vertWM-003.html [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/align3/flex-abspos-staticpos-justify-content-003.html [ Failure ] @@ -319,8 +315,6 @@ crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/counter-styles-3/redefine-builtin.html [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-horiz-002.xhtml [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-vert-002.xhtml [ Failure ] -crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-empty-001a.html [ Pass ] -crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-empty-001b.html [ Pass ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-collapsed-item-horiz-002.html [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-justify-content-horiz-003.xhtml [ Failure ] crbug.com/591099 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-writing-mode-011.html [ Pass ]
diff --git a/third_party/blink/web_tests/SlowTests b/third_party/blink/web_tests/SlowTests index c982f88..683e5b6 100644 --- a/third_party/blink/web_tests/SlowTests +++ b/third_party/blink/web_tests/SlowTests
@@ -237,6 +237,7 @@ # Slow on Win Debug in part due to incremental linking. crbug.com/647192 [ Win Debug ] fast/css3-text/css3-word-break/word-break-all-ascii.html [ Slow ] +crbug.com/948670 [ Mac10.13 Debug ] fast/css3-text/css3-word-break/word-break-all-ascii.html [ Slow ] # Slow on many platforms. crbug.com/866165 virtual/stable/webexposed/global-interface-listing.html [ Slow ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 1056682..09acd59 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -245,7 +245,6 @@ # Subpixel differences crbug.com/771643 external/wpt/css/css-backgrounds/background-attachment-local/attachment-local-clipping-color-5.html [ Failure ] crbug.com/771643 external/wpt/css/css-backgrounds/background-attachment-local/attachment-local-clipping-image-5.html [ Failure ] -crbug.com/836884 external/wpt/css/filter-effects/css-filters-animation-opacity.html [ Failure ] # Fails due to flaws in the SPv1 architecture. Can be fixed with composite-after-paint. crbug.com/862483 compositing/overflow/scrollbar-layer-placement-negative-z-index-child.html [ Failure ] @@ -2655,6 +2654,12 @@ crbug.com/492511 [ Mac ] fast/text/atsui-negative-spacing-features.html [ Failure ] crbug.com/492511 [ Mac ] fast/text/international/arabic-justify.html [ Failure ] +### Tests added for non-fast scrolling regions that break as a result of compositor scrolling. +crbug.com/817600 virtual/fractional_scrolling_threaded/fast/scrolling/non-composited-scroller-in-sticky.html [ Failure ] +crbug.com/817600 virtual/threaded/fast/scrolling/non-composited-scroller-in-scrolled-absolute-scroller.html [ Failure ] +crbug.com/817600 virtual/threaded/fast/scrolling/non-composited-scroller-in-scrolled-position-fixed-scroller.html [ Failure ] +crbug.com/817600 virtual/threaded/fast/scrolling/non-composited-scroller-in-sticky.html [ Failure ] + # Ref tests that fail due to differences in inline box structure, even though they contain the same text. # This happens because inline box layout uses fixed-point measurements, which can cause rounding differences. crbug.com/321237 [ Mac ] fast/selectors/007a.html [ Failure ] @@ -3020,7 +3025,6 @@ crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/constructor/018.html?wss [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/Secure-Send-binary-arraybufferview-uint8-offset.any.html [ Timeout ] crbug.com/626703 [ Mac10.12 ] external/wpt/websockets/constructor/010.html?wss [ Timeout ] -crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/contain/contain-size-block-002.html [ Failure ] crbug.com/626703 external/wpt/css/css-lists/list-item-definition.html [ Failure ] crbug.com/626703 external/wpt/css/css-contain/contain-content-011.html [ Failure ] crbug.com/626703 external/wpt/css/css-contain/contain-strict-011.html [ Failure ] @@ -3194,15 +3198,12 @@ crbug.com/626703 [ Win ] external/wpt/css/CSS2/text/white-space-bidirectionality-001.xht [ Failure ] crbug.com/626703 external/wpt/css/css-text/text-transform/text-transform-shaping-002.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/white-space/pre-wrap-012.html [ Failure ] -crbug.com/626703 external/wpt/css/CSS2/text/white-space-pre-element-001.xht [ Failure ] -crbug.com/626703 external/wpt/css/CSS2/text/white-space-003.xht [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/hori-block-size-small-or-larger-than-container-with-min-or-max-content-2b.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/block-size-with-min-or-max-content-1a.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/white-space/pre-wrap-014.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/vert-block-size-small-or-larger-than-container-with-min-or-max-content-2b.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/vert-block-size-small-or-larger-than-container-with-min-or-max-content-2a.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/white-space/pre-wrap-013.html [ Failure ] -crbug.com/626703 external/wpt/css/CSS2/text/white-space-processing-040.xht [ Failure ] crbug.com/626703 external/wpt/css/css-text/text-transform/text-transform-shaping-003.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/white-space/white-space-intrinsic-size-003.html [ Failure ] crbug.com/626703 external/wpt/css/css-text/text-transform/text-transform-copy-paste-001-manual.html [ Skip ] @@ -3914,8 +3915,6 @@ crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-baseline-horiz-006.xhtml [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-align-self-baseline-horiz-007.xhtml [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-align-self-baseline-vert-001.html [ Failure Pass ] -crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-empty-001a.html [ Failure ] -crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-empty-001b.html [ Failure ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-baseline-multi-item-vert-001a.html [ Failure Pass ] crbug.com/626703 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/writing-modes-3/logical-physical-mapping-001.html [ Failure ] crbug.com/626703 external/wpt/encoding/eof-utf-8-three.html [ Failure ] @@ -5738,37 +5737,6 @@ crbug.com/902633 virtual/streams-native/http/tests/streams/transferable/shared-worker.html [ Pass Failure ] crbug.com/902633 virtual/streams-native/http/tests/streams/transferable/worker.html [ Pass Failure ] -# PipeTo() is currently disabled in the StreamsNative implementation of streams, -# which causes these timeouts. -### virtual/streams-native/external/wpt/fetch/api/request/ -crbug.com/902633 virtual/streams-native/external/wpt/fetch/api/request/request-keepalive-quota.html [ Timeout ] - -### virtual/streams-native/external/wpt/fetch/api/response/ -crbug.com/902633 virtual/streams-native/external/wpt/fetch/api/response/response-stream-with-broken-then.any.worker.html [ Timeout ] - -### virtual/streams-native/external/wpt/streams/piping/ -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/abort.any.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/abort.any.serviceworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/abort.any.sharedworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/abort.any.worker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/close-propagation-forward.any.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/close-propagation-forward.any.serviceworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/close-propagation-forward.any.sharedworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/close-propagation-forward.any.worker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-backward.any.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-backward.any.serviceworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-backward.any.sharedworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-backward.any.worker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-forward.any.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-forward.any.serviceworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-forward.any.sharedworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/error-propagation-forward.any.worker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/then-interception.any.serviceworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/then-interception.any.sharedworker.html [ Timeout ] -crbug.com/902633 virtual/streams-native/external/wpt/streams/piping/then-interception.any.worker.html [ Timeout ] - -### virtual/streams-native/http/tests/streams/chromium/ -crbug.com/902633 virtual/streams-native/http/tests/streams/chromium/touching-global-object.html [ Timeout ] # Sheriff 2019-01-03 crbug.com/918905 external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/sizing/block-size-with-min-or-max-content-table-1b.html [ Pass Failure ] @@ -6188,8 +6156,6 @@ crbug.com/947023 external/wpt/fetch/sec-metadata/report.tentative.https.sub.html [ Pass Timeout ] crbug.com/947023 external/wpt/fetch/sec-metadata/xslt.tentative.https.sub.html [ Pass Failure ] -## Temp while landing a fix from webrtc importer -crbug.com/948055 external/wpt/webrtc/RTCDataChannel-id.html [ Failure Pass ] -crbug.com/948055 external/wpt/webrtc/RTCPeerConnection-createDataChannel.html [ Failure Pass ] -crbug.com/948055 virtual/webrtc-wpt-plan-b/external/wpt/webrtc/RTCDataChannel-id.html [ Failure Pass ] -crbug.com/948055 virtual/webrtc-wpt-plan-b/external/wpt/webrtc/RTCPeerConnection-createDataChannel.html [ Failure Pass ] +# Sheriff 2019-04-02 +crbug.com/947690 [ Debug ] http/tests/history/back-during-beforeunload.html [ Pass Failure ] +crbug.com/948785 [ Debug ] virtual/user-activation-v2/fast/events/pointerevents/pointer-event-consumed-touchstart-in-slop-region.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json index 0e9a11e..a6151e58 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_5.json
@@ -38989,6 +38989,30 @@ {} ] ], + "css/css-contain/contain-size-scrollbars-002.html": [ + [ + "/css/css-contain/contain-size-scrollbars-002.html", + [ + [ + "/css/css-contain/reference/contain-size-scrollbars-001-ref.html", + "==" + ] + ], + {} + ] + ], + "css/css-contain/contain-size-scrollbars-003.html": [ + [ + "/css/css-contain/contain-size-scrollbars-003.html", + [ + [ + "/css/css-contain/reference/contain-size-scrollbars-001-ref.html", + "==" + ] + ], + {} + ] + ], "css/css-contain/contain-strict-001.html": [ [ "/css/css-contain/contain-strict-001.html", @@ -189690,6 +189714,26 @@ {} ] ], + "streams/readable-streams/tee.any-expected.txt": [ + [ + {} + ] + ], + "streams/readable-streams/tee.any.serviceworker-expected.txt": [ + [ + {} + ] + ], + "streams/readable-streams/tee.any.sharedworker-expected.txt": [ + [ + {} + ] + ], + "streams/readable-streams/tee.any.worker-expected.txt": [ + [ + {} + ] + ], "streams/resources/constructor-ordering.js": [ [ {} @@ -190715,11 +190759,6 @@ {} ] ], - "tools/ci/action_manifest_build.sh": [ - [ - {} - ] - ], "tools/ci/azure/README.md": [ [ {} @@ -190805,11 +190844,6 @@ {} ] ], - "tools/ci/ci_lint.sh": [ - [ - {} - ] - ], "tools/ci/ci_resources_unittest.sh": [ [ {} @@ -190845,12 +190879,12 @@ {} ] ], - "tools/ci/run_tc.py": [ + "tools/ci/manifest_build.py": [ [ {} ] ], - "tools/ci/tag_master.py": [ + "tools/ci/run_tc.py": [ [ {} ] @@ -199355,11 +199389,6 @@ {} ] ], - "webrtc/RTCDataChannel-id-expected.txt": [ - [ - {} - ] - ], "webrtc/RTCDataChannel-send-expected.txt": [ [ {} @@ -236300,6 +236329,18 @@ {} ] ], + "element-timing/image-with-css-scale.html": [ + [ + "/element-timing/image-with-css-scale.html", + {} + ] + ], + "element-timing/image-with-rotation.html": [ + [ + "/element-timing/image-with-rotation.html", + {} + ] + ], "element-timing/images-repeated-resource.html": [ [ "/element-timing/images-repeated-resource.html", @@ -236348,6 +236389,12 @@ {} ] ], + "element-timing/rectangular-image.html": [ + [ + "/element-timing/rectangular-image.html", + {} + ] + ], "element-timing/supported-element-type.html": [ [ "/element-timing/supported-element-type.html", @@ -252591,6 +252638,12 @@ {} ] ], + "html/semantics/embedded-content/media-elements/playing-the-media-resource/loop-from-ended.tentative.html": [ + [ + "/html/semantics/embedded-content/media-elements/playing-the-media-resource/loop-from-ended.tentative.html", + {} + ] + ], "html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-move-to-other-document.html": [ [ "/html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-move-to-other-document.html", @@ -293093,6 +293146,12 @@ {} ] ], + "svg/extensibility/foreignObject/foreign-object-under-clip-path-crash.html": [ + [ + "/svg/extensibility/foreignObject/foreign-object-under-clip-path-crash.html", + {} + ] + ], "svg/extensibility/foreignObject/properties.svg": [ [ "/svg/extensibility/foreignObject/properties.svg", @@ -313639,7 +313698,7 @@ }, "paths": { ".github/main.workflow": [ - "b1b61554f91aa0256fbd4a58e0cbbe16ecdb1c6e", + "4ff7845b9d23ad55724b78950bc94d7d5a7a9e5e", "support" ], ".gitignore": [ @@ -349595,7 +349654,15 @@ "reftest" ], "css/css-contain/contain-size-scrollbars-001.html": [ - "304e81e5c98c0ded48c9c498e451dd6c0041566b", + "26f0d81da8ceac6df92325bf33d15d01c0d3d432", + "reftest" + ], + "css/css-contain/contain-size-scrollbars-002.html": [ + "4fe1aae744fe239af396a405809ce6cadeef296a", + "reftest" + ], + "css/css-contain/contain-size-scrollbars-003.html": [ + "4684440bdbfd9886fd34a6ba1144ae1724b6a157", "reftest" ], "css/css-contain/contain-strict-001.html": [ @@ -398243,11 +398310,11 @@ "reftest" ], "css/filter-effects/backdrop-filter-clip-rect-ref.html": [ - "d3c1f800e69bdfb72ca1d6d4d1ae73b8c8febcad", + "9082fa32de3bd022245d5f2c3a75c354674ff38e", "support" ], "css/filter-effects/backdrop-filter-clip-rect.html": [ - "2e7e486252f511af4097adf271670067f4a0e537", + "4fc4b739ddb5a316ca6ca4706940c04df96e57d3", "reftest" ], "css/filter-effects/backdrop-filter-edge-pixels-ref.html": [ @@ -398291,7 +398358,7 @@ "reftest" ], "css/filter-effects/backdrop-filter-reference-filter.html": [ - "74c813c92a46aae10739356318a3c356c0aae3c3", + "6c61a9620aa82d23375fd31900d87bcfd873a5e1", "reftest" ], "css/filter-effects/blur-clip-stacking-context-001.html": [ @@ -409579,11 +409646,11 @@ "testharness" ], "element-timing/buffer-before-onload.html": [ - "1fd02776927d193d68702fce5248835ed26f8dea", + "805777f29c297a22497d3e4f07b6ea462b0a0b7c", "testharness" ], "element-timing/cross-origin-element.sub.html": [ - "a122819fc499bde272daf1f8ccf086d856e69a62", + "b1a5b7ccd7acd221daef9bbc259a4cf972075553", "testharness" ], "element-timing/cross-origin-iframe-element.sub.html": [ @@ -409591,27 +409658,35 @@ "testharness" ], "element-timing/image-TAO-wildcard.sub.html": [ - "3ba12a7d01f1c8b9f0069f0382d6fcc4bda2e639", + "0e24af068a6d93920c268846442ab89b4a1b65ee", "testharness" ], "element-timing/image-carousel.html": [ - "0bd99ab2507a1009071ef91d0146973b0257e4ae", + "9f0ef79e354dfe8e505e8308561a1b0a1a33167c", "testharness" ], "element-timing/image-clipped-svg.html": [ - "13c4a81a1e02fd5035565e5f765047ad510f39f9", + "36cf1b15e0df0f99b8312ef56cde211f7c1358dd", "testharness" ], "element-timing/image-not-fully-visible.html": [ - "d3e2c105bffdf9a78ba2b51ade49dbb0df91e2fe", + "279fa03cc2b42029ed01a68f670829c13b282a5c", "testharness" ], "element-timing/image-rect-iframe.html": [ - "da46d785a0b7dca251cbcc26a13b14d8ce742f3f", + "94c872e8e02fe16e22b105c04cd1c9cc4e1cf9d8", + "testharness" + ], + "element-timing/image-with-css-scale.html": [ + "6d77429e485ede047122eb3c25221d5e394c2d98", + "testharness" + ], + "element-timing/image-with-rotation.html": [ + "70b635e012a6825bf5832594bd9e385173ab1878", "testharness" ], "element-timing/images-repeated-resource.html": [ - "18c72cdad1b310972a35dab0878c92af1bba75bf", + "dbcad248e3aea0d148416275adeec93e20d8c267", "testharness" ], "element-timing/observe-child-element.html": [ @@ -409619,27 +409694,31 @@ "testharness" ], "element-timing/observe-elementtiming.html": [ - "9170b36d7c7fbd14683a8d56afb9f174aac23686", + "39fea05431107efc251f820de1cc476aa8a3f37e", "testharness" ], "element-timing/observe-large-image.html": [ - "fb2884381ab30e3c6b05150ad4fbb47fe2c81f32", + "a08274caa52542f71a14002b4063cc9dc9736bb2", "testharness" ], "element-timing/observe-multiple-images.html": [ - "aa91aa839896c166e46fe76b31eb169b0bf81857", + "05c54ac050fe8caf5581dcbd1de5e30bb8681fd1", "testharness" ], "element-timing/observe-svg-image.html": [ - "fdfe25ec9ff8b1bbf50ee902e0a38d9bcf258c50", + "45e800d25da14d7052b42dab939ca49167bfedc3", "testharness" ], "element-timing/observe-video-poster.html": [ - "40961382ffba6b828ac551cc046265de7d89eac1", + "d3a69937d3c3c0815f4f86e4b09acc1517aec491", "testharness" ], "element-timing/progressively-loaded-image.html": [ - "cf54e1e5c7a281bc59ba4172cd8ee3d7efdab099", + "c0a7d4f1fb76ffdade7df5f2663f1e33de84e7f3", + "testharness" + ], + "element-timing/rectangular-image.html": [ + "b02808456a3de05fb2ac1ede3af33c056bfd77ad", "testharness" ], "element-timing/resources/TAOImage.py": [ @@ -409651,11 +409730,11 @@ "support" ], "element-timing/resources/element-timing-helpers.js": [ - "e952930ef5e49cf9da25b29c333e752e09c75e60", + "66605df824bb5b9687f6f3611c0041714b8e9c01", "support" ], "element-timing/resources/iframe-with-square-sends-entry.html": [ - "3c43a41c7d910e025837326e6c7b018060b10621", + "25bd67935a1a3b493233451da9f9cf89742275ec", "support" ], "element-timing/resources/iframe-with-square.html": [ @@ -415663,7 +415742,7 @@ "manual" ], "fullscreen/api/element-request-fullscreen-options.html": [ - "c6ce1fdc016ec88ba0bd386b7d634f7fd1501b28", + "6a0bfa1f5fac33b3e56e5ee77a6fa34432f91df1", "testharness" ], "fullscreen/api/element-request-fullscreen-same-manual.html": [ @@ -426522,6 +426601,10 @@ "817615c5cb543fd5331f9838b1cc37cded5b21cf", "testharness" ], + "html/semantics/embedded-content/media-elements/playing-the-media-resource/loop-from-ended.tentative.html": [ + "03a9b5d454473872f0d321b74524518438372fac", + "testharness" + ], "html/semantics/embedded-content/media-elements/playing-the-media-resource/pause-move-to-other-document-expected.txt": [ "aa9a81c300cf2ca6de1c1b7a5c613b6e578770de", "support" @@ -437043,7 +437126,7 @@ "support" ], "interfaces/wake-lock.idl": [ - "7ef19dc64754f3ab060035163bd3854dce32aaef", + "202dc6b09f7e6aa56289b62bb810ed0fb2e289d0", "support" ], "interfaces/wasm-js-api.idl": [ @@ -437115,7 +437198,7 @@ "support" ], "interfaces/webxr.idl": [ - "7594489a36d130864e553a3c8125aa2488895b2e", + "8a3264073e8268282c3db6a891b860d57bfcdb28", "support" ], "interfaces/worklets.idl": [ @@ -467042,10 +467125,26 @@ "7724ea63d3747e4fdf8dcd418889d3c2160d8036", "testharness" ], + "streams/readable-streams/tee.any-expected.txt": [ + "0ad673751f78d51577e9d92e2bc76552daf05a51", + "support" + ], "streams/readable-streams/tee.any.js": [ - "ba7813642b7d2ae164347608a34a7539fb246255", + "4a07f0f2bfb62c84eaf92d8b49ea5549ef653eb8", "testharness" ], + "streams/readable-streams/tee.any.serviceworker-expected.txt": [ + "0ad673751f78d51577e9d92e2bc76552daf05a51", + "support" + ], + "streams/readable-streams/tee.any.sharedworker-expected.txt": [ + "0ad673751f78d51577e9d92e2bc76552daf05a51", + "support" + ], + "streams/readable-streams/tee.any.worker-expected.txt": [ + "0ad673751f78d51577e9d92e2bc76552daf05a51", + "support" + ], "streams/readable-streams/templated.any.js": [ "b5cc0b30ed36df99fc3f26227166a4d3ddcdfe08", "testharness" @@ -467454,6 +467553,10 @@ "91fc3ef7fe75237cc7709737739a78be8cce0a0f", "reftest" ], + "svg/extensibility/foreignObject/foreign-object-under-clip-path-crash.html": [ + "c1d2b3a7e92a6f13192ecac29f52c8ccd7b3dd45", + "testharness" + ], "svg/extensibility/foreignObject/position-svg-root-in-foreign-object-ref.html": [ "668eb9b8c7e469540219b5ea9010db28239ae432", "support" @@ -469246,10 +469349,6 @@ "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391", "support" ], - "tools/ci/action_manifest_build.sh": [ - "ad6a4cb16e7b24cf6c67d52e50b9248c64b8e754", - "support" - ], "tools/ci/azure/README.md": [ "afe5021efcad78a13d1767fb423d846557b92ee0", "support" @@ -469318,10 +469417,6 @@ "709cc2aa7e6867f548d4efdd62d74abc185e657b", "support" ], - "tools/ci/ci_lint.sh": [ - "bf98f209eba1330c9a69d13ed0ca9380e3ec24a2", - "support" - ], "tools/ci/ci_resources_unittest.sh": [ "11190fc58d64491bae719f9ac91adb1e879886fb", "support" @@ -469350,12 +469445,12 @@ "d0a80ab46c7a86b476776d2dff0fcd23776dfc9e", "support" ], - "tools/ci/run_tc.py": [ - "32eef7cb69cf0d4450d3d177e891740cb42b4fd7", + "tools/ci/manifest_build.py": [ + "98e7ce75e512c1568f3d7fa6ca94fa58e0c10835", "support" ], - "tools/ci/tag_master.py": [ - "d672d13fe2339ed6ae85324147cdf108fdccc8a4", + "tools/ci/run_tc.py": [ + "e03c1e1eb9d6dec0f5aff0f81643e4563ab969dc", "support" ], "tools/ci/taskcluster-run.py": [ @@ -473675,7 +473770,7 @@ "support" ], "tools/wptrunner/requirements.txt": [ - "f2a336875f0ed137c40d79e3bab7f64e69b99d40", + "67cb0e6c8926bc42cec7a2c4a510082817309fb1", "support" ], "tools/wptrunner/requirements_chrome.txt": [ @@ -474051,7 +474146,7 @@ "support" ], "tools/wptrunner/wptrunner/wptmanifest/parser.py": [ - "e6c2e5b5ca28162e5df41c51a0b96dfcf6b3eabe", + "b16d96a42d4a5038b80a8807b3eb19fbfe17815e", "support" ], "tools/wptrunner/wptrunner/wptmanifest/serializer.py": [ @@ -474079,7 +474174,7 @@ "support" ], "tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py": [ - "b7c62c0041496be4f55f06699eabf9a3cf77d654", + "40a8acc6cabddd39b7c2d6711a53eb2dda1bd560", "support" ], "tools/wptrunner/wptrunner/wptrunner.py": [ @@ -475555,15 +475650,15 @@ "support" ], "wake-lock/idlharness.https.any-expected.txt": [ - "aed73b70e881833366f68611cb3ac3a24e4e530f", + "ca88133a56777e7b0c5b4b65741aae208cf0d904", "support" ], "wake-lock/idlharness.https.any.js": [ - "5e3ae75064c5f9c2be1b96ce763868066352889b", + "fa47bd9b1e007518fb4c91328bf305e3afead449", "testharness" ], "wake-lock/idlharness.https.any.worker-expected.txt": [ - "aed73b70e881833366f68611cb3ac3a24e4e530f", + "78381b7e21fc484f22d9c055ab9341356f856601", "support" ], "wake-lock/wakelock-applicability-manual.https-expected.txt": [ @@ -479586,10 +479681,6 @@ "b982b29b3b957eaca8a087e75e9ac3627f897e29", "testharness" ], - "webrtc/RTCDataChannel-id-expected.txt": [ - "d7f04467226efe89dc032b07858187f013182a15", - "support" - ], "webrtc/RTCDataChannel-id.html": [ "0cf01976ff0eeb66c51ded321e777123f063b02c", "testharness" @@ -479703,11 +479794,11 @@ "testharness" ], "webrtc/RTCPeerConnection-createDataChannel-expected.txt": [ - "4064e79e02bbf3addea3cd906e5e55d73eb56718", + "05ab536fe71e2c3697186b66b8607d65bd5f237e", "support" ], "webrtc/RTCPeerConnection-createDataChannel.html": [ - "ae74b62d42c3de9254c62a6e974e578416fc7c92", + "3cdba839d821c693f34bce64b346db0886ba71c5", "testharness" ], "webrtc/RTCPeerConnection-createOffer-expected.txt": [ @@ -484751,7 +484842,7 @@ "support" ], "webxr/idlharness.https.window-expected.txt": [ - "b9df588c70e3c521a84d5335f0e3e32f9cd12cbf", + "65bc029f50ac9e07823df1698a329da04268e4fc", "support" ], "webxr/idlharness.https.window.js": [
diff --git a/third_party/blink/web_tests/external/wpt/.github/main.workflow b/third_party/blink/web_tests/external/wpt/.github/main.workflow index b1b61554..4ff7845 100644 --- a/third_party/blink/web_tests/external/wpt/.github/main.workflow +++ b/third_party/blink/web_tests/external/wpt/.github/main.workflow
@@ -1,16 +1,10 @@ workflow "Build & Release Manifest" { on = "push" - resolves = ["tag-master"] + resolves = ["manifest-build-and-tag"] } -action "build-manifest" { +action "manifest-build-and-tag" { uses = "./tools/docker/github" - runs = ["bash", "-c", "tools/ci/action_manifest_build.sh"] -} - -action "tag-master" { - needs = "build-manifest" - uses = "./tools/docker/github" - runs = ["python", "tools/ci/tag_master.py"] + runs = ["python", "tools/ci/manifest_build.py"] secrets = ["GITHUB_TOKEN"] }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/contain-size-flexbox-002.html b/third_party/blink/web_tests/external/wpt/css/css-contain/contain-size-flexbox-002.html new file mode 100644 index 0000000..531af69 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/contain-size-flexbox-002.html
@@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>Tests that scrollbars are handled correctly in a flex item with contains:size</title> +<link rel="author" title="Google LLC" href="https://www.google.com"> +<link rel="help" href="https://www.w3.org/TR/css-contain-1/#containment-size"> +<link rel="match" href="reference/contain-size-flexbox-002-ref.html"> + +<style> +div > div { + vertical-align: top; + display: inline-block; + contain: size; + overflow: scroll; + border: 1px solid; +} +</style> + +<p>Test passes if the two lines below look the same.</p> + +<div style="display: flex; line-height: 1.0;"> + <div></div> +</div> + +<div style="line-height: 1.0;"> + <div></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/reference/contain-size-flexbox-002-ref.html b/third_party/blink/web_tests/external/wpt/css/css-contain/reference/contain-size-flexbox-002-ref.html new file mode 100644 index 0000000..a75fa26c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/reference/contain-size-flexbox-002-ref.html
@@ -0,0 +1,23 @@ +<!DOCTYPE html> +<title>Tests that scrollbars are handled correctly in a flex item with contains:size</title> +<link rel="author" title="Google LLC" href="https://www.google.com"> + +<style> +div > div { + vertical-align: top; + display: inline-block; + contain: size; + overflow: scroll; + border: 1px solid; +} +</style> + +<p>Test passes if the two lines below look the same.</p> + +<div style="line-height: 1.0;"> + <div></div> +</div> + +<div style="line-height: 1.0;"> + <div></div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/media-elements/playing-the-media-resource/loop-from-ended.tentative.html b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/media-elements/playing-the-media-resource/loop-from-ended.tentative.html new file mode 100644 index 0000000..03a9b5d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/semantics/embedded-content/media-elements/playing-the-media-resource/loop-from-ended.tentative.html
@@ -0,0 +1,55 @@ +<!DOCTYPE html> +<title>Test looping edge case to verify http://crbug.com/364442.</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/media.js"></script> +<video></video> +<script> +// Seek towards end of video (for faster testing). +// Play video to end with "loop" set to false. +// Once ended, set "loop" to true. Call play. +// Verify that "seeked" event fires, seeking back to the beginning. +// Pause video and end test. +async_test(function(t) { + var video = document.querySelector("video"); + + video.onloadedmetadata = t.step_func(function() { + // Video is initially paused and "loop" unset. + assert_true(video.paused, "paused initially "); + assert_false(video.loop, "loop initially"); + // Seek to just before the end of the video and play. + video.currentTime = video.duration - 0.5; + video.onended = t.step_func(function() { + // Verify played to end and stopped. + assert_true(video.ended, "ended at ended event"); + assert_true(video.paused, "paused at ended event"); + assert_equals(video.currentTime, video.duration, "currentTime at ended event"); + + // With playback ended, set "loop" attribute. This will cause ended == false. + // looping video cannot be "ended", only paused. + assert_false(video.loop, "loop at ended event"); + video.loop = true; + assert_true(video.loop, "loop after seek"); + assert_false(video.ended, "ended after seek"); + assert_true(video.paused, "paused after seek"); + + video.onseeked = t.step_func_done(function() { + // Observed seek. Verify current time decreased and still playing. + assert_true(video.loop, "loop at seeked event") + assert_false(video.paused, "paused at seeked event"); + assert_false(video.ended, "ended at seeked event"); + assert_less_than(video.currentTime, video.duration, "currentTime at seeked event"); + // Pausing now that test is over to prevent additional unwanted looping. + video.pause(); + }); + + // Play video with "loop" set. Expect seek back to start. + video.play(); + }); + + video.play(); + }); + + video.src = getVideoURI("/media/movie_5"); +}); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/wake-lock.idl b/third_party/blink/web_tests/external/wpt/interfaces/wake-lock.idl index 7ef19dc..202dc6b0 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/wake-lock.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/wake-lock.idl
@@ -11,6 +11,7 @@ [Constructor(WakeLockType type), SecureContext, Exposed=(DedicatedWorker,Window)] interface WakeLock : EventTarget { + [Exposed=Window] static Promise<PermissionState> requestPermission(WakeLockType type); readonly attribute WakeLockType type; readonly attribute boolean active; attribute EventHandler onactivechange;
diff --git a/third_party/blink/web_tests/external/wpt/interfaces/webxr.idl b/third_party/blink/web_tests/external/wpt/interfaces/webxr.idl index 7594489..8a32640 100644 --- a/third_party/blink/web_tests/external/wpt/interfaces/webxr.idl +++ b/third_party/blink/web_tests/external/wpt/interfaces/webxr.idl
@@ -149,8 +149,7 @@ readonly attribute DOMPointReadOnly position; readonly attribute DOMPointReadOnly orientation; readonly attribute Float32Array matrix; - - XRRigidTransform inverse(); + readonly attribute XRRigidTransform inverse; }; [SecureContext, Exposed=Window,
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any-expected.txt new file mode 100644 index 0000000..0ad6737 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +PASS ReadableStream teeing: rs.tee() returns an array of two ReadableStreams +PASS ReadableStream teeing: should be able to read one branch to the end without affecting the other +PASS ReadableStream teeing: values should be equal across each branch +PASS ReadableStream teeing: errors in the source should propagate to both branches +PASS ReadableStream teeing: canceling branch1 should not impact branch2 +PASS ReadableStream teeing: canceling branch2 should not impact branch1 +PASS ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array +PASS ReadableStream teeing: canceling both branches in reverse order should aggregate the cancel reasons into an array +PASS ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches +PASS ReadableStream teeing: erroring a teed stream should properly handle canceled branches +PASS ReadableStream teeing: erroring a teed stream should error both branches +PASS ReadableStream teeing: closing the original should immediately close the branches +PASS ReadableStream teeing: erroring the original should immediately error the branches +PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object +FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected 1 got 2 +PASS ReadableStreamTee should only pull enough to fill the emptiest queue +PASS ReadableStreamTee should not pull when original is already errored +FAIL ReadableStreamTee stops pulling when original stream errors while branch 1 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while branch 2 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while both branches are reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.js b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.js index ba78136..4a07f0f 100644 --- a/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.js +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.js
@@ -1,6 +1,7 @@ // META: global=worker,jsshell // META: script=../resources/rs-utils.js // META: script=../resources/test-utils.js +// META: script=../resources/recording-streams.js 'use strict'; test(() => { @@ -158,7 +159,7 @@ }) ]); -}, 'ReadableStream teeing: canceling branch2 should not impact branch2'); +}, 'ReadableStream teeing: canceling branch2 should not impact branch1'); promise_test(() => { @@ -340,3 +341,111 @@ assert_not_equals(getReader.call(rs2), undefined, 'getReader should work on rs2'); }, 'ReadableStreamTee should not use a modified ReadableStream constructor from the global object'); + +promise_test(t => { + + const rs = recordingReadableStream({}, { highWaterMark: 0 }); + + // Create two branches, each with a HWM of 1. This should result in one + // chunk being pulled, not two. + rs.tee(); + return flushAsyncEvents().then(() => { + assert_array_equals(rs.events, ['pull'], 'pull should only be called once'); + }); + +}, 'ReadableStreamTee should not pull more chunks than can fit in the branch queue'); + +promise_test(t => { + + const rs = recordingReadableStream({ + pull(controller) { + controller.enqueue('a'); + } + }, { highWaterMark: 0 }); + + const [reader1, reader2] = rs.tee().map(branch => branch.getReader()); + return Promise.all([reader1.read(), reader2.read()]) + .then(() => { + assert_array_equals(rs.events, ['pull', 'pull'], 'pull should be called twice'); + }); + +}, 'ReadableStreamTee should only pull enough to fill the emptiest queue'); + +promise_test(t => { + + const rs = recordingReadableStream({}, { highWaterMark: 0 }); + const theError = { name: 'boo!' }; + + rs.controller.error(theError); + + const [reader1, reader2] = rs.tee().map(branch => branch.getReader()); + + return flushAsyncEvents().then(() => { + assert_array_equals(rs.events, [], 'pull should not be called'); + + return Promise.all([ + promise_rejects(t, theError, reader1.closed), + promise_rejects(t, theError, reader2.closed) + ]); + }); + +}, 'ReadableStreamTee should not pull when original is already errored'); + +for (const branch of [1, 2]) { + promise_test(t => { + + const rs = recordingReadableStream({}, { highWaterMark: 0 }); + const theError = { name: 'boo!' }; + + const [reader1, reader2] = rs.tee().map(branch => branch.getReader()); + + return flushAsyncEvents().then(() => { + assert_array_equals(rs.events, ['pull'], 'pull should be called once'); + + rs.controller.enqueue('a'); + + const reader = (branch === 1) ? reader1 : reader2; + return reader.read(); + }).then(() => flushAsyncEvents()).then(() => { + assert_array_equals(rs.events, ['pull', 'pull'], 'pull should be called twice'); + + rs.controller.error(theError); + + return Promise.all([ + promise_rejects(t, theError, reader1.closed), + promise_rejects(t, theError, reader2.closed) + ]); + }).then(() => flushAsyncEvents()).then(() => { + assert_array_equals(rs.events, ['pull', 'pull'], 'pull should be called twice'); + }); + + }, `ReadableStreamTee stops pulling when original stream errors while branch ${branch} is reading`); +} + +promise_test(t => { + + const rs = recordingReadableStream({}, { highWaterMark: 0 }); + const theError = { name: 'boo!' }; + + const [reader1, reader2] = rs.tee().map(branch => branch.getReader()); + + return flushAsyncEvents().then(() => { + assert_array_equals(rs.events, ['pull'], 'pull should be called once'); + + rs.controller.enqueue('a'); + + return Promise.all([reader1.read(), reader2.read()]); + }).then(() => flushAsyncEvents()).then(() => { + assert_array_equals(rs.events, ['pull', 'pull'], 'pull should be called twice'); + + rs.controller.error(theError); + + return Promise.all([ + promise_rejects(t, theError, reader1.closed), + promise_rejects(t, theError, reader2.closed) + ]); + }).then(() => flushAsyncEvents()).then(() => { + assert_array_equals(rs.events, ['pull', 'pull'], 'pull should be called twice'); + }); + +}, 'ReadableStreamTee stops pulling when original stream errors while both branches are reading');
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.serviceworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.serviceworker-expected.txt new file mode 100644 index 0000000..0ad6737 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.serviceworker-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +PASS ReadableStream teeing: rs.tee() returns an array of two ReadableStreams +PASS ReadableStream teeing: should be able to read one branch to the end without affecting the other +PASS ReadableStream teeing: values should be equal across each branch +PASS ReadableStream teeing: errors in the source should propagate to both branches +PASS ReadableStream teeing: canceling branch1 should not impact branch2 +PASS ReadableStream teeing: canceling branch2 should not impact branch1 +PASS ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array +PASS ReadableStream teeing: canceling both branches in reverse order should aggregate the cancel reasons into an array +PASS ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches +PASS ReadableStream teeing: erroring a teed stream should properly handle canceled branches +PASS ReadableStream teeing: erroring a teed stream should error both branches +PASS ReadableStream teeing: closing the original should immediately close the branches +PASS ReadableStream teeing: erroring the original should immediately error the branches +PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object +FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected 1 got 2 +PASS ReadableStreamTee should only pull enough to fill the emptiest queue +PASS ReadableStreamTee should not pull when original is already errored +FAIL ReadableStreamTee stops pulling when original stream errors while branch 1 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while branch 2 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while both branches are reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.sharedworker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.sharedworker-expected.txt new file mode 100644 index 0000000..0ad6737 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.sharedworker-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +PASS ReadableStream teeing: rs.tee() returns an array of two ReadableStreams +PASS ReadableStream teeing: should be able to read one branch to the end without affecting the other +PASS ReadableStream teeing: values should be equal across each branch +PASS ReadableStream teeing: errors in the source should propagate to both branches +PASS ReadableStream teeing: canceling branch1 should not impact branch2 +PASS ReadableStream teeing: canceling branch2 should not impact branch1 +PASS ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array +PASS ReadableStream teeing: canceling both branches in reverse order should aggregate the cancel reasons into an array +PASS ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches +PASS ReadableStream teeing: erroring a teed stream should properly handle canceled branches +PASS ReadableStream teeing: erroring a teed stream should error both branches +PASS ReadableStream teeing: closing the original should immediately close the branches +PASS ReadableStream teeing: erroring the original should immediately error the branches +PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object +FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected 1 got 2 +PASS ReadableStreamTee should only pull enough to fill the emptiest queue +PASS ReadableStreamTee should not pull when original is already errored +FAIL ReadableStreamTee stops pulling when original stream errors while branch 1 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while branch 2 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while both branches are reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.worker-expected.txt new file mode 100644 index 0000000..0ad6737 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/streams/readable-streams/tee.any.worker-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +PASS ReadableStream teeing: rs.tee() returns an array of two ReadableStreams +PASS ReadableStream teeing: should be able to read one branch to the end without affecting the other +PASS ReadableStream teeing: values should be equal across each branch +PASS ReadableStream teeing: errors in the source should propagate to both branches +PASS ReadableStream teeing: canceling branch1 should not impact branch2 +PASS ReadableStream teeing: canceling branch2 should not impact branch1 +PASS ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array +PASS ReadableStream teeing: canceling both branches in reverse order should aggregate the cancel reasons into an array +PASS ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches +PASS ReadableStream teeing: erroring a teed stream should properly handle canceled branches +PASS ReadableStream teeing: erroring a teed stream should error both branches +PASS ReadableStream teeing: closing the original should immediately close the branches +PASS ReadableStream teeing: erroring the original should immediately error the branches +PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object +FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected 1 got 2 +PASS ReadableStreamTee should only pull enough to fill the emptiest queue +PASS ReadableStreamTee should not pull when original is already errored +FAIL ReadableStreamTee stops pulling when original stream errors while branch 1 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while branch 2 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while both branches are reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/tools/ci/action_manifest_build.sh b/third_party/blink/web_tests/external/wpt/tools/ci/action_manifest_build.sh deleted file mode 100755 index ad6a4cb..0000000 --- a/third_party/blink/web_tests/external/wpt/tools/ci/action_manifest_build.sh +++ /dev/null
@@ -1,11 +0,0 @@ -#!/bin/bash -set -ex - -mkdir -p ~/meta - -WPT_MANIFEST_FILE=~/meta/MANIFEST.json - -./wpt manifest -p $WPT_MANIFEST_FILE -gzip -k -f --best $WPT_MANIFEST_FILE -bzip2 -k -f --best $WPT_MANIFEST_FILE -zstd -k -f --ultra -22 $WPT_MANIFEST_FILE
diff --git a/third_party/blink/web_tests/external/wpt/tools/ci/ci_lint.sh b/third_party/blink/web_tests/external/wpt/tools/ci/ci_lint.sh deleted file mode 100755 index bf98f20..0000000 --- a/third_party/blink/web_tests/external/wpt/tools/ci/ci_lint.sh +++ /dev/null
@@ -1,10 +0,0 @@ -#!/bin/bash -set -ex - -SCRIPT_DIR=$(cd $(dirname "$0") && pwd -P) -WPT_ROOT=$SCRIPT_DIR/../.. -cd $WPT_ROOT - -mkdir -p ~/meta -./wpt manifest -p ~/meta/MANIFEST.json -./wpt lint --all
diff --git a/third_party/blink/web_tests/external/wpt/tools/ci/tag_master.py b/third_party/blink/web_tests/external/wpt/tools/ci/manifest_build.py similarity index 79% rename from third_party/blink/web_tests/external/wpt/tools/ci/tag_master.py rename to third_party/blink/web_tests/external/wpt/tools/ci/manifest_build.py index d672d13..98e7ce7 100644 --- a/third_party/blink/web_tests/external/wpt/tools/ci/tag_master.py +++ b/third_party/blink/web_tests/external/wpt/tools/ci/manifest_build.py
@@ -1,6 +1,7 @@ import json import logging import os +import subprocess import sys import requests @@ -17,6 +18,32 @@ logger = logging.getLogger(__name__) +class Status(object): + SUCCESS = 0 + FAIL = 1 + NEUTRAL = 78 + + +def run(cmd, return_stdout=False, **kwargs): + logger.info(" ".join(cmd)) + if return_stdout: + f = subprocess.check_output + else: + f = subprocess.check_call + return f(cmd, **kwargs) + + +def create_manifest(path): + run(["./wpt", "manifest", "-p", path]) + + +def compress_manifest(path): + for args in [["gzip", "-k", "-f", "--best"], + ["bzip2", "-k", "-f", "--best"], + ["zstd", "-k", "-f", "--ultra", "-22"]]: + run(args + [path]) + + def request(url, desc, data=None, json_data=None, params=None, headers=None): github_token = os.environ.get("GITHUB_TOKEN") default_headers = { @@ -92,7 +119,7 @@ return True -def create_release(owner, repo, sha, tag, summary, body): +def create_release(manifest_path, owner, repo, sha, tag, summary, body): if body: body = "%s\n%s" % (summary, body) else: @@ -117,7 +144,7 @@ params = {"name": upload_filename, "label": "MANIFEST.json%s" % upload_ext} - with open(os.path.expanduser("~/meta/MANIFEST.json%s" % upload_ext), "rb") as f: + with open("%s%s" % (manifest_path, upload_ext), "rb") as f: upload_data = f.read() logger.info("Uploading %s bytes" % len(upload_data)) @@ -148,7 +175,7 @@ repo_key = "GITHUB_REPOSITORY" if not should_run_action(): - return + return Status.NEUTRAL owner, repo = os.environ[repo_key].split("/", 1) @@ -162,16 +189,28 @@ else: tag_name = "merge_pr_%s" % pr + manifest_path = os.path.expanduser(os.path.join("~", "meta", "MANIFEST.json")) + + os.makedirs(os.path.dirname(manifest_path)) + + create_manifest(manifest_path) + + compress_manifest(manifest_path) + tagged = tag(owner, repo, head_rev, tag_name) if not tagged: - sys.exit(1) + return Status.FAIL summary = git("show", "--no-patch", '--format="%s"', "HEAD") body = git("show", "--no-patch", '--format="%b"', "HEAD") - if not create_release(owner, repo, head_rev, tag_name, summary, body): - sys.exit(1) + if not create_release(manifest_path, owner, repo, head_rev, tag_name, summary, body): + return Status.FAIL + + return Status.SUCCESS if __name__ == "__main__": - main() + code = main() + assert isinstance(code, int) + sys.exit(code)
diff --git a/third_party/blink/web_tests/external/wpt/tools/ci/run_tc.py b/third_party/blink/web_tests/external/wpt/tools/ci/run_tc.py index 32eef7c..e03c1e1 100755 --- a/third_party/blink/web_tests/external/wpt/tools/ci/run_tc.py +++ b/third_party/blink/web_tests/external/wpt/tools/ci/run_tc.py
@@ -260,6 +260,8 @@ job = args.job + print("Job %s" % job) + run_if = [(lambda: job == "all", "job set to 'all'"), (lambda:"all" in extra_jobs, "Manually specified jobs includes 'all'"), (lambda:job in extra_jobs, "Manually specified jobs includes '%s'" % job),
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt b/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt index f2a3368..67cb0e6c 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt
@@ -2,7 +2,7 @@ mozinfo==0.10 mozlog==4.0 mozdebug==0.1.1 -pillow==5.4.1 +pillow==6.0.0 urllib3[secure]==1.24.1 requests==2.21.0 six>=1.8
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/parser.py b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/parser.py index e6c2e5b..b16d96a4 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/parser.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/parser.py
@@ -14,7 +14,7 @@ from __future__ import unicode_literals -from six.moves import cStringIO as StringIO +from six import binary_type, text_type, BytesIO from .node import (AtomNode, BinaryExpressionNode, BinaryOperatorNode, ConditionalNode, DataNode, IndexNode, KeyValueNode, ListNode, @@ -49,7 +49,7 @@ "Reset": object()} def decode(s): - assert isinstance(s, unicode) + assert isinstance(s, text_type) return s @@ -77,9 +77,9 @@ def tokenize(self, stream): self.reset() - assert not isinstance(stream, unicode) - if isinstance(stream, str): - stream = StringIO(stream) + assert not isinstance(stream, text_type) + if isinstance(stream, bytes): + stream = BytesIO(stream) if not hasattr(stream, "name"): self.filename = "" else: @@ -87,7 +87,7 @@ self.next_line_state = self.line_start_state for i, line in enumerate(stream): - assert isinstance(line, str) + assert isinstance(line, binary_type) self.state = self.next_line_state assert self.state is not None states = [] @@ -95,7 +95,7 @@ self.line_number = i + 1 self.index = 0 self.line = line.decode('utf-8').rstrip() - assert isinstance(self.line, unicode) + assert isinstance(self.line, text_type) while self.state != self.eol_state: states.append(self.state) tokens = self.state()
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py index b7c62c00..40a8acc 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/wptrunner/wptmanifest/tests/test_tokenizer.py
@@ -1,22 +1,15 @@ -import sys -import pytest import unittest -from six.moves import cStringIO as StringIO - from .. import parser from ..parser import token_types - -@pytest.mark.xfail(sys.version[0] == "3", - reason="Tokenizer doesn't support py3") class TokenizerTest(unittest.TestCase): def setUp(self): self.tokenizer = parser.Tokenizer() def tokenize(self, input_str): rv = [] - for item in self.tokenizer.tokenize(StringIO(input_str)): + for item in self.tokenizer.tokenize(input_str): rv.append(item) if item[0] == token_types.eof: break @@ -25,128 +18,128 @@ def compare(self, input_text, expected): expected = expected + [(token_types.eof, None)] actual = self.tokenize(input_text) - self.assertEquals(actual, expected) + self.assertEqual(actual, expected) def test_heading_0(self): - self.compare("""[Heading text]""", + self.compare(b"""[Heading text]""", [(token_types.paren, "["), (token_types.string, "Heading text"), (token_types.paren, "]")]) def test_heading_1(self): - self.compare("""[Heading [text\]]""", + self.compare(b"""[Heading [text\]]""", [(token_types.paren, "["), (token_types.string, "Heading [text]"), (token_types.paren, "]")]) def test_heading_2(self): - self.compare("""[Heading #text]""", + self.compare(b"""[Heading #text]""", [(token_types.paren, "["), (token_types.string, "Heading #text"), (token_types.paren, "]")]) def test_heading_3(self): - self.compare("""[Heading [\]text]""", + self.compare(b"""[Heading [\]text]""", [(token_types.paren, "["), (token_types.string, "Heading []text"), (token_types.paren, "]")]) def test_heading_4(self): with self.assertRaises(parser.ParseError): - self.tokenize("[Heading") + self.tokenize(b"[Heading") def test_heading_5(self): - self.compare("""[Heading [\]text] #comment""", + self.compare(b"""[Heading [\]text] #comment""", [(token_types.paren, "["), (token_types.string, "Heading []text"), (token_types.paren, "]")]) def test_heading_6(self): - self.compare(r"""[Heading \ttext]""", + self.compare(br"""[Heading \ttext]""", [(token_types.paren, "["), (token_types.string, "Heading \ttext"), (token_types.paren, "]")]) def test_key_0(self): - self.compare("""key:value""", + self.compare(b"""key:value""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "value")]) def test_key_1(self): - self.compare("""key : value""", + self.compare(b"""key : value""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "value")]) def test_key_2(self): - self.compare("""key : val ue""", + self.compare(b"""key : val ue""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "val ue")]) def test_key_3(self): - self.compare("""key: value#comment""", + self.compare(b"""key: value#comment""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "value")]) def test_key_4(self): with self.assertRaises(parser.ParseError): - self.tokenize("""ke y: value""") + self.tokenize(b"""ke y: value""") def test_key_5(self): with self.assertRaises(parser.ParseError): - self.tokenize("""key""") + self.tokenize(b"""key""") def test_key_6(self): - self.compare("""key: "value\"""", + self.compare(b"""key: "value\"""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "value")]) def test_key_7(self): - self.compare("""key: 'value'""", + self.compare(b"""key: 'value'""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "value")]) def test_key_8(self): - self.compare("""key: "#value\"""", + self.compare(b"""key: "#value\"""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "#value")]) def test_key_9(self): - self.compare("""key: '#value\'""", + self.compare(b"""key: '#value\'""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, "#value")]) def test_key_10(self): with self.assertRaises(parser.ParseError): - self.tokenize("""key: "value""") + self.tokenize(b"""key: "value""") def test_key_11(self): with self.assertRaises(parser.ParseError): - self.tokenize("""key: 'value""") + self.tokenize(b"""key: 'value""") def test_key_12(self): with self.assertRaises(parser.ParseError): - self.tokenize("""key: 'value""") + self.tokenize(b"""key: 'value""") def test_key_13(self): with self.assertRaises(parser.ParseError): - self.tokenize("""key: 'value' abc""") + self.tokenize(b"""key: 'value' abc""") def test_key_14(self): - self.compare(r"""key: \\nb""", + self.compare(br"""key: \\nb""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.string, r"\nb")]) def test_list_0(self): - self.compare(""" + self.compare(b""" key: []""", [(token_types.string, "key"), (token_types.separator, ":"), @@ -154,7 +147,7 @@ (token_types.list_end, "]")]) def test_list_1(self): - self.compare(""" + self.compare(b""" key: [a, "b"]""", [(token_types.string, "key"), (token_types.separator, ":"), @@ -164,7 +157,7 @@ (token_types.list_end, "]")]) def test_list_2(self): - self.compare(""" + self.compare(b""" key: [a, b]""", [(token_types.string, "key"), @@ -175,7 +168,7 @@ (token_types.list_end, "]")]) def test_list_3(self): - self.compare(""" + self.compare(b""" key: [a, #b] c]""", [(token_types.string, "key"), @@ -187,16 +180,16 @@ def test_list_4(self): with self.assertRaises(parser.ParseError): - self.tokenize("""key: [a #b] + self.tokenize(b"""key: [a #b] c]""") def test_list_5(self): with self.assertRaises(parser.ParseError): - self.tokenize("""key: [a \\ + self.tokenize(b"""key: [a \\ c]""") def test_list_6(self): - self.compare("""key: [a , b]""", + self.compare(b"""key: [a , b]""", [(token_types.string, "key"), (token_types.separator, ":"), (token_types.list_start, "["), @@ -205,7 +198,7 @@ (token_types.list_end, "]")]) def test_expr_0(self): - self.compare(""" + self.compare(b""" key: if cond == 1: value""", [(token_types.string, "key"), @@ -219,7 +212,7 @@ (token_types.string, "value")]) def test_expr_1(self): - self.compare(""" + self.compare(b""" key: if cond == 1: value1 value2""", @@ -235,7 +228,7 @@ (token_types.string, "value2")]) def test_expr_2(self): - self.compare(""" + self.compare(b""" key: if cond=="1": value""", [(token_types.string, "key"), @@ -249,7 +242,7 @@ (token_types.string, "value")]) def test_expr_3(self): - self.compare(""" + self.compare(b""" key: if cond==1.1: value""", [(token_types.string, "key"), @@ -263,7 +256,7 @@ (token_types.string, "value")]) def test_expr_4(self): - self.compare(""" + self.compare(b""" key: if cond==1.1 and cond2 == "a": value""", [(token_types.string, "key"), @@ -281,7 +274,7 @@ (token_types.string, "value")]) def test_expr_5(self): - self.compare(""" + self.compare(b""" key: if (cond==1.1 ): value""", [(token_types.string, "key"), @@ -297,7 +290,7 @@ (token_types.string, "value")]) def test_expr_6(self): - self.compare(""" + self.compare(b""" key: if "\\ttest": value""", [(token_types.string, "key"), @@ -310,27 +303,24 @@ def test_expr_7(self): with self.assertRaises(parser.ParseError): - self.tokenize( - """ + self.tokenize(b""" key: if 1A: value""") def test_expr_8(self): with self.assertRaises(parser.ParseError): - self.tokenize( - """ + self.tokenize(b""" key: if 1a: value""") def test_expr_9(self): with self.assertRaises(parser.ParseError): - self.tokenize( - """ + self.tokenize(b""" key: if 1.1.1: value""") def test_expr_10(self): - self.compare(""" + self.compare(b""" key: if 1.: value""", [(token_types.string, "key"),
diff --git a/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any-expected.txt b/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any-expected.txt index aed73b7..ca88133a 100644 --- a/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any-expected.txt +++ b/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any-expected.txt
@@ -1,4 +1,24 @@ This is a testharness.js-based test. -FAIL idl_test setup promise_test: Unhandled rejection with value: object "WakeLockPermissionDescriptor inherits PermissionDescriptor, but PermissionDescriptor is undefined." +PASS idl_test setup +PASS WakeLock interface: existence and properties of interface object +FAIL WakeLock interface object length assert_equals: wrong value for WakeLock.length expected 1 but got 0 +PASS WakeLock interface object name +PASS WakeLock interface: existence and properties of interface prototype object +PASS WakeLock interface: existence and properties of interface prototype object's "constructor" property +PASS WakeLock interface: existence and properties of interface prototype object's @@unscopables property +FAIL WakeLock interface: operation requestPermission(WakeLockType) assert_own_property: interface object missing static operation expected property "requestPermission" missing +PASS WakeLock interface: attribute type +PASS WakeLock interface: attribute active +PASS WakeLock interface: attribute onactivechange +FAIL WakeLock interface: operation request(WakeLockRequestOptions) assert_own_property: interface prototype object missing non-static operation expected property "request" missing +FAIL WakeLock must be primary interface of new WakeLock("screen") assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL Stringification of new WakeLock("screen") assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "requestPermission(WakeLockType)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL WakeLock interface: calling requestPermission(WakeLockType) on new WakeLock("screen") with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "active" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "onactivechange" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "request(WakeLockRequestOptions)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" +FAIL WakeLock interface: calling request(WakeLockRequestOptions) on new WakeLock("screen") with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "TypeError: Illegal constructor" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.js b/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.js index 5e3ae750..fa47bd9 100644 --- a/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.js +++ b/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.js
@@ -7,7 +7,7 @@ idl_test( ['wake-lock'], - ['dom', 'html'], + ['dom', 'html', 'permissions'], idl_array => { idl_array.add_objects({ WakeLock: ['new WakeLock("screen")']
diff --git a/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.worker-expected.txt b/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.worker-expected.txt index aed73b7..78381b7 100644 --- a/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.worker-expected.txt +++ b/third_party/blink/web_tests/external/wpt/wake-lock/idlharness.https.any.worker-expected.txt
@@ -1,4 +1,23 @@ This is a testharness.js-based test. -FAIL idl_test setup promise_test: Unhandled rejection with value: object "WakeLockPermissionDescriptor inherits PermissionDescriptor, but PermissionDescriptor is undefined." +PASS idl_test setup +FAIL WakeLock interface: existence and properties of interface object assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface object length assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface object name assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface: existence and properties of interface prototype object assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface: member requestPermission Cannot use 'in' operator to search for 'requestPermission' in undefined +FAIL WakeLock interface: attribute type assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface: attribute active assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface: attribute onactivechange assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock interface: operation request(WakeLockRequestOptions) assert_own_property: self does not have own property "WakeLock" expected property "WakeLock" missing +FAIL WakeLock must be primary interface of new WakeLock("screen") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" +FAIL Stringification of new WakeLock("screen") assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" +FAIL WakeLock interface: new WakeLock("screen") must not have property "requestPermission" assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "type" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "active" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "onactivechange" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" +FAIL WakeLock interface: new WakeLock("screen") must inherit property "request(WakeLockRequestOptions)" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" +FAIL WakeLock interface: calling request(WakeLockRequestOptions) on new WakeLock("screen") with too few arguments must throw TypeError assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: WakeLock is not defined" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/webrtc/RTCDataChannel-id-expected.txt b/third_party/blink/web_tests/external/wpt/webrtc/RTCDataChannel-id-expected.txt deleted file mode 100644 index d7f04467..0000000 --- a/third_party/blink/web_tests/external/wpt/webrtc/RTCDataChannel-id-expected.txt +++ /dev/null
@@ -1,7 +0,0 @@ -This is a testharness.js-based test. -PASS DTLS client uses odd data channel IDs -PASS DTLS server uses even data channel IDs -FAIL In-band negotiation with a specific ID should not work assert_equals: expected (object) null but got (number) 42 -PASS Odd/even role should not be violated when mixing with negotiated channels -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel-expected.txt b/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel-expected.txt index 4064e79e0..05ab536 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel-expected.txt
@@ -24,7 +24,8 @@ PASS createDataChannel with id 1 should succeed FAIL createDataChannel with id 65534 should succeed Failed to execute 'createDataChannel' on 'RTCPeerConnection': RTCDataChannel is not supported PASS createDataChannel with id -1 should throw TypeError -FAIL createDataChannel with id 65535 should throw TypeError assert_throws: function "() => pc.createDataChannel('', { id })" threw object "NotSupportedError: Failed to execute 'createDataChannel' on 'RTCPeerConnection': RTCDataChannel is not supported" ("NotSupportedError") expected object "TypeError" ("TypeError") +FAIL createDataChannel with id 65535 should throw TypeError assert_throws: function "() => pc.createDataChannel('', + { 'negotiated': true, 'id': id })" threw object "NotSupportedError: Failed to execute 'createDataChannel' on 'RTCPeerConnection': RTCDataChannel is not supported" ("NotSupportedError") expected object "TypeError" ("TypeError") PASS createDataChannel with id 65536 should throw TypeError FAIL createDataChannel with priority "high" should succeed assert_equals: expected (string) "high" but got (undefined) undefined FAIL createDataChannel with invalid priority should throw TypeError assert_throws: function "() => pc.createDataChannel('', { priority: 'invalid' })" did not throw @@ -44,7 +45,7 @@ })" did not throw PASS createDataChannel with maximum length label and protocol should succeed PASS createDataChannel with negotiated false should succeed -FAIL createDataChannel with negotiated false and id 42 should ignore the id assert_equals: Expect dc.id to be ignored (null) expected (object) null but got (number) 42 +PASS createDataChannel with negotiated false and id 42 should ignore the id FAIL createDataChannel with negotiated true and id not defined should throw TypeError assert_throws: function "() => pc.createDataChannel('test', { negotiated: true
diff --git a/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel.html b/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel.html index ae74b62..3cdba83 100644 --- a/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel.html +++ b/third_party/blink/web_tests/external/wpt/webrtc/RTCPeerConnection-createDataChannel.html
@@ -323,7 +323,7 @@ const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); - const dc = pc.createDataChannel('', { id }); + const dc = pc.createDataChannel('', { 'negotiated': true, 'id': id }); assert_equals(dc.id, id); }, `createDataChannel with id ${id} should succeed`); } @@ -333,7 +333,8 @@ const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); - assert_throws(new TypeError(), () => pc.createDataChannel('', { id })); + assert_throws(new TypeError(), () => pc.createDataChannel('', + { 'negotiated': true, 'id': id })); }, `createDataChannel with id ${id} should throw TypeError`); }
diff --git a/third_party/blink/web_tests/external/wpt/webxr/idlharness.https.window-expected.txt b/third_party/blink/web_tests/external/wpt/webxr/idlharness.https.window-expected.txt index b9df588..65bc029 100644 --- a/third_party/blink/web_tests/external/wpt/webxr/idlharness.https.window-expected.txt +++ b/third_party/blink/web_tests/external/wpt/webxr/idlharness.https.window-expected.txt
@@ -1,5 +1,5 @@ This is a testharness.js-based test. -Found 216 tests; 203 PASS, 13 FAIL, 0 TIMEOUT, 0 NOTRUN. +Found 216 tests; 202 PASS, 14 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idl_test setup PASS Partial interface Navigator: original interface defined PASS Partial dictionary WebGLContextAttributes: original dictionary defined @@ -124,7 +124,7 @@ PASS XRRigidTransform interface: attribute position PASS XRRigidTransform interface: attribute orientation PASS XRRigidTransform interface: attribute matrix -PASS XRRigidTransform interface: operation inverse() +FAIL XRRigidTransform interface: attribute inverse assert_throws: getting property on prototype object must throw TypeError function "function () { [native code] }" did not throw PASS XRRay interface: existence and properties of interface object PASS XRRay interface object length PASS XRRay interface object name
diff --git a/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scrolled-document.html b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scrolled-document.html new file mode 100644 index 0000000..6a01618c --- /dev/null +++ b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scrolled-document.html
@@ -0,0 +1,110 @@ +<!DOCTYPE html> +<script src='../../resources/testharness.js'></script> +<script src='../../resources/testharnessreport.js'></script> +<script src='../../resources/gesture-util.js'></script> + +<style> + body, html { + margin: 0; + } + + #fixed { + position: fixed; + width: 80%; + height: 80%; + top: 10%; + left: 10%; + padding: 20px; + box-sizing: border-box; + background-color: PaleTurquoise; + } + + #instructions { + width: 100%; + text-align: center; + } + + #scroller { + position: absolute; + border: 5px solid salmon; + clip: rect(0px, 1000px, 500px, 0px); + width: 90%; + height: 150px; + overflow-y: scroll; + } + + .spacer { + height: 400%; + background:repeating-linear-gradient(#FFF 0%, #FFF 10%, #000 10%, #000 20%); + } +</style> + +<div id="fixed"> + <div id="instructions"> + <p> + This turquoise box is a position: fixed box. The black-and-white scroller + beelow has a clip region so should be non-composited. The document has + scrolling of its own. + </p> + <p> + Scroll the document down (nothing will move since this box is position: + fixed). Now attempt to scroll over the black-and-white scroller with + wheel or touch. If the box scrolls, the test passes. The document must + not scroll. + </p> + </div> + <div id="scroller"> + <div class="spacer"></div> + </div> +</div> +<div style="height:1000px"></div> + +<script> + window.onload = async () => { + await waitForCompositorCommit(); + + const scroller = document.getElementById('scroller'); + + promise_test(async () => { + assert_equals(scroller.scrollTop, 0, "Scroller starts off unscrolled."); + assert_equals(window.scrollY, 0, "Window starts off unscrolled."); + + // Scroll over the document so that the page gets scrolled down. + { + const delta = 1000; + const location = { x: 5, y: 5 }; + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + // Ensure we've scrolled more than the scroller height to ensure a + // NonFastScrollableRect bug related to scroll would be reproducible + // over the entire scroller. + assert_greater_than(window.scrollY, 150, + "Document should have been scrolled."); + } + + // Now perform a scroll over the scroller rect. Ensure we targetted the + // correct scroller. + { + const delta = 100; + const location = elementCenter(scroller); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + assert_greater_than(scroller.scrollTop, 0, + "Scroller should be scrolled."); + } + + }, 'Scrolling over an uncomposited scroller inside a composited position' + + ': fixed element.'); + } + +</script>
diff --git a/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scroller-scrolled-document.html b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scroller-scrolled-document.html new file mode 100644 index 0000000..2dc6c874 --- /dev/null +++ b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scroller-scrolled-document.html
@@ -0,0 +1,113 @@ +<!DOCTYPE html> +<script src='../../resources/testharness.js'></script> +<script src='../../resources/testharnessreport.js'></script> +<script src='../../resources/gesture-util.js'></script> + +<style> + body, html { + margin: 0; + } + + #fixed { + position: fixed; + width: 80%; + height: 80%; + top: 10%; + left: 10%; + padding: 20px; + box-sizing: border-box; + background-color: PaleTurquoise; + overflow-y: scroll; + } + + #instructions { + width: 100%; + text-align: center; + } + + #scroller { + position: absolute; + border: 5px solid salmon; + clip: rect(0px, 1000px, 500px, 0px); + width: 90%; + height: 150px; + overflow-y: scroll; + } + + .spacer { + height: 400%; + background:repeating-linear-gradient(#FFF 0%, #FFF 10%, #000 10%, #000 20%); + + } +</style> + +<div id="fixed"> + <div id="instructions"> + <p> + This turquoise box is a position: fixed box. The black-and-white scroller + beelow has a clip region so should be non-composited. The document has + scrolling of its own. + </p> + <p> + Scroll the document down (nothing will move since this box is position: + fixed). Now attempt to scroll over the black-and-white scroller with + wheel or touch. If the box scrolls, the test passes. The document must + not scroll. + </p> + </div> + <div id="scroller"> + <div class="spacer"></div> + </div> + <div style="height:1000px"></div> +</div> +<div style="height:1000px"></div> + +<script> + window.onload = async () => { + await waitForCompositorCommit(); + + const scroller = document.getElementById('scroller'); + + promise_test(async () => { + assert_equals(scroller.scrollTop, 0, "Scroller starts off unscrolled."); + assert_equals(window.scrollY, 0, "Window starts off unscrolled."); + + // Scroll over the document so that the page gets scrolled down. + { + const delta = 1000; + const location = { x: 5, y: 5 }; + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + // Ensure we've scrolled more than the scroller height to ensure a + // NonFastScrollableRect bug related to scroll would be reproducible + // over the entire scroller. + assert_greater_than(window.scrollY, 150, + "Document should have been scrolled."); + } + + // Now perform a scroll over the scroller rect. Ensure we targetted the + // correct scroller. + { + const delta = 100; + const location = elementCenter(scroller); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + assert_greater_than(scroller.scrollTop, 0, + "Scroller should be scrolled."); + } + + }, 'Scrolling over an uncomposited scroller inside a composited position' + + ': fixed element.'); + } + +</script>
diff --git a/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scroller.html b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scroller.html new file mode 100644 index 0000000..00e52a9 --- /dev/null +++ b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-position-fixed-scroller.html
@@ -0,0 +1,86 @@ +<!DOCTYPE html> +<script src='../../resources/testharness.js'></script> +<script src='../../resources/testharnessreport.js'></script> +<script src='../../resources/gesture-util.js'></script> + +<style> + body, html { + margin: 0; + } + + #fixed { + position: fixed; + width: 80%; + height: 80%; + top: 10%; + left: 10%; + padding: 20px; + box-sizing: border-box; + background-color: PaleTurquoise; + overflow-y: scroll; + } + + #instructions { + width: 100%; + height: 100px; + text-align: center; + } + + #scroller { + position: absolute; + border: 5px solid salmon; + clip: rect(0px, 1000px, 500px, 0px); + width: 90%; + height: 300px; + overflow-y: scroll; + } + + .spacer { + height: 400%; + background:repeating-linear-gradient(#FFF 0%, #FFF 10%, #000 10%, #000 20%); + + } +</style> + +<div id="fixed"> + <div id="instructions"> + This turquoise box is a position: fixed scroller. The black-and-white + scroller beelow has a clip region so should be non-composited. Attempt to + scroll over the black-and-white scroller with wheel or touch. If the box + scrolls, the test passes. This turquoise scroller must not scroll. + </div> + <div id="scroller"> + <div class="spacer"></div> + </div> + <div style="height:1000px"></div> +</div> + +<script> + window.onload = async () => { + await waitForCompositorCommit(); + + const scroller = document.getElementById('scroller'); + const fixed = document.getElementById('fixed'); + + promise_test(async () => { + assert_equals(scroller.scrollTop, 0, "Scroller starts off unscrolled."); + assert_equals(fixed.scrollTop, 0, "Fixed starts off unscrolled."); + + const delta = 100; + const location = elementCenter(scroller); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + assert_greater_than(scroller.scrollTop, 0, + "Scroller should be scrolled by events over it."); + assert_equals(fixed.scrollTop, 0, "Fixed must not have scrolled."); + + }, 'Scrolling over an uncomposited scrolling inside a fixed-composited ' + + 'scroller.'); + } + +</script>
diff --git a/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-scrolled-absolute-scroller.html b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-scrolled-absolute-scroller.html new file mode 100644 index 0000000..d1ee2c1 --- /dev/null +++ b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-scrolled-absolute-scroller.html
@@ -0,0 +1,111 @@ +<!DOCTYPE html> +<script src='../../resources/testharness.js'></script> +<script src='../../resources/testharnessreport.js'></script> +<script src='../../resources/gesture-util.js'></script> + +<style> + body, html { + margin: 0; + } + + #abs { + position: absolute; + width: 80%; + height: 80%; + top: 10%; + left: 10%; + padding: 20px; + box-sizing: border-box; + background-color: PaleTurquoise; + overflow-y: scroll; + } + + #instructions { + width: 100%; + height: 100px; + text-align: center; + } + + #scroller { + position: absolute; + top: 300px; + border: 5px solid salmon; + clip: rect(0px, 1000px, 500px, 0px); + width: 90%; + height: 100px; + overflow-y: scroll; + } + + .spacer { + height: 400%; + background:repeating-linear-gradient(#FFF 0%, #FFF 10%, #000 10%, #000 20%); + + } +</style> + +<div id="abs"> + <div id="instructions"> + <p> + This turquoise box is a position: absolute scroller. The black-and-white + scroller below has a clip region so should be non-composited. + </p> + <p> + Scroll the turquoise box so the black-and-white scroller appears near its + top edge. Now attempt to scroll over the black-and-white scroller with + wheel or touch. If the box scrolls, the test passes. This turquoise + scroller must not scroll. + </p> + </div> + <div id="scroller"> + <div class="spacer"></div> + </div> + <div style="height:1000px"></div> +</div> + +<script> + window.onload = async () => { + await waitForCompositorCommit(); + + const scroller = document.getElementById('scroller'); + const abs = document.getElementById('abs'); + + promise_test(async () => { + assert_equals(scroller.scrollTop, 0, "Scroller must start off unscrolled."); + assert_equals(abs.scrollTop, 0, "Absolute box must start off unscrolled."); + + // Scroll the abs so that the scroller box doesn't overlap at all with + // where it used to be. + { + const delta = scroller.clientHeight * 2; + const location = elementCenter(abs); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + assert_greater_than(abs.scrollTop, scroller.clientHeight, + "Absolute box must be scrolled."); + assert_equals(scroller.scrollTop, 0, + "Scroller must remain unscrolled."); + } + + // Now attempt to scroll over the scroller box. Ensure it scrolls, rather + // than the abs box. + { + const delta = 100; + const location = elementCenter(scroller); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + assert_greater_than(scroller.scrollTop, 0, + "Scroller must be scrolled by events over it."); + } + }, 'Scrolling over an uncomposited scrolling inside a scrolled, absolute,' + + ' composited scroller.'); + } + +</script>
diff --git a/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-scrolled-position-fixed-scroller.html b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-scrolled-position-fixed-scroller.html new file mode 100644 index 0000000..1ce0839 --- /dev/null +++ b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-scrolled-position-fixed-scroller.html
@@ -0,0 +1,111 @@ +<!DOCTYPE html> +<script src='../../resources/testharness.js'></script> +<script src='../../resources/testharnessreport.js'></script> +<script src='../../resources/gesture-util.js'></script> + +<style> + body, html { + margin: 0; + } + + #fixed { + position: fixed; + width: 80%; + height: 80%; + top: 10%; + left: 10%; + padding: 20px; + box-sizing: border-box; + background-color: PaleTurquoise; + overflow-y: scroll; + } + + #instructions { + width: 100%; + height: 100px; + text-align: center; + } + + #scroller { + position: absolute; + top: 300px; + border: 5px solid salmon; + clip: rect(0px, 1000px, 500px, 0px); + width: 90%; + height: 100px; + overflow-y: scroll; + } + + .spacer { + height: 400%; + background:repeating-linear-gradient(#FFF 0%, #FFF 10%, #000 10%, #000 20%); + + } +</style> + +<div id="fixed"> + <div id="instructions"> + <p> + This turquoise box is a position: fixed scroller. The black-and-white + scroller beelow has a clip region so should be non-composited. + </p> + <p> + Scroll the turquoise box so the black-and-white scroller appears near its + top edge. Now attempt to scroll over the black-and-white scroller with + wheel or touch. If the box scrolls, the test passes. This turquoise + scroller must not scroll. + </p> + </div> + <div id="scroller"> + <div class="spacer"></div> + </div> + <div style="height:1000px"></div> +</div> + +<script> + window.onload = async () => { + await waitForCompositorCommit(); + + const scroller = document.getElementById('scroller'); + const fixed = document.getElementById('fixed'); + + promise_test(async () => { + assert_equals(scroller.scrollTop, 0, "Scroller must start off unscrolled."); + assert_equals(fixed.scrollTop, 0, "Fixed must start off unscrolled."); + + // Scroll the fixed so that the scroller box doesn't overlap at all with + // where it used to be. + { + const delta = scroller.clientHeight * 2; + const location = elementCenter(fixed); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + assert_greater_than(fixed.scrollTop, scroller.clientHeight, + "Fixed must be scrolled."); + assert_equals(scroller.scrollTop, 0, + "Scroller must remain unscrolled."); + } + + // Now attempt to scroll over the scroller box. Ensure it scrolls, rather + // than the fixed box. + { + const delta = 100; + const location = elementCenter(scroller); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + assert_greater_than(scroller.scrollTop, 0, + "Scroller must be scrolled by events over it."); + } + }, 'Scrolling over an uncomposited scrolling inside a scrolled, fixed, ' + + 'composited scroller.'); + } + +</script>
diff --git a/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-sticky.html b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-sticky.html new file mode 100644 index 0000000..69df9ed2a --- /dev/null +++ b/third_party/blink/web_tests/fast/scrolling/non-composited-scroller-in-sticky.html
@@ -0,0 +1,157 @@ +<!DOCTYPE html> +<script src='../../resources/testharness.js'></script> +<script src='../../resources/testharnessreport.js'></script> +<script src='../../resources/gesture-util.js'></script> + +<style> + body, html { + margin: 0; + } + + #sticky { + position: sticky; + width: 80%; + height: 400px; + top: 5px; + left: 10%; + padding: 20px; + box-sizing: border-box; + background-color: PaleTurquoise; + } + + #instructions { + width: 100%; + text-align: center; + } + + #scroller { + position: absolute; + border: 5px solid salmon; + clip: rect(0px, 1000px, 500px, 0px); + width: 90%; + height: 150px; + overflow-y: scroll; + } + + .spacer { + height: 400%; + background:repeating-linear-gradient(#FFF 0%, #FFF 10%, #000 10%, #000 20%); + + } +</style> + +<div style="height:300px"></div> +<div id="sticky"> + <div id="instructions"> + <p> + This turquoise box is a position: sticky box. The black-and-white scroller + beelow has a clip region so should be non-composited. The document has + scrolling of its own. + </p> + <p> + Scroll the document down so the turquoise box is not quite aligned with + the viewport top but enough that the scroller below no longer overlaps + its original position. Now attempt to scroll over the black-and-white + scroller with wheel or touch. If box must scroll; the document must not + scroll. + </p> + <p> + Continue to scroll the document down so the turquoise box becomes fixed + to the viewport top. Now attempt to scroll over the black-and-white + scroller with wheel or touch. It should scroll as before, the document + must not scroll. + </p> + </div> + <div id="scroller"> + <div class="spacer"></div> + </div> +</div> +<div style="height:1000px"></div> + +<script> + window.onload = async () => { + await waitForCompositorCommit(); + + const scroller = document.getElementById('scroller'); + + promise_test(async () => { + assert_equals(scroller.scrollTop, 0, "Scroller starts off unscrolled."); + assert_equals(window.scrollY, 0, "Window starts off unscrolled."); + + // Scroll over the document so that the page gets scrolled down. Scroll + // far enough that the scroller no longer overlaps its original position, + // but not so far that the sticky box has become fixed. + { + const delta = scroller.clientHeight * 1.5; + const location = { x: 5, y: 5 }; + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + // Ensure we've scrolled more than the scroller height to ensure a + // NonFastScrollableRect bug related to scroll would be reproducible + // over the entire scroller. + assert_greater_than(window.scrollY, scroller.clientHeight, + "Document should have been scrolled."); + } + + // Now perform a scroll over the scroller rect. Ensure we targetted the + // correct scroller. + { + const delta = 100; + const location = elementCenter(scroller); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + assert_greater_than(scroller.scrollTop, 0, + "Scroller should be scrolled while sticky box is " + + "unfixed."); + } + + // Scroll the document down now until the sticky box becomes fixed. + { + const delta = scroller.clientHeight * 2; + const location = { x: 5, y: 5 }; + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'down', + SPEED_INSTANT); + + // Ensure we've scrolled more than the scroller height to ensure a + // NonFastScrollableRect bug related to scroll would be reproducible + // over the entire scroller. + assert_greater_than(window.scrollY, 300, + "Document should have been scrolled until sticky " + + "box is fixed."); + } + + // Again perform a scroll over the scroller rect. Ensure we targetted the + // correct scroller. + { + const delta = 1000; + const location = elementCenter(scroller); + await smoothScroll(delta, + location.x, + location.y, + GestureSourceType.TOUCH_INPUT, + 'up', + SPEED_INSTANT); + + assert_equals(scroller.scrollTop, 0, + "Scroller should be scrolled when sticky box is fixed."); + } + + }, 'Scrolling over an uncomposited scroller inside a composited position' + + ': sticky element.'); + } + +</script>
diff --git a/third_party/blink/web_tests/flag-specific/disable-perfetto/inspector-protocol/timeline/tracing-proto-format-expected.txt b/third_party/blink/web_tests/flag-specific/disable-perfetto/inspector-protocol/timeline/tracing-proto-format-expected.txt new file mode 100644 index 0000000..e1a7e53 --- /dev/null +++ b/third_party/blink/web_tests/flag-specific/disable-perfetto/inspector-protocol/timeline/tracing-proto-format-expected.txt
@@ -0,0 +1,3 @@ +Tests that tracing with proto format outputs something resembling protos. +Start failed: Proto format is only supported with the perfetto backend. +
diff --git a/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png b/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png new file mode 100644 index 0000000..4c91e98b --- /dev/null +++ b/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.txt b/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.txt new file mode 100644 index 0000000..5f46227 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.txt
@@ -0,0 +1,2 @@ +CONSOLE ERROR: Feature policy violation: unoptimized-lossless-images-strict is not allowed in this document. +CONSOLE ERROR: Feature policy violation: unoptimized-lossless-images-strict is not allowed in this document.
diff --git a/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict.html b/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict.html new file mode 100644 index 0000000..d75cd199 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/images/feature-policy-unoptimized-lossless-images-strict.html
@@ -0,0 +1,7 @@ +<!DOCTYPE html> +<style> +body { + font: 10px Ahem; +} +</style> +<body><iframe src="resources/frame-with-compression-test-images.html" allow="unoptimized-lossless-images-strict 'none'" width="700" height="500"></iframe></body>
diff --git a/third_party/blink/web_tests/http/tests/websocket/multiple-connections-throttled-expected.txt b/third_party/blink/web_tests/http/tests/websocket/multiple-connections-throttled-expected.txt index 9c2e71b..d7ae331 100644 --- a/third_party/blink/web_tests/http/tests/websocket/multiple-connections-throttled-expected.txt +++ b/third_party/blink/web_tests/http/tests/websocket/multiple-connections-throttled-expected.txt
@@ -1,48 +1,48 @@ -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES -CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Error in connection establishment: net::ERR_INSUFFICIENT_RESOURCES +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason +CONSOLE ERROR: line 24: WebSocket connection to 'ws://127.0.0.1:8880/echo' failed: Unknown reason Test that WebSocket connections are throttled. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
diff --git a/third_party/blink/web_tests/inspector-protocol/timeline/tracing-proto-format-expected.txt b/third_party/blink/web_tests/inspector-protocol/timeline/tracing-proto-format-expected.txt new file mode 100644 index 0000000..22ca0958 --- /dev/null +++ b/third_party/blink/web_tests/inspector-protocol/timeline/tracing-proto-format-expected.txt
@@ -0,0 +1,4 @@ +Tests that tracing with proto format outputs something resembling protos. +Tracing complete +First byte: 10 +
diff --git a/third_party/blink/web_tests/inspector-protocol/timeline/tracing-proto-format.js b/third_party/blink/web_tests/inspector-protocol/timeline/tracing-proto-format.js new file mode 100644 index 0000000..ac2e8990 --- /dev/null +++ b/third_party/blink/web_tests/inspector-protocol/timeline/tracing-proto-format.js
@@ -0,0 +1,21 @@ +(async function(testRunner) { + const {page, session, dp} = await testRunner.startBlank( + `Tests that tracing with proto format outputs something resembling protos.`); + + const TracingHelper = await testRunner.loadScript('../resources/tracing-test.js'); + const tracingHelper = new TracingHelper(testRunner, session); + + const startResponse = await dp.Tracing.start( + {transferMode: 'ReturnAsStream', streamFormat: 'proto'}); + if (startResponse.error) { + testRunner.log('Start failed: ' + startResponse.error.message); + testRunner.completeTest(); + return; + } + + const stream = await tracingHelper.stopTracingAndReturnStream(); + const data = await tracingHelper.retrieveStream(stream, null, null); + // First byte should be TracePacket field ID preamble (byte value 10). + testRunner.log('First byte: ' + data.charCodeAt(0)); + testRunner.completeTest(); +})
diff --git a/third_party/blink/web_tests/media/video-loop-from-ended.html b/third_party/blink/web_tests/media/video-loop-from-ended.html deleted file mode 100644 index b225846d..0000000 --- a/third_party/blink/web_tests/media/video-loop-from-ended.html +++ /dev/null
@@ -1,54 +0,0 @@ -<!DOCTYPE html> -<title>Test looping edge case to verify http://crbug.com/364442.</title> -<script src="../resources/testharness.js"></script> -<script src="../resources/testharnessreport.js"></script> -<video></video> -<script> -// Seek towards end of video (for faster testing). -// Play video to end with "loop" set to false. -// Once ended, set "loop" to true. Call play. -// Verify that "seeked" event fires, seeking back to the beginning. -// Pause video and end test. -async_test(function(t) { - var video = document.querySelector("video"); - - video.onloadedmetadata = t.step_func(function() { - // Video is initially paused and "loop" unset. - assert_true(video.paused); - assert_false(video.loop); - // Seek to just before the end of the video and play. - video.currentTime = video.duration - 0.5; - video.onended = t.step_func(function() { - // Verify played to end and stopped. - assert_true(video.ended); - assert_true(video.paused); - assert_equals(video.currentTime, video.duration); - - // With playback ended, set "loop" attribute. This will cause ended == false. - // looping video cannot be "ended", only paused. - assert_false(video.loop); - video.loop = true; - assert_true(video.loop); - assert_false(video.ended); - assert_true(video.paused); - - video.onseeked = t.step_func_done(function() { - // Observed seek. Verify current time decreased and still playing. - assert_true(video.loop) - assert_false(video.paused); - assert_false(video.ended); - assert_less_than(video.currentTime, video.duration); - // Pausing now that test is over to prevent additional unwanted looping. - video.pause(); - }); - - // Play video with "loop" set. Expect seek back to start. - video.play(); - }); - - video.play(); - }); - - video.src = "content/test.ogv"; -}); -</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/platform/linux/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png b/third_party/blink/web_tests/platform/linux/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png new file mode 100644 index 0000000..4c91e98b --- /dev/null +++ b/third_party/blink/web_tests/platform/linux/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/mac/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png b/third_party/blink/web_tests/platform/mac/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png new file mode 100644 index 0000000..b33b64f9 --- /dev/null +++ b/third_party/blink/web_tests/platform/mac/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/platform/win/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png b/third_party/blink/web_tests/platform/win/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png new file mode 100644 index 0000000..4cff074 --- /dev/null +++ b/third_party/blink/web_tests/platform/win/http/tests/images/feature-policy-unoptimized-lossless-images-strict-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/resources/gesture-util.js b/third_party/blink/web_tests/resources/gesture-util.js index c885e13..eafe130 100644 --- a/third_party/blink/web_tests/resources/gesture-util.js +++ b/third_party/blink/web_tests/resources/gesture-util.js
@@ -362,3 +362,14 @@ function approx_equals(actual, expected, epsilon) { return actual >= expected - epsilon && actual <= expected + epsilon; } + +// Returns the given element's client rect center in an object with |x| and |y| +// properties. Client rect being relative to the layout viewport. i.e. this will +// not do what you thing if the page is pinch-zoomed. +function elementCenter(element) { + const rect = element.getBoundingClientRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; +}
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/fetch/api/response/response-stream-with-broken-then.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/fetch/api/response/response-stream-with-broken-then.any-expected.txt deleted file mode 100644 index bd51f5f..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/fetch/api/response/response-stream-with-broken-then.any-expected.txt +++ /dev/null
@@ -1,9 +0,0 @@ -This is a testharness.js-based test. -PASS Attempt to inject {done: false, value: bye} via Object.prototype.then. -PASS Attempt to inject value: undefined via Object.prototype.then. -PASS Attempt to inject undefined via Object.prototype.then. -PASS Attempt to inject 8.2 via Object.prototype.then. -PASS intercepting arraybuffer to text conversion via Object.prototype.then should not be possible -FAIL intercepting arraybuffer to body readable stream conversion via Object.prototype.then should not be possible promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any-expected.txt deleted file mode 100644 index ea3f60a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -This is a testharness.js-based test. -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; rejected cancel promise assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Closing must be propagated backward: starts closed; preventCancel = undefined (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = null (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = false (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = 0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = -0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = NaN (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -PASS Closing must be propagated backward: starts closed; preventCancel = true (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = a (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = 1 (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = Symbol() (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = [object Object] (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true, preventClose = true -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.serviceworker-expected.txt deleted file mode 100644 index ea3f60a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.serviceworker-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -This is a testharness.js-based test. -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; rejected cancel promise assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Closing must be propagated backward: starts closed; preventCancel = undefined (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = null (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = false (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = 0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = -0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = NaN (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -PASS Closing must be propagated backward: starts closed; preventCancel = true (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = a (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = 1 (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = Symbol() (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = [object Object] (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true, preventClose = true -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.sharedworker-expected.txt deleted file mode 100644 index ea3f60a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.sharedworker-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -This is a testharness.js-based test. -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; rejected cancel promise assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Closing must be propagated backward: starts closed; preventCancel = undefined (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = null (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = false (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = 0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = -0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = NaN (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -PASS Closing must be propagated backward: starts closed; preventCancel = true (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = a (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = 1 (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = Symbol() (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = [object Object] (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true, preventClose = true -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.worker-expected.txt deleted file mode 100644 index ea3f60a..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/close-propagation-backward.any.worker-expected.txt +++ /dev/null
@@ -1,19 +0,0 @@ -This is a testharness.js-based test. -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel omitted; rejected cancel promise assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Closing must be propagated backward: starts closed; preventCancel = undefined (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = null (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = false (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = 0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = -0 (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = NaN (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -FAIL Closing must be propagated backward: starts closed; preventCancel = (falsy); fulfilled cancel promise assert_array_equals: lengths differ, expected 2 got 0 -PASS Closing must be propagated backward: starts closed; preventCancel = true (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = a (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = 1 (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = Symbol() (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = [object Object] (truthy) -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true -PASS Closing must be propagated backward: starts closed; preventCancel = true, preventAbort = true, preventClose = true -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any-expected.txt deleted file mode 100644 index 562e861..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any-expected.txt +++ /dev/null
@@ -1,9 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks, but then does promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from an empty ReadableStream into a WritableStream that does not desire chunks, but then the readable stream becomes non-empty and the writable stream starts desiring chunks promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream to a WritableStream that desires more chunks before finishing with previous ones assert_equals: chunks should continue to be enqueued until the HWM is reached expected 1 but got 3 -FAIL Piping to a WritableStream that does not consume the writes fast enough exerts backpressure on the ReadableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.serviceworker-expected.txt deleted file mode 100644 index 562e861..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.serviceworker-expected.txt +++ /dev/null
@@ -1,9 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks, but then does promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from an empty ReadableStream into a WritableStream that does not desire chunks, but then the readable stream becomes non-empty and the writable stream starts desiring chunks promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream to a WritableStream that desires more chunks before finishing with previous ones assert_equals: chunks should continue to be enqueued until the HWM is reached expected 1 but got 3 -FAIL Piping to a WritableStream that does not consume the writes fast enough exerts backpressure on the ReadableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.sharedworker-expected.txt deleted file mode 100644 index 562e861..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.sharedworker-expected.txt +++ /dev/null
@@ -1,9 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks, but then does promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from an empty ReadableStream into a WritableStream that does not desire chunks, but then the readable stream becomes non-empty and the writable stream starts desiring chunks promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream to a WritableStream that desires more chunks before finishing with previous ones assert_equals: chunks should continue to be enqueued until the HWM is reached expected 1 but got 3 -FAIL Piping to a WritableStream that does not consume the writes fast enough exerts backpressure on the ReadableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.worker-expected.txt deleted file mode 100644 index 562e861..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/flow-control.any.worker-expected.txt +++ /dev/null
@@ -1,9 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks assert_throws: pipeTo must reject with the same error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a non-empty ReadableStream into a WritableStream that does not desire chunks, but then does promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from an empty ReadableStream into a WritableStream that does not desire chunks, but then the readable stream becomes non-empty and the writable stream starts desiring chunks promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream to a WritableStream that desires more chunks before finishing with previous ones assert_equals: chunks should continue to be enqueued until the HWM is reached expected 1 but got 3 -FAIL Piping to a WritableStream that does not consume the writes fast enough exerts backpressure on the ReadableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any-expected.txt deleted file mode 100644 index 6e9fc67..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping must lock both the ReadableStream and WritableStream assert_true: the ReadableStream must become locked expected true got false -FAIL Piping finishing must unlock both the ReadableStream and WritableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -PASS pipeTo must check the brand of its ReadableStream this value -PASS pipeTo must check the brand of its WritableStream argument -PASS pipeTo must fail if the ReadableStream is locked, and not lock the WritableStream -PASS pipeTo must fail if the WritableStream is locked, and not lock the ReadableStream -FAIL Piping from a ReadableStream from which lots of chunks are synchronously readable promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream for which a chunk becomes asynchronously readable after the pipeTo promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.serviceworker-expected.txt deleted file mode 100644 index 4e3e65b..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.serviceworker-expected.txt +++ /dev/null
@@ -1,16 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -FAIL Piping must lock both the ReadableStream and WritableStream assert_true: the ReadableStream must become locked expected true got false -FAIL Piping finishing must unlock both the ReadableStream and WritableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -PASS pipeTo must check the brand of its ReadableStream this value -PASS pipeTo must check the brand of its WritableStream argument -PASS pipeTo must fail if the ReadableStream is locked, and not lock the WritableStream -PASS pipeTo must fail if the WritableStream is locked, and not lock the ReadableStream -FAIL Piping from a ReadableStream from which lots of chunks are synchronously readable promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream for which a chunk becomes asynchronously readable after the pipeTo promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.sharedworker-expected.txt deleted file mode 100644 index 6e9fc67..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.sharedworker-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping must lock both the ReadableStream and WritableStream assert_true: the ReadableStream must become locked expected true got false -FAIL Piping finishing must unlock both the ReadableStream and WritableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -PASS pipeTo must check the brand of its ReadableStream this value -PASS pipeTo must check the brand of its WritableStream argument -PASS pipeTo must fail if the ReadableStream is locked, and not lock the WritableStream -PASS pipeTo must fail if the WritableStream is locked, and not lock the ReadableStream -FAIL Piping from a ReadableStream from which lots of chunks are synchronously readable promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream for which a chunk becomes asynchronously readable after the pipeTo promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.worker-expected.txt deleted file mode 100644 index 6e9fc67..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/general.any.worker-expected.txt +++ /dev/null
@@ -1,15 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping must lock both the ReadableStream and WritableStream assert_true: the ReadableStream must become locked expected true got false -FAIL Piping finishing must unlock both the ReadableStream and WritableStream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -PASS pipeTo must check the brand of its ReadableStream this value -PASS pipeTo must check the brand of its WritableStream argument -PASS pipeTo must fail if the ReadableStream is locked, and not lock the WritableStream -PASS pipeTo must fail if the WritableStream is locked, and not lock the ReadableStream -FAIL Piping from a ReadableStream from which lots of chunks are synchronously readable promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL Piping from a ReadableStream for which a chunk becomes asynchronously readable after the pipeTo promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from pull should cause pipeTo() to reject when preventAbort is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is true assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL an undefined rejection from write should cause pipeTo() to reject when preventCancel is false assert_equals: rejection value should be undefined expected (undefined) undefined but got (object) object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any-expected.txt deleted file mode 100644 index 615015d..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping from an errored readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from an errored readable stream to an errored writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an erroring writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an errored writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closing writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closed writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an errored writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from a closed readable stream to a closed writable stream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.serviceworker-expected.txt deleted file mode 100644 index 615015d..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.serviceworker-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping from an errored readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from an errored readable stream to an errored writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an erroring writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an errored writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closing writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closed writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an errored writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from a closed readable stream to a closed writable stream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.sharedworker-expected.txt deleted file mode 100644 index 615015d..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.sharedworker-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping from an errored readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from an errored readable stream to an errored writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an erroring writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an errored writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closing writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closed writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an errored writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from a closed readable stream to a closed writable stream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.worker-expected.txt deleted file mode 100644 index 615015d..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/multiple-propagation.any.worker-expected.txt +++ /dev/null
@@ -1,12 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping from an errored readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from an errored readable stream to an errored writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an erroring writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to an errored writable stream; preventAbort = true assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closing writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from an errored readable stream to a closed writable stream assert_throws: pipeTo must reject with the readable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an erroring writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error1: error1!" ("error1") -FAIL Piping from a closed readable stream to an errored writable stream assert_throws: pipeTo must reject with the writable stream's error function "function() { throw e }" threw object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" ("TypeError") expected object "error2: error2!" ("error2") -FAIL Piping from a closed readable stream to a closed writable stream promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any-expected.txt deleted file mode 100644 index f1a90efc..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping through a duck-typed pass-through transform stream should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL Piping through a transform errored on the writable end does not cause an unhandled promise rejection Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on this Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on the ReadableStream prototype Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should brand-check this and not allow 'null' -FAIL pipeThrough should brand-check readable and not allow 'null' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'undefined' -FAIL pipeThrough should brand-check readable and not allow 'undefined' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '0' -FAIL pipeThrough should brand-check readable and not allow '0' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'NaN' -FAIL pipeThrough should brand-check readable and not allow 'NaN' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'true' -FAIL pipeThrough should brand-check readable and not allow 'true' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'ReadableStream' -FAIL pipeThrough should brand-check readable and not allow 'ReadableStream' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '[object ReadableStream]' -FAIL pipeThrough should brand-check readable and not allow '[object ReadableStream]' assert_true: writable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'null' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'undefined' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '0' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'NaN' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'true' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'WritableStream' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '[object WritableStream]' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should rethrow errors from accessing readable or writable assert_throws: pipeThrough should rethrow the error thrown by the writable getter function "() => ReadableStream.prototype.pipeThrough.call(rs, throwingWritable, {})" threw object "TypeError: Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented" ("TypeError") expected object "custom" ("custom") -PASS invalid values of signal should throw; specifically 'null' -PASS invalid values of signal should throw; specifically '0' -PASS invalid values of signal should throw; specifically 'NaN' -PASS invalid values of signal should throw; specifically 'true' -PASS invalid values of signal should throw; specifically 'AbortSignal' -PASS invalid values of signal should throw; specifically '[object AbortSignal]' -FAIL pipeThrough should accept a real AbortSignal Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should throw if this is locked -PASS pipeThrough should throw if writable is locked -FAIL pipeThrough should not care if readable is locked Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventCancel should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventClose should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventAbort should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.serviceworker-expected.txt deleted file mode 100644 index f1a90efc..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.serviceworker-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping through a duck-typed pass-through transform stream should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL Piping through a transform errored on the writable end does not cause an unhandled promise rejection Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on this Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on the ReadableStream prototype Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should brand-check this and not allow 'null' -FAIL pipeThrough should brand-check readable and not allow 'null' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'undefined' -FAIL pipeThrough should brand-check readable and not allow 'undefined' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '0' -FAIL pipeThrough should brand-check readable and not allow '0' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'NaN' -FAIL pipeThrough should brand-check readable and not allow 'NaN' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'true' -FAIL pipeThrough should brand-check readable and not allow 'true' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'ReadableStream' -FAIL pipeThrough should brand-check readable and not allow 'ReadableStream' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '[object ReadableStream]' -FAIL pipeThrough should brand-check readable and not allow '[object ReadableStream]' assert_true: writable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'null' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'undefined' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '0' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'NaN' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'true' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'WritableStream' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '[object WritableStream]' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should rethrow errors from accessing readable or writable assert_throws: pipeThrough should rethrow the error thrown by the writable getter function "() => ReadableStream.prototype.pipeThrough.call(rs, throwingWritable, {})" threw object "TypeError: Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented" ("TypeError") expected object "custom" ("custom") -PASS invalid values of signal should throw; specifically 'null' -PASS invalid values of signal should throw; specifically '0' -PASS invalid values of signal should throw; specifically 'NaN' -PASS invalid values of signal should throw; specifically 'true' -PASS invalid values of signal should throw; specifically 'AbortSignal' -PASS invalid values of signal should throw; specifically '[object AbortSignal]' -FAIL pipeThrough should accept a real AbortSignal Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should throw if this is locked -PASS pipeThrough should throw if writable is locked -FAIL pipeThrough should not care if readable is locked Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventCancel should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventClose should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventAbort should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.sharedworker-expected.txt deleted file mode 100644 index f1a90efc..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.sharedworker-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping through a duck-typed pass-through transform stream should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL Piping through a transform errored on the writable end does not cause an unhandled promise rejection Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on this Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on the ReadableStream prototype Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should brand-check this and not allow 'null' -FAIL pipeThrough should brand-check readable and not allow 'null' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'undefined' -FAIL pipeThrough should brand-check readable and not allow 'undefined' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '0' -FAIL pipeThrough should brand-check readable and not allow '0' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'NaN' -FAIL pipeThrough should brand-check readable and not allow 'NaN' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'true' -FAIL pipeThrough should brand-check readable and not allow 'true' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'ReadableStream' -FAIL pipeThrough should brand-check readable and not allow 'ReadableStream' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '[object ReadableStream]' -FAIL pipeThrough should brand-check readable and not allow '[object ReadableStream]' assert_true: writable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'null' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'undefined' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '0' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'NaN' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'true' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'WritableStream' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '[object WritableStream]' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should rethrow errors from accessing readable or writable assert_throws: pipeThrough should rethrow the error thrown by the writable getter function "() => ReadableStream.prototype.pipeThrough.call(rs, throwingWritable, {})" threw object "TypeError: Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented" ("TypeError") expected object "custom" ("custom") -PASS invalid values of signal should throw; specifically 'null' -PASS invalid values of signal should throw; specifically '0' -PASS invalid values of signal should throw; specifically 'NaN' -PASS invalid values of signal should throw; specifically 'true' -PASS invalid values of signal should throw; specifically 'AbortSignal' -PASS invalid values of signal should throw; specifically '[object AbortSignal]' -FAIL pipeThrough should accept a real AbortSignal Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should throw if this is locked -PASS pipeThrough should throw if writable is locked -FAIL pipeThrough should not care if readable is locked Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventCancel should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventClose should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventAbort should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.worker-expected.txt deleted file mode 100644 index f1a90efc..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/pipe-through.any.worker-expected.txt +++ /dev/null
@@ -1,42 +0,0 @@ -This is a testharness.js-based test. -FAIL Piping through a duck-typed pass-through transform stream should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL Piping through a transform errored on the writable end does not cause an unhandled promise rejection Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on this Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL pipeThrough should not call pipeTo on the ReadableStream prototype Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should brand-check this and not allow 'null' -FAIL pipeThrough should brand-check readable and not allow 'null' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'undefined' -FAIL pipeThrough should brand-check readable and not allow 'undefined' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '0' -FAIL pipeThrough should brand-check readable and not allow '0' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'NaN' -FAIL pipeThrough should brand-check readable and not allow 'NaN' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'true' -FAIL pipeThrough should brand-check readable and not allow 'true' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow 'ReadableStream' -FAIL pipeThrough should brand-check readable and not allow 'ReadableStream' assert_true: writable should have been accessed expected true got false -PASS pipeThrough should brand-check this and not allow '[object ReadableStream]' -FAIL pipeThrough should brand-check readable and not allow '[object ReadableStream]' assert_true: writable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'null' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'undefined' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '0' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'NaN' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'true' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow 'WritableStream' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should brand-check writable and not allow '[object WritableStream]' assert_true: readable should have been accessed expected true got false -FAIL pipeThrough should rethrow errors from accessing readable or writable assert_throws: pipeThrough should rethrow the error thrown by the writable getter function "() => ReadableStream.prototype.pipeThrough.call(rs, throwingWritable, {})" threw object "TypeError: Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented" ("TypeError") expected object "custom" ("custom") -PASS invalid values of signal should throw; specifically 'null' -PASS invalid values of signal should throw; specifically '0' -PASS invalid values of signal should throw; specifically 'NaN' -PASS invalid values of signal should throw; specifically 'true' -PASS invalid values of signal should throw; specifically 'AbortSignal' -PASS invalid values of signal should throw; specifically '[object AbortSignal]' -FAIL pipeThrough should accept a real AbortSignal Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -PASS pipeThrough should throw if this is locked -PASS pipeThrough should throw if writable is locked -FAIL pipeThrough should not care if readable is locked Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventCancel should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventClose should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -FAIL preventAbort should work Failed to execute 'pipeThrough' on 'ReadableStream': pipeThrough not yet implemented -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/then-interception.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/then-interception.any-expected.txt deleted file mode 100644 index 37259389..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/piping/then-interception.any-expected.txt +++ /dev/null
@@ -1,5 +0,0 @@ -This is a testharness.js-based test. -FAIL piping should not be observable promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -FAIL tee should not be observable promise_test: Unhandled rejection with value: object "TypeError: Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented" -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any-expected.txt deleted file mode 100644 index d553698..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any-expected.txt +++ /dev/null
@@ -1,14 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -PASS enqueue() inside size() should work -PASS close() inside size() should not crash -PASS close request inside size() should work -PASS error() inside size() should work -PASS desiredSize inside size() should work -PASS cancel() inside size() should work -FAIL pipeTo() inside size() should behave as expected assert_array_equals: ws should contain two chunks lengths differ, expected 4 got 0 -PASS read() inside of size() should behave as expected -PASS getReader() inside size() should work -PASS tee() inside size() should work -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.serviceworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.serviceworker-expected.txt deleted file mode 100644 index d553698..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.serviceworker-expected.txt +++ /dev/null
@@ -1,14 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -PASS enqueue() inside size() should work -PASS close() inside size() should not crash -PASS close request inside size() should work -PASS error() inside size() should work -PASS desiredSize inside size() should work -PASS cancel() inside size() should work -FAIL pipeTo() inside size() should behave as expected assert_array_equals: ws should contain two chunks lengths differ, expected 4 got 0 -PASS read() inside of size() should behave as expected -PASS getReader() inside size() should work -PASS tee() inside size() should work -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.sharedworker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.sharedworker-expected.txt deleted file mode 100644 index d553698..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.sharedworker-expected.txt +++ /dev/null
@@ -1,14 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -PASS enqueue() inside size() should work -PASS close() inside size() should not crash -PASS close request inside size() should work -PASS error() inside size() should work -PASS desiredSize inside size() should work -PASS cancel() inside size() should work -FAIL pipeTo() inside size() should behave as expected assert_array_equals: ws should contain two chunks lengths differ, expected 4 got 0 -PASS read() inside of size() should behave as expected -PASS getReader() inside size() should work -PASS tee() inside size() should work -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.worker-expected.txt deleted file mode 100644 index d553698..0000000 --- a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/reentrant-strategies.any.worker-expected.txt +++ /dev/null
@@ -1,14 +0,0 @@ -This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = Failed to execute 'pipeTo' on 'ReadableStream': pipeTo not yet implemented -PASS enqueue() inside size() should work -PASS close() inside size() should not crash -PASS close request inside size() should work -PASS error() inside size() should work -PASS desiredSize inside size() should work -PASS cancel() inside size() should work -FAIL pipeTo() inside size() should behave as expected assert_array_equals: ws should contain two chunks lengths differ, expected 4 got 0 -PASS read() inside of size() should behave as expected -PASS getReader() inside size() should work -PASS tee() inside size() should work -Harness: the test ran to completion. -
diff --git a/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/tee.any-expected.txt b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/tee.any-expected.txt new file mode 100644 index 0000000..0ad6737 --- /dev/null +++ b/third_party/blink/web_tests/virtual/streams-native/external/wpt/streams/readable-streams/tee.any-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +PASS ReadableStream teeing: rs.tee() returns an array of two ReadableStreams +PASS ReadableStream teeing: should be able to read one branch to the end without affecting the other +PASS ReadableStream teeing: values should be equal across each branch +PASS ReadableStream teeing: errors in the source should propagate to both branches +PASS ReadableStream teeing: canceling branch1 should not impact branch2 +PASS ReadableStream teeing: canceling branch2 should not impact branch1 +PASS ReadableStream teeing: canceling both branches should aggregate the cancel reasons into an array +PASS ReadableStream teeing: canceling both branches in reverse order should aggregate the cancel reasons into an array +PASS ReadableStream teeing: failing to cancel the original stream should cause cancel() to reject on branches +PASS ReadableStream teeing: erroring a teed stream should properly handle canceled branches +PASS ReadableStream teeing: erroring a teed stream should error both branches +PASS ReadableStream teeing: closing the original should immediately close the branches +PASS ReadableStream teeing: erroring the original should immediately error the branches +PASS ReadableStreamTee should not use a modified ReadableStream constructor from the global object +FAIL ReadableStreamTee should not pull more chunks than can fit in the branch queue assert_array_equals: pull should only be called once lengths differ, expected 1 got 2 +PASS ReadableStreamTee should only pull enough to fill the emptiest queue +PASS ReadableStreamTee should not pull when original is already errored +FAIL ReadableStreamTee stops pulling when original stream errors while branch 1 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while branch 2 is reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +FAIL ReadableStreamTee stops pulling when original stream errors while both branches are reading assert_array_equals: pull should be called once lengths differ, expected 1 got 2 +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/virtual/streams-native/http/tests/streams/transferable/shared-worker-expected.txt b/third_party/blink/web_tests/virtual/streams-native/http/tests/streams/transferable/shared-worker-expected.txt index 36e8d16..a61ccf35 100644 --- a/third_party/blink/web_tests/virtual/streams-native/http/tests/streams/transferable/shared-worker-expected.txt +++ b/third_party/blink/web_tests/virtual/streams-native/http/tests/streams/transferable/shared-worker-expected.txt
@@ -1,6 +1,4 @@ -CONSOLE ERROR: line 79: Uncaught (in promise) BAD: TypeError: Cannot read property 'constructor' of null This is a testharness.js-based test. -Harness Error. harness_status.status = 1 , harness_status.message = undefined FAIL worker.postMessage should be able to transfer a ReadableStream assert_true: the original stream should be locked expected true got false FAIL postMessage in a worker should be able to transfer a ReadableStream promise_test: Unhandled rejection with value: object "TypeError: Cannot read property 'constructor' of null" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt b/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt index 324358f4..a92bbec 100644 --- a/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt +++ b/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt
@@ -35,6 +35,7 @@ sync-xhr top-navigation unoptimized-lossless-images +unoptimized-lossless-images-strict unoptimized-lossy-images unsized-media usb
diff --git a/third_party/google_android_play_core/cipd.yaml b/third_party/google_android_play_core/cipd.yaml index 92671aa..59a3d7d 100644 --- a/third_party/google_android_play_core/cipd.yaml +++ b/third_party/google_android_play_core/cipd.yaml
@@ -3,7 +3,7 @@ # found in the LICENSE file. # To create CIPD package run the following command. -# cipd create --pkg-def cipd.yaml -tag version:1.3.7-cr1 +# cipd create --pkg-def cipd.yaml -tag version:1.3.7-cr2 package: chromium/third_party/android_deps/libs/com_google_android_play_core_verification description: "" data:
diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn index 62fde59..d099d89 100644 --- a/third_party/sqlite/BUILD.gn +++ b/third_party/sqlite/BUILD.gn
@@ -20,10 +20,6 @@ # https://www.sqlite.org/compile.html config("chromium_sqlite3_compile_options") { defines = [ - # Skip writing transaction rollback journals on f2fs. - # f2fs tends to be used on Android, and may be used on ChromeOS. - "SQLITE_ENABLE_BATCH_ATOMIC_WRITE", - "SQLITE_ENABLE_FTS3", # New unicode61 tokenizer with built-in tables.
diff --git a/third_party/sqlite/amalgamation/sqlite3.c b/third_party/sqlite/amalgamation/sqlite3.c index a1529a6f..74e2713 100644 --- a/third_party/sqlite/amalgamation/sqlite3.c +++ b/third_party/sqlite/amalgamation/sqlite3.c
@@ -158303,6 +158303,7 @@ ** query logic likewise merges doclists so that newer data knocks out ** older data. */ +#define CHROMIUM_FTS3_CHANGES 1 /************** Include fts3Int.h in the middle of fts3.c ********************/ /************** Begin file fts3Int.h *****************************************/ @@ -162950,7 +162951,11 @@ ** module with sqlite. */ if( SQLITE_OK==rc +#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST + /* fts3_tokenizer() disabled for security reasons. */ +#else && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) +#endif && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) @@ -162960,6 +162965,9 @@ rc = sqlite3_create_module_v2( db, "fts3", &fts3Module, (void *)pHash, hashDestroy ); +#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST + /* Disable fts4 and tokenizer vtab pending review. */ +#else if( rc==SQLITE_OK ){ rc = sqlite3_create_module_v2( db, "fts4", &fts3Module, (void *)pHash, 0 @@ -162968,6 +162976,7 @@ if( rc==SQLITE_OK ){ rc = sqlite3Fts3InitTok(db, (void *)pHash); } +#endif return rc; } @@ -221431,7 +221440,7 @@ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ -#if __LINE__!=221434 +#if __LINE__!=221443 #undef SQLITE_SOURCE_ID #define SQLITE_SOURCE_ID "2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0alt2" #endif
diff --git a/third_party/sqlite/patched/ext/fts3/fts3.c b/third_party/sqlite/patched/ext/fts3/fts3.c index 823e1b6a..c371d3e8 100644 --- a/third_party/sqlite/patched/ext/fts3/fts3.c +++ b/third_party/sqlite/patched/ext/fts3/fts3.c
@@ -287,6 +287,7 @@ ** query logic likewise merges doclists so that newer data knocks out ** older data. */ +#define CHROMIUM_FTS3_CHANGES 1 #include "fts3Int.h" #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) @@ -4016,7 +4017,11 @@ ** module with sqlite. */ if( SQLITE_OK==rc +#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST + /* fts3_tokenizer() disabled for security reasons. */ +#else && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) +#endif && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) @@ -4026,6 +4031,9 @@ rc = sqlite3_create_module_v2( db, "fts3", &fts3Module, (void *)pHash, hashDestroy ); +#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST + /* Disable fts4 and tokenizer vtab pending review. */ +#else if( rc==SQLITE_OK ){ rc = sqlite3_create_module_v2( db, "fts4", &fts3Module, (void *)pHash, 0 @@ -4034,6 +4042,7 @@ if( rc==SQLITE_OK ){ rc = sqlite3Fts3InitTok(db, (void *)pHash); } +#endif return rc; }
diff --git a/third_party/sqlite/patches/0001-Virtual-table-supporting-recovery-of-corrupted-datab.patch b/third_party/sqlite/patches/0001-Virtual-table-supporting-recovery-of-corrupted-datab.patch index c5c57d4..602fc1f 100644 --- a/third_party/sqlite/patches/0001-Virtual-table-supporting-recovery-of-corrupted-datab.patch +++ b/third_party/sqlite/patches/0001-Virtual-table-supporting-recovery-of-corrupted-datab.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Scott Hess <shess@chromium.org> Date: Sat, 20 Jul 2013 11:42:21 -0700 -Subject: [PATCH 01/11] Virtual table supporting recovery of corrupted +Subject: [PATCH 01/12] Virtual table supporting recovery of corrupted databases. "recover" implements a virtual table which uses the SQLite pager layer @@ -40,11 +40,11 @@ @@ -77,6 +77,8 @@ LIBOBJ+= vdbe.o parse.o \ vdbetrace.o wal.o walker.o where.o wherecode.o whereexpr.o \ utf.o vtab.o window.o - + +LIBOBJ += recover.o recover_varint.o + LIBOBJ += sqlite3session.o - + # All of the source code files. @@ -410,6 +412,8 @@ TESTSRC2 = \ $(TOP)/src/prepare.c \ @@ -60,7 +60,7 @@ TESTFIXTURE_FLAGS += -DSQLITE_ENABLE_DBPAGE_VTAB TESTFIXTURE_FLAGS += -DTCLSH_INIT_PROC=sqlite3TestInit +TESTFIXTURE_FLAGS += -DDEFAULT_ENABLE_RECOVER=1 - + testfixture$(EXE): $(TESTSRC2) libsqlite3.a $(TESTSRC) $(TOP)/src/tclsqlite.c $(TCCX) $(TCL_FLAGS) $(TESTFIXTURE_FLAGS) \ diff --git a/third_party/sqlite/patched/src/main.c b/third_party/sqlite/patched/src/main.c @@ -70,7 +70,7 @@ @@ -3244,6 +3244,14 @@ static int openDatabase( } #endif - + +#ifdef DEFAULT_ENABLE_RECOVER + /* Initialize recover virtual table for testing. */ + extern int chrome_sqlite3_recoverVtableInit(sqlite3 *db); @@ -3900,6 +3900,6 @@ +} [list 4 1024 1 text [string length $substr] $substr] + +finish_test --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0002-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch b/third_party/sqlite/patches/0002-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch index 38b19e1..1ee7be3 100644 --- a/third_party/sqlite/patches/0002-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch +++ b/third_party/sqlite/patches/0002-Custom-shell.c-helpers-to-load-Chromium-s-ICU-data.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: "tc@google.com" <tc@google.com> Date: Tue, 6 Jan 2009 22:39:41 +0000 -Subject: [PATCH 02/11] Custom shell.c helpers to load Chromium's ICU data. +Subject: [PATCH 02/12] Custom shell.c helpers to load Chromium's ICU data. History uses fts3 with an icu-based segmenter. These changes allow building a sqlite3 binary for Linux or Windows which can read those files. @@ -24,7 +24,7 @@ @@ -60,6 +60,13 @@ TLIBS = OPTS = -DNDEBUG=1 OPTS += -DHAVE_FDATASYNC=1 - + +# Support for loading Chromium ICU data in sqlite3. +ifeq ($(shell uname -s),Darwin) +SHELL_ICU = @@ -40,12 +40,12 @@ --- a/third_party/sqlite/patched/main.mk +++ b/third_party/sqlite/patched/main.mk @@ -556,7 +556,7 @@ libsqlite3.a: $(LIBOBJ) - + sqlite3$(EXE): shell.c libsqlite3.a sqlite3.h $(TCCX) $(READLINE_FLAGS) -o sqlite3$(EXE) $(SHELL_OPT) \ - shell.c libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB) + shell.c $(SHELL_ICU) libsqlite3.a $(LIBREADLINE) $(TLIBS) $(THREADLIB) - + sqldiff$(EXE): $(TOP)/tool/sqldiff.c sqlite3.c sqlite3.h $(TCCX) -o sqldiff$(EXE) -DSQLITE_THREADSAFE=0 \ diff --git a/third_party/sqlite/patched/src/shell.c.in b/third_party/sqlite/patched/src/shell.c.in @@ -55,7 +55,7 @@ @@ -8891,6 +8891,16 @@ int SQLITE_CDECL wmain(int argc, wchar_t **wargv){ } #endif - + + /* Begin evanm patch. */ +#if !defined(__APPLE__) + extern int sqlite_shell_init_icu(); @@ -140,6 +140,6 @@ + + return 1; +} --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0003-fts3-Disable-fts3_tokenizer-and-fts4.patch b/third_party/sqlite/patches/0003-fts3-Disable-fts3_tokenizer-and-fts4.patch new file mode 100644 index 0000000..1a9b16c --- /dev/null +++ b/third_party/sqlite/patches/0003-fts3-Disable-fts3_tokenizer-and-fts4.patch
@@ -0,0 +1,60 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Scott Hess <shess@chromium.org> +Date: Tue, 16 Dec 2014 13:02:27 -0800 +Subject: [PATCH 03/12] [fts3] Disable fts3_tokenizer and fts4. + +fts3_tokenizer allows a SQLite user to specify a pointer to call as a +function, which has obvious sercurity implications. Disable fts4 until +someone explicitly decides to own support for it. Disable fts3tokenize +virtual table until someone explicitly decides to own support for it. + +No original review URL because this was part of the initial Chromium commit. +--- + third_party/sqlite/patched/ext/fts3/fts3.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/third_party/sqlite/patched/ext/fts3/fts3.c b/third_party/sqlite/patched/ext/fts3/fts3.c +index 823e1b6a81fe..c371d3e8f0b5 100644 +--- a/third_party/sqlite/patched/ext/fts3/fts3.c ++++ b/third_party/sqlite/patched/ext/fts3/fts3.c +@@ -287,6 +287,7 @@ + ** query logic likewise merges doclists so that newer data knocks out + ** older data. + */ ++#define CHROMIUM_FTS3_CHANGES 1 + + #include "fts3Int.h" + #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) +@@ -4016,7 +4017,11 @@ int sqlite3Fts3Init(sqlite3 *db){ + ** module with sqlite. + */ + if( SQLITE_OK==rc ++#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST ++ /* fts3_tokenizer() disabled for security reasons. */ ++#else + && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) ++#endif + && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) + && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) + && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) +@@ -4026,6 +4031,9 @@ int sqlite3Fts3Init(sqlite3 *db){ + rc = sqlite3_create_module_v2( + db, "fts3", &fts3Module, (void *)pHash, hashDestroy + ); ++#if CHROMIUM_FTS3_CHANGES && !SQLITE_TEST ++ /* Disable fts4 and tokenizer vtab pending review. */ ++#else + if( rc==SQLITE_OK ){ + rc = sqlite3_create_module_v2( + db, "fts4", &fts3Module, (void *)pHash, 0 +@@ -4034,6 +4042,7 @@ int sqlite3Fts3Init(sqlite3 *db){ + if( rc==SQLITE_OK ){ + rc = sqlite3Fts3InitTok(db, (void *)pHash); + } ++#endif + return rc; + } + +-- +2.21.0.392.gf8f6787159e-goog +
diff --git a/third_party/sqlite/patches/0003-Fix-compilation-with-SQLITE_OMIT_WINDOWFUNC.patch b/third_party/sqlite/patches/0004-Fix-compilation-with-SQLITE_OMIT_WINDOWFUNC.patch similarity index 90% rename from third_party/sqlite/patches/0003-Fix-compilation-with-SQLITE_OMIT_WINDOWFUNC.patch rename to third_party/sqlite/patches/0004-Fix-compilation-with-SQLITE_OMIT_WINDOWFUNC.patch index 6cd9acc..4989c3c7 100644 --- a/third_party/sqlite/patches/0003-Fix-compilation-with-SQLITE_OMIT_WINDOWFUNC.patch +++ b/third_party/sqlite/patches/0004-Fix-compilation-with-SQLITE_OMIT_WINDOWFUNC.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Victor Costan <pwnall@chromium.org> Date: Sun, 10 Feb 2019 13:12:57 -0800 -Subject: [PATCH 03/11] Fix compilation with SQLITE_OMIT_WINDOWFUNC. +Subject: [PATCH 04/12] Fix compilation with SQLITE_OMIT_WINDOWFUNC. --- third_party/sqlite/patched/src/resolve.c | 2 ++ @@ -14,7 +14,7 @@ @@ -1556,6 +1556,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ } } - + +#ifndef SQLITE_OMIT_WINDOWFUNC if( IN_RENAME_OBJECT ){ Window *pWin; @@ -24,9 +24,9 @@ } } +#endif - + /* If this is part of a compound SELECT, check that it has the right ** number of expressions in the select list. */ --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0004-Fix-dbfuzz2.c-compilation-errors-on-Windows.patch b/third_party/sqlite/patches/0005-Fix-dbfuzz2.c-compilation-errors-on-Windows.patch similarity index 92% rename from third_party/sqlite/patches/0004-Fix-dbfuzz2.c-compilation-errors-on-Windows.patch rename to third_party/sqlite/patches/0005-Fix-dbfuzz2.c-compilation-errors-on-Windows.patch index d2ee401..39f54908 100644 --- a/third_party/sqlite/patches/0004-Fix-dbfuzz2.c-compilation-errors-on-Windows.patch +++ b/third_party/sqlite/patches/0005-Fix-dbfuzz2.c-compilation-errors-on-Windows.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Victor Costan <pwnall@chromium.org> Date: Sun, 10 Feb 2019 15:18:43 -0800 -Subject: [PATCH 04/11] Fix dbfuzz2.c compilation errors on Windows. +Subject: [PATCH 05/12] Fix dbfuzz2.c compilation errors on Windows. --- third_party/sqlite/patched/test/dbfuzz2.c | 4 ++++ @@ -20,7 +20,7 @@ #include <sys/resource.h> +#endif #include "sqlite3.h" - + /* @@ -261,6 +263,7 @@ int LLVMFuzzerInitialize(int *pArgc, char ***pArgv){ szMax = strtol(argv[++i], 0, 0); @@ -38,6 +38,6 @@ } argv[j++] = argv[i]; } --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0005-Fix-Heap-buffer-overflow-in-vdbeRecordCompareInt.patch b/third_party/sqlite/patches/0006-Fix-Heap-buffer-overflow-in-vdbeRecordCompareInt.patch similarity index 90% rename from third_party/sqlite/patches/0005-Fix-Heap-buffer-overflow-in-vdbeRecordCompareInt.patch rename to third_party/sqlite/patches/0006-Fix-Heap-buffer-overflow-in-vdbeRecordCompareInt.patch index f10b0df..95ffdc6 100644 --- a/third_party/sqlite/patches/0005-Fix-Heap-buffer-overflow-in-vdbeRecordCompareInt.patch +++ b/third_party/sqlite/patches/0006-Fix-Heap-buffer-overflow-in-vdbeRecordCompareInt.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Darwin Huang <huangdarwin@chromium.org> Date: Tue, 5 Mar 2019 13:49:51 -0800 -Subject: [PATCH 05/11] Fix Heap-buffer-overflow in vdbeRecordCompareInt +Subject: [PATCH 06/12] Fix Heap-buffer-overflow in vdbeRecordCompareInt This backports https://www.sqlite.org/src/info/c1ac00706bae45fe @@ -23,6 +23,6 @@ sqlite3_free(pCellKey); } assert( --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0006-fix-heap-buffer-overflow-in-cellsizeptr.patch b/third_party/sqlite/patches/0007-fix-heap-buffer-overflow-in-cellsizeptr.patch similarity index 92% rename from third_party/sqlite/patches/0006-fix-heap-buffer-overflow-in-cellsizeptr.patch rename to third_party/sqlite/patches/0007-fix-heap-buffer-overflow-in-cellsizeptr.patch index b265b86..777daa3d 100644 --- a/third_party/sqlite/patches/0006-fix-heap-buffer-overflow-in-cellsizeptr.patch +++ b/third_party/sqlite/patches/0007-fix-heap-buffer-overflow-in-cellsizeptr.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Darwin Huang <huangdarwin@chromium.org> Date: Tue, 5 Mar 2019 14:13:19 -0800 -Subject: [PATCH 06/11] fix heap-buffer-overflow in cellsizeptr +Subject: [PATCH 07/12] fix heap-buffer-overflow in cellsizeptr This backports https://www.sqlite.org/src/info/e7aca0714bc475e0 @@ -29,8 +29,8 @@ + memset(pNew+pageSize, 0, 8); + } } - + if( rc==SQLITE_OK ){ --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0007-fix-integer-overflow-in-checkList.patch b/third_party/sqlite/patches/0008-fix-integer-overflow-in-checkList.patch similarity index 94% rename from third_party/sqlite/patches/0007-fix-integer-overflow-in-checkList.patch rename to third_party/sqlite/patches/0008-fix-integer-overflow-in-checkList.patch index 2c67373..ce027b73 100644 --- a/third_party/sqlite/patches/0007-fix-integer-overflow-in-checkList.patch +++ b/third_party/sqlite/patches/0008-fix-integer-overflow-in-checkList.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Darwin Huang <huangdarwin@chromium.org> Date: Tue, 5 Mar 2019 14:17:05 -0800 -Subject: [PATCH 07/11] fix integer overflow in checkList +Subject: [PATCH 08/12] fix integer overflow in checkList This backports https://www.sqlite.org/src/info/05b87e0755638d31 @@ -28,7 +28,7 @@ while( iPage!=0 && pCheck->mxErr ){ DbPage *pOvflPage; @@ -9797,7 +9797,7 @@ static int checkTreePage( - + /* Check the content overflow list */ if( info.nPayload>info.nLocal ){ - int nPage; /* Number of pages on the overflow chain */ @@ -36,6 +36,6 @@ Pgno pgnoOvfl; /* First page of the overflow chain */ assert( pc + info.nSize - 4 <= usableSize ); nPage = (info.nPayload - info.nLocal + usableSize - 5)/(usableSize - 4); --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0008-Fix-Heap-use-after-free-in-releasePageNotNull.patch b/third_party/sqlite/patches/0009-Fix-Heap-use-after-free-in-releasePageNotNull.patch similarity index 92% rename from third_party/sqlite/patches/0008-Fix-Heap-use-after-free-in-releasePageNotNull.patch rename to third_party/sqlite/patches/0009-Fix-Heap-use-after-free-in-releasePageNotNull.patch index cce0e58..d2f603319 100644 --- a/third_party/sqlite/patches/0008-Fix-Heap-use-after-free-in-releasePageNotNull.patch +++ b/third_party/sqlite/patches/0009-Fix-Heap-use-after-free-in-releasePageNotNull.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Darwin Huang <huangdarwin@chromium.org> Date: Tue, 12 Mar 2019 17:30:33 -0700 -Subject: [PATCH 08/11] Fix Heap-use-after-free in releasePageNotNull +Subject: [PATCH 09/12] Fix Heap-use-after-free in releasePageNotNull This backports https://www.sqlite.org/src/info/b0d5cf40bba34e45 @@ -28,6 +28,6 @@ pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC); if( pPager->tempFile ){ /* Do not discard pages from an in-memory database since we might --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0009-Fix-dangling-pointer-dereference.patch b/third_party/sqlite/patches/0010-Fix-dangling-pointer-dereference.patch similarity index 95% rename from third_party/sqlite/patches/0009-Fix-dangling-pointer-dereference.patch rename to third_party/sqlite/patches/0010-Fix-dangling-pointer-dereference.patch index d9b34b88..728c884 100644 --- a/third_party/sqlite/patches/0009-Fix-dangling-pointer-dereference.patch +++ b/third_party/sqlite/patches/0010-Fix-dangling-pointer-dereference.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Darwin Huang <huangdarwin@chromium.org> Date: Thu, 21 Mar 2019 13:19:11 -0700 -Subject: [PATCH 09/11] Fix dangling pointer dereference +Subject: [PATCH 10/12] Fix dangling pointer dereference This backports https://www.sqlite.org/src/info/b9e2393cf201e3fc @@ -32,7 +32,7 @@ @@ -79,7 +79,31 @@ do_execsql_test 3.2 { SELECT sql FROM sqlite_master WHERE name = 'v1' } {{CREATE VIEW v1 AS SELECT * FROM t1 WHERE a=1 OR (bbb IN ())}} - + +#------------------------------------------------------------------------- +reset_db +do_execsql_test 5.0 { @@ -44,7 +44,7 @@ +do_execsql_test 5.1 { + ALTER TABLE t1 RENAME c1 TO c3; +} - + +#------------------------------------------------------------------------- +reset_db +do_execsql_test 6.0 { @@ -58,9 +58,9 @@ +do_execsql_test 6.1 { + ALTER TABLE Table0 RENAME Col0 TO Col0; +} - + finish_test - --- -2.20.1 + +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0010-Fix-faulty-assert-statement.patch b/third_party/sqlite/patches/0011-Fix-faulty-assert-statement.patch similarity index 92% rename from third_party/sqlite/patches/0010-Fix-faulty-assert-statement.patch rename to third_party/sqlite/patches/0011-Fix-faulty-assert-statement.patch index a0c2235..3f53c85 100644 --- a/third_party/sqlite/patches/0010-Fix-faulty-assert-statement.patch +++ b/third_party/sqlite/patches/0011-Fix-faulty-assert-statement.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Darwin Huang <huangdarwin@chromium.org> Date: Wed, 27 Mar 2019 12:05:31 -0700 -Subject: [PATCH 10/11] Fix faulty assert statement +Subject: [PATCH 11/12] Fix faulty assert statement This backports https://www.sqlite.org/src/info/bcbe7d96df3c9515 @@ -24,6 +24,6 @@ || rc!=SQLITE_OK ); copyNodeContent(apNew[0], pParent, &rc); --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/third_party/sqlite/patches/0011-Add-dbfuzz2-progress-handler-patch.patch b/third_party/sqlite/patches/0012-Add-dbfuzz2-progress-handler-patch.patch similarity index 96% rename from third_party/sqlite/patches/0011-Add-dbfuzz2-progress-handler-patch.patch rename to third_party/sqlite/patches/0012-Add-dbfuzz2-progress-handler-patch.patch index 32fb274..f141ac5 100644 --- a/third_party/sqlite/patches/0011-Add-dbfuzz2-progress-handler-patch.patch +++ b/third_party/sqlite/patches/0012-Add-dbfuzz2-progress-handler-patch.patch
@@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Darwin Huang <huangdarwin@chromium.org> Date: Wed, 27 Mar 2019 12:10:17 -0700 -Subject: [PATCH 11/11] Add dbfuzz2 progress handler patch +Subject: [PATCH 12/12] Add dbfuzz2 progress handler patch This backports https://www.sqlite.org/src/info/b99f8512c06b9d47 @@ -17,7 +17,7 @@ @@ -74,6 +74,10 @@ static int bVdbeDebug = 0; /* Maximum size of the in-memory database file */ static sqlite3_int64 szMax = 104857600; - + +/* Progress handler callback data */ +static int nCb = 0; /* Number of callbacks seen so far */ +static int mxCb = 250000; /* Maximum allowed callbacks */ @@ -28,7 +28,7 @@ @@ -157,6 +161,21 @@ int sqlite3MemTraceDeactivate(void){ } /***** End copy/paste from ext/misc/memtrace.c ***************************/ - + +/* +** Progress handler callback +** @@ -79,6 +79,6 @@ if( strcmp(z,"memtrace")==0 ){ sqlite3MemTraceActivate(stdout); continue; --- -2.20.1 +-- +2.21.0.392.gf8f6787159e-goog
diff --git a/tools/chrome_proxy/webdriver/common.py b/tools/chrome_proxy/webdriver/common.py index 63c98c5..738e2c5 100644 --- a/tools/chrome_proxy/webdriver/common.py +++ b/tools/chrome_proxy/webdriver/common.py
@@ -259,8 +259,14 @@ arg_key = GetDictKey(override_arg) if (arg_key in original_args and original_args[arg_key] in self._chrome_args): - self._chrome_args.remove(original_args[arg_key]) - self._logger.info('Removed Chrome flag. %s', original_args[arg_key]) + if arg_key == '--enable-features': + new_features = override_arg[len('--enable-features='):] + self._chrome_args.remove(original_args[arg_key]) + override_arg = original_args[arg_key]+','+new_features + self._logger.info('Appended features. %s', new_features) + else: + self._chrome_args.remove(original_args[arg_key]) + self._logger.info('Removed Chrome flag. %s', original_args[arg_key]) self._chrome_args.add(override_arg) self._logger.info('Added Chrome flag. %s', override_arg) # Always add the flag that allows histograms to be queried in javascript.
diff --git a/tools/chrome_proxy/webdriver/fallback.py b/tools/chrome_proxy/webdriver/fallback.py index afb72bd..a28c325 100644 --- a/tools/chrome_proxy/webdriver/fallback.py +++ b/tools/chrome_proxy/webdriver/fallback.py
@@ -14,6 +14,9 @@ def testSecureProxyProbeFallback(self): with TestDriver() as test_driver: test_driver.AddChromeArg('--enable-spdy-proxy-auth') + test_driver.AddChromeArg( + '--enable-features=NetworkService,' + 'DataReductionProxyEnabledWithNetworkService') # Set the secure proxy check URL to the google.com favicon, which will be # interpreted as a secure proxy check failure since the response body is
diff --git a/tools/chrome_proxy/webdriver/lite_page.py b/tools/chrome_proxy/webdriver/lite_page.py index 5afe2da..3c84a4bb 100644 --- a/tools/chrome_proxy/webdriver/lite_page.py +++ b/tools/chrome_proxy/webdriver/lite_page.py
@@ -345,8 +345,11 @@ lite_page_responses = 0 page_policies_responses = 0 + checked_chrome_proxy_header = False for response in test_driver.GetHTTPResponses(): - self.assertEqual('2G', response.request_headers['chrome-proxy-ect']) + if response.request_headers: + self.assertEqual('2G', response.request_headers['chrome-proxy-ect']) + checked_chrome_proxy_header = True if response.url.endswith('html'): if self.checkLitePageResponse(response): lite_page_responses = lite_page_responses + 1 @@ -356,6 +359,7 @@ page_policies_responses = page_policies_responses + 1 self.assertTrue(lite_page_responses == 1 or page_policies_responses == 1) + self.assertTrue(checked_chrome_proxy_header) if (lite_page_responses == 1): self.assertPreviewShownViaHistogram(test_driver, 'LitePage') @@ -384,8 +388,11 @@ test_driver.LoadURL('http://check.googlezip.net/test.html') + checked_chrome_proxy_header = False for response in test_driver.GetHTTPResponses(): - self.assertEqual('4G', response.request_headers['chrome-proxy-ect']) + if response.request_headers: + self.assertEqual('4G', response.request_headers['chrome-proxy-ect']) + checked_chrome_proxy_header = True if response.url.endswith('html'): # Main resource should accept lite page but not be transformed. self.assertEqual('lite-page', @@ -403,6 +410,7 @@ self.assertPreviewNotShownViaHistogram(test_driver, 'LoFi') self.assertPreviewNotShownViaHistogram(test_driver, 'LitePage') + self.assertTrue(checked_chrome_proxy_header) # Checks the default of whether server previews are enabled or not # based on whether running on Android (enabled) or not (disabled).
diff --git a/tools/chrome_proxy/webdriver/smoke.py b/tools/chrome_proxy/webdriver/smoke.py index f0182cb..b29faa4 100644 --- a/tools/chrome_proxy/webdriver/smoke.py +++ b/tools/chrome_proxy/webdriver/smoke.py
@@ -127,6 +127,8 @@ pid_in_page_count = 0 page_id = '' for response in responses: + if not response.request_headers: + continue self.assertHasChromeProxyViaHeader(response) self.assertEqual(200, response.status) chrome_proxy_header = response.request_headers['chrome-proxy']
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 4e9b284..10b061f 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -35,7 +35,7 @@ # Do NOT CHANGE this if you don't know what you're doing -- see # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md # Reverting problematic clang rolls is safe, though. -CLANG_REVISION = '357316' +CLANG_REVISION = '356356' use_head_revision = bool(os.environ.get('LLVM_FORCE_HEAD_REVISION', '0') in ('1', 'YES')) @@ -43,7 +43,7 @@ CLANG_REVISION = 'HEAD' # This is incremented when pushing a new build of Clang at the same revision. -CLANG_SUB_REVISION=1 +CLANG_SUB_REVISION=3 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 3a75ac2..3eacc95 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -6116,6 +6116,11 @@ <description>Please enter the description of this user action.</description> </action> +<action name="IncognitoMenu_Show"> + <owner>rhalavati@chromium.org.</owner> + <description>The user opened incognito menu.</description> +</action> + <action name="IncompatibleApplicationsPage.ApplicationRemoved"> <owner>pmonette@chromium.org</owner> <description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 18cff590..af1aaef 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -4232,6 +4232,7 @@ <int value="18" label="Download auto-resumption task"/> <int value="19" label="One shot Background Sync wake up task"/> <int value="20" label="Notification scheduler task"/> + <int value="21" label="Notification trigger task"/> </enum> <enum name="BackgroundTracingState"> @@ -12216,6 +12217,7 @@ <int value="92" label="Incognito Window Counter"/> <int value="93" label="Crostini App Uninstaller"/> <int value="94" label="Crostini Container Upgrade"/> + <int value="95" label="Incognito Menu"/> </enum> <enum name="DialogOriginRelationship"> @@ -22731,6 +22733,7 @@ <int value="44" label="IdleDetection"/> <int value="45" label="UnoptimizedLossyImages"/> <int value="46" label="UnoptimizedLosslessImages"/> + <int value="47" label="UnoptimizedLosslessImagesStrict"/> </enum> <enum name="FeedbackSource"> @@ -33261,6 +33264,7 @@ <int value="-55592344" label="SyncPseudoUSSDictionary:disabled"/> <int value="-52483823" label="disable-new-video-renderer"/> <int value="-52241456" label="enable-single-click-autofill"/> + <int value="-51567065" label="EnableFeedbackPanel:disabled"/> <int value="-50628385" label="ContentSuggestionsThumbnailDominantColor:enabled"/> <int value="-50021298" label="ash-adjustable-large-cursor"/> @@ -33651,6 +33655,8 @@ <int value="609580715" label="ArcCupsApi:disabled"/> <int value="610545308" label="enable-potentially-annoying-security-features"/> <int value="613629912" label="LookalikeUrlNavigationSuggestions:enabled"/> + <int value="616660621" label="ImeInputLogicFst:disabled"/> + <int value="620989380" label="ImeInputLogicFst:enabled"/> <int value="623772100" label="EnableIncognitoWindowCounter:disabled"/> <int value="624317932" label="print-pdf-as-image"/> <int value="624368375" label="OmniboxEntitySuggestions:enabled"/> @@ -34547,6 +34553,7 @@ <int value="2005614493" label="tab-management-experiment-type-dill"/> <int value="2006413281" label="ContextualSuggestionsAlternateCardLayout:enabled"/> + <int value="2008599705" label="EnableFeedbackPanel:enabled"/> <int value="2009097351" label="memlog-sampling-rate"/> <int value="2009362691" label="AllowStartingServiceManagerOnly:enabled"/> <int value="2014331873" label="NTPDownloadSuggestions:disabled"/> @@ -43186,6 +43193,9 @@ </enum> <enum name="PasswordManagerSuppressedAccountCrossActionsTaken"> + <obsolete> + Deprecated 03/2019. + </obsolete> <summary> The value is a mixed-base encoding of the combination of four attributes: whether there were suppressed stored credentials (and the kind if there
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index cdebabee..7401f933 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -11701,7 +11701,8 @@ </summary> </histogram> -<histogram name="Blink.HandleInputEvents.UpdateTime" units="microseconds"> +<histogram name="Blink.HandleInputEvents.UpdateTime" units="microseconds" + expires_after="2019-11-30"> <owner>paint-dev@chromium.org</owner> <summary> Time spent processing rAF-aligned input during a main frame update. @@ -11858,6 +11859,17 @@ </summary> </histogram> +<histogram base="true" name="Blink.MainFrame.ProxyCommitRatio" units="%" + expires_after="2020-3-1"> + <owner>paint-dev@chromium.org</owner> +<!-- Name completed by histogram_suffixes name="BlinkMainFrameUpdateTimeSuffixes" --> + + <summary> + The percentage of time between a BeginMainFrame and paint results commit in + Blink that is used for committing the layer tree to the impl thread. + </summary> +</histogram> + <histogram base="true" name="Blink.MainFrame.StyleAndLayoutRatio" units="%" expires_after="2020-3-1"> <owner>paint-dev@chromium.org</owner> @@ -11869,6 +11881,17 @@ </summary> </histogram> +<histogram base="true" name="Blink.MainFrame.UpdateLayersRatio" units="%" + expires_after="2020-3-1"> + <owner>paint-dev@chromium.org</owner> +<!-- Name completed by histogram_suffixes name="BlinkMainFrameUpdateTimeSuffixes" --> + + <summary> + The percentage of time between a BeginMainFrame and paint results commit in + Blink that is spent in LayerTreeHost::UpdateLayers. + </summary> +</histogram> + <histogram name="Blink.MainFrame.UpdateTime" units="microseconds" expires_after="2020-3-1"> <owner>paint-dev@chromium.org</owner> @@ -12076,6 +12099,18 @@ </summary> </histogram> +<histogram name="Blink.ProxyCommit.UpdateTime" units="microseconds" + expires_after="2019-3-1"> + <owner>paint-dev@chromium.org</owner> + <summary> + Time spent commiting the layer tree to the impl thread in a main frame + update. + + Note: This histogram does not record metrics on machines with low-resolution + clocks. + </summary> +</histogram> + <histogram name="Blink.ResourceFetcher.StaleWhileRevalidate" enum="BooleanAttempted" expires_after="M77"> <owner>dtapuska@chromium.org</owner> @@ -39368,7 +39403,7 @@ </histogram> <histogram name="FontFallback.GetLinkedFonts.CacheMissTiming" units="ms" - expires_after="2019-05-01"> + expires_after="2019-11-01"> <owner>etienneb@chromium.org</owner> <summary> Time to retrieve the fallback fonts on the system when not found in cache. @@ -39376,13 +39411,13 @@ </histogram> <histogram name="FontFallback.GetLinkedFonts.FontCount" units="count" - expires_after="2019-05-01"> + expires_after="2019-11-01"> <owner>etienneb@chromium.org</owner> <summary>The amount of font returned for a given font family.</summary> </histogram> <histogram name="FontFallback.GetLinkedFonts.Timing" units="ms" - expires_after="2019-05-01"> + expires_after="2019-11-01"> <owner>etienneb@chromium.org</owner> <summary>Time to retrieve the fallback fonts on the system.</summary> </histogram> @@ -54982,28 +55017,6 @@ </summary> </histogram> -<histogram - name="Memory.Experimental.UserLevelMemoryPressureSignal.RendererPrivateMemoryFootprintAfter" - units="MB" expires_after="2019-09-30"> - <owner>keishi@chromium.org</owner> - <owner>tasak@chromium.org</owner> - <summary> - The renderer process' private memory footprint 10 seconds after a memory - pressure signal is generated. - </summary> -</histogram> - -<histogram - name="Memory.Experimental.UserLevelMemoryPressureSignal.RendererPrivateMemoryFootprintBefore" - units="MB" expires_after="2019-09-30"> - <owner>keishi@chromium.org</owner> - <owner>tasak@chromium.org</owner> - <summary> - The renderer process' private memory footprint right before a memory - pressure signal is generated. - </summary> -</histogram> - <histogram base="true" name="Memory.Experimental.Utility2" units="MB" expires_after="2019-12-31"> <!-- Name completed by histogram_suffixes name="ProcessMemoryAllocator2" --> @@ -85068,6 +85081,9 @@ <histogram name="PasswordManager.QueryingSuppressedAccountsFinished" enum="Boolean"> + <obsolete> + Deprecated 03/2019. + </obsolete> <owner>engedy@chromium.org</owner> <summary> Records, for each password form seen by the password manager, whether the @@ -85509,6 +85525,9 @@ <histogram name="PasswordManager.SuppressedAccount" enum="PasswordManagerSuppressedAccountCrossActionsTaken"> + <obsolete> + Deprecated 03/2019. + </obsolete> <owner>engedy@chromium.org</owner> <summary> Records, for each password form seen by the password manager, whether there @@ -138506,7 +138525,9 @@ <affected-histogram name="Blink.MainFrame.IntersectionObservationRatio"/> <affected-histogram name="Blink.MainFrame.PaintRatio"/> <affected-histogram name="Blink.MainFrame.PrePaintRatio"/> + <affected-histogram name="Blink.MainFrame.ProxyCommitRatio"/> <affected-histogram name="Blink.MainFrame.StyleAndLayoutRatio"/> + <affected-histogram name="Blink.MainFrame.UpdateLayersRatio"/> </histogram_suffixes> <histogram_suffixes name="BlinkVisibleLoadTimeSuffixes" separator="."> @@ -146745,6 +146766,9 @@ </histogram_suffixes> <histogram_suffixes name="PasswordManagerSuppressedAccountReason" separator="."> + <obsolete> + Deprecated 03/2019. + </obsolete> <suffix name="HTTPSNotHTTP" label="The credential was suppressed because it was for an HTTPS origin whereas the observed form was for an HTTP origin."/> @@ -146761,6 +146785,9 @@ </histogram_suffixes> <histogram_suffixes name="PasswordManagerSuppressedAccountType" separator="."> + <obsolete> + Deprecated 03/2019. + </obsolete> <suffix name="Generated" label="The password was originally auto-generated."/> <suffix name="Manual" label="The password was originally typed in by the user."/>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index 956d705..b05e4a8 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -1571,6 +1571,26 @@ range [0,100]. </summary> </metric> + <metric name="ProxyCommit"> + <summary> + The time taken for the proxy to commit to the impl thread in microseconds + during the sampled frame. + </summary> + <aggregation> + <history> + <index fields="profile.country"/> + <statistics> + <quantiles type="std-percentiles"/> + </statistics> + </history> + </aggregation> + </metric> + <metric name="ProxyCommitPercentage"> + <summary> + The percentage of the main frame time used to commit to the impl thread. + An int in the range [0,100]. + </summary> + </metric> <metric name="ScrollingCoordinator"> <summary> The time taken for scrolling coordinator for the main frame in @@ -1702,6 +1722,26 @@ int in the range [0,100]. </summary> </metric> + <metric name="UpdateLayers"> + <summary> + The time taken for LayerTreeHost::UpdateLayers in microseconds during the + sampled frame + </summary> + <aggregation> + <history> + <index fields="profile.country"/> + <statistics> + <quantiles type="std-percentiles"/> + </statistics> + </history> + </aggregation> + </metric> + <metric name="UpdateLayersPercentage"> + <summary> + The percentage of the main frame time used by LayerTreeHost::UpdateLayers. + An int in the range [0,100]. + </summary> + </metric> </event> <event name="Blink.UseCounter"> @@ -4947,6 +4987,9 @@ </summary> </metric> <metric name="SuppressedAccount.Generated.HTTPSNotHTTP"> + <obsolete> + Deprecated 03/2019. + </obsolete> <summary> Records, for each password form seen by the password manager, whether there were `suppressed` credentials, meaning stored credentials that were @@ -4960,6 +5003,9 @@ </summary> </metric> <metric name="SuppressedAccount.Generated.PSLMatching"> + <obsolete> + Deprecated 03/2019. + </obsolete> <summary> Records, for each password form seen by the password manager, whether there were `suppressed` credentials, meaning stored credentials that were @@ -4974,6 +5020,9 @@ </summary> </metric> <metric name="SuppressedAccount.Generated.SameOrganizationName"> + <obsolete> + Deprecated 03/2019. + </obsolete> <summary> Records, for each password form seen by the password manager, whether there were `suppressed` credentials, meaning stored credentials that were @@ -4987,6 +5036,9 @@ </summary> </metric> <metric name="SuppressedAccount.Manual.HTTPSNotHTTP"> + <obsolete> + Deprecated 03/2019. + </obsolete> <summary> Records, for each password form seen by the password manager, whether there were `suppressed` credentials, meaning stored credentials that were @@ -5000,6 +5052,9 @@ </summary> </metric> <metric name="SuppressedAccount.Manual.PSLMatching"> + <obsolete> + Deprecated 03/2019. + </obsolete> <summary> Records, for each password form seen by the password manager, whether there were `suppressed` credentials, meaning stored credentials that were @@ -5014,6 +5069,9 @@ </summary> </metric> <metric name="SuppressedAccount.Manual.SameOrganizationName"> + <obsolete> + Deprecated 03/2019. + </obsolete> <summary> Records, for each password form seen by the password manager, whether there were `suppressed` credentials, meaning stored credentials that were
diff --git a/tools/screenshot_testing/update_golden_screenshots.py b/tools/screenshot_testing/update_golden_screenshots.py deleted file mode 100644 index 6e14b851..0000000 --- a/tools/screenshot_testing/update_golden_screenshots.py +++ /dev/null
@@ -1,99 +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. - - -import sys -import getopt -import os - -here = os.path.realpath(__file__) -src_path = (os.path.normpath(os.path.join(here, '..', '..', '..'))) -sys.path.append(os.path.normpath(os.path.join(src_path, '..', 'depot_tools'))) - -USAGE = 'The utility uploads .png files to ' \ - 'chrome-os-oobe-ui-screenshot-testing Google Storage bucket.\n' \ - '-i:\n\tdirectory with .png files which have to be uploaded\n' \ - '-o (optional):\n\tdirectory to store generated .sha1 files. ' \ - 'Is set to chrome/browser/chromeos/login/screenshot_testing' \ - '/golden_screenshots by default\n--help:\n\thelp' - - -import upload_to_google_storage -import download_from_google_storage - -def upload(png_path): - - # Creating a list of files which need to be uploaded to Google Storage: - # all .png files from the directory containing golden screenshots. - target = [] - for file in os.listdir(png_path): - if file.endswith('.png'): - target.append(os.path.join(png_path, file)) - - # Creating a standard gsutil object, assuming there are depot_tools - # and everything related is set up already. - gsutil_path = os.path.abspath(os.path.join(src_path, '..', 'depot_tools', - 'third_party', 'gsutil', - 'gsutil')) - gsutil = download_from_google_storage.Gsutil(gsutil_path, - boto_path=None, - bypass_prodaccess=True) - - # URL of the bucket used for storing screenshots. - bucket_url = 'gs://chrome-os-oobe-ui-screenshot-testing' - - # Uploading using the most simple way, - # see depot_tools/upload_to_google_storage.py to have better understanding - # of this False and 1 arguments. - upload_to_google_storage.upload_to_google_storage(target, bucket_url, gsutil, - False, False, 1, False) - - print 'All images are uploaded to Google Storage.' - -def move_sha1(from_path, to_path): - from shutil import move - for file in os.listdir(from_path): - if (file.endswith('.sha1')): - old_place = os.path.join(from_path, file) - new_place = os.path.join(to_path, file) - if not os.path.exists(os.path.dirname(new_place)): - os.makedirs(os.path.dirname(new_place)) - move(old_place, new_place) - -def main(argv): - png_path = '' - sha1_path = os.path.join(src_path, - 'chrome', 'browser', 'chromeos', 'login', - 'screenshot_testing', 'golden_screenshots') - try: - opts, args = getopt.getopt(argv,'i:o:', ['--help']) - except getopt.GetoptError: - print USAGE - sys.exit(1) - for opt, arg in opts: - if opt == '--help': - print USAGE - sys.exit() - elif opt == '-i': - png_path = arg - elif opt =='-o': - sha1_path = arg - - if png_path == '': - print USAGE - sys.exit(1) - - png_path = os.path.abspath(png_path) - sha1_path = os.path.abspath(sha1_path) - - upload(png_path) - move_sha1(png_path, sha1_path) - - # TODO(elizavetai): Can this git stuff be done automatically? - print 'Please add new .sha1 files from ' \ - + str(sha1_path) + \ - ' to git manually.' - -if __name__ == "__main__": - main(sys.argv[1:]) \ No newline at end of file
diff --git a/ui/accessibility/BUILD.gn b/ui/accessibility/BUILD.gn index e06a784..2d1493fe 100644 --- a/ui/accessibility/BUILD.gn +++ b/ui/accessibility/BUILD.gn
@@ -115,6 +115,8 @@ "platform/ax_fragment_root_win.h", "platform/ax_platform_node_mac.h", "platform/ax_platform_node_mac.mm", + "platform/ax_platform_node_textchildprovider_win.cc", + "platform/ax_platform_node_textchildprovider_win.h", "platform/ax_platform_node_textprovider_win.cc", "platform/ax_platform_node_textprovider_win.h", "platform/ax_platform_node_textrangeprovider_win.cc", @@ -246,6 +248,7 @@ "mojom/ax_tree_id_mojom_traits_unittest.cc", "mojom/ax_tree_update_mojom_traits_unittest.cc", "platform/ax_fragment_root_win_unittest.cc", + "platform/ax_platform_node_textchildprovider_win_unittest.cc", "platform/ax_platform_node_textprovider_win_unittest.cc", "platform/ax_platform_node_textrangeprovider_win_unittest.cc", "platform/ax_platform_node_unittest.cc",
diff --git a/ui/accessibility/ax_tree.cc b/ui/accessibility/ax_tree.cc index 2ed547a5..80d0e46 100644 --- a/ui/accessibility/ax_tree.cc +++ b/ui/accessibility/ax_tree.cc
@@ -946,16 +946,13 @@ int original_level = original_node.GetIntAttribute( ax::mojom::IntAttribute::kHierarchicalLevel); // If original node is ordered set, then set its hierarchical level equal to - // its first child that sets a hierarchical level, if any. - if (ordered_set == &original_node) { - for (int32_t i = 0; i < original_node.GetUnignoredChildCount(); ++i) { - int32_t level = - original_node.GetUnignoredChildAtIndex(i)->GetIntAttribute( - ax::mojom::IntAttribute::kHierarchicalLevel); - if (level) - original_level = - original_level ? std::min(level, original_level) : level; - } + // its first child to ensure the items vector gets populated. + // This is due to ordered sets having a hierarchical level of 0, while their + // nodes have non-zero hierarchical values. + if ((ordered_set == &original_node) && + ordered_set->GetUnignoredChildAtIndex(0)) { + original_level = ordered_set->GetUnignoredChildAtIndex(0)->GetIntAttribute( + ax::mojom::IntAttribute::kHierarchicalLevel); } int original_node_index = original_node.GetUnignoredIndexInParent(); bool node_is_radio_button =
diff --git a/ui/accessibility/platform/ax_platform_node_textchildprovider_win.cc b/ui/accessibility/platform/ax_platform_node_textchildprovider_win.cc new file mode 100644 index 0000000..2175db4 --- /dev/null +++ b/ui/accessibility/platform/ax_platform_node_textchildprovider_win.cc
@@ -0,0 +1,102 @@ +// 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 "ui/accessibility/platform/ax_platform_node_textchildprovider_win.h" + +#include <UIAutomationClient.h> +#include <UIAutomationCoreApi.h> + +#include "ui/accessibility/platform/ax_platform_node_textprovider_win.h" +#include "ui/base/win/atl_module.h" + +#define UIA_VALIDATE_TEXTCHILDPROVIDER_CALL() \ + if (!owner()->GetDelegate()) \ + return UIA_E_ELEMENTNOTAVAILABLE; + +namespace ui { + +namespace { + +AXPlatformNodeWin* GetParentAXPlatformNodeWin(AXPlatformNodeWin* node) { + gfx::NativeViewAccessible native_parent = node->GetParent(); + + DCHECK(native_parent != node->GetNativeViewAccessible()); + + return static_cast<AXPlatformNodeWin*>( + AXPlatformNode::FromNativeViewAccessible(native_parent)); +} + +} // namespace + +AXPlatformNodeTextChildProviderWin::AXPlatformNodeTextChildProviderWin() { + DVLOG(1) << __func__; +} + +AXPlatformNodeTextChildProviderWin::~AXPlatformNodeTextChildProviderWin() {} + +HRESULT AXPlatformNodeTextChildProviderWin::CreateTextChildProvider( + AXPlatformNodeWin* owner, + IUnknown** provider) { + win::CreateATLModuleIfNeeded(); + + CComObject<AXPlatformNodeTextChildProviderWin>* text_child_provider = nullptr; + HRESULT hr = CComObject<AXPlatformNodeTextChildProviderWin>::CreateInstance( + &text_child_provider); + if (SUCCEEDED(hr)) { + DCHECK(text_child_provider); + text_child_provider->owner_ = owner; + text_child_provider->AddRef(); + *provider = static_cast<ITextChildProvider*>(text_child_provider); + } + + return hr; +} + +STDMETHODIMP AXPlatformNodeTextChildProviderWin::get_TextContainer( + IRawElementProviderSimple** result) { + WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TEXTCHILD_GET_TEXTCONTAINER); + UIA_VALIDATE_TEXTCHILDPROVIDER_CALL(); + + *result = nullptr; + + AXPlatformNodeWin* container = GetTextContainer(owner_); + if (container) + container->QueryInterface(IID_PPV_ARGS(result)); + + return S_OK; +} + +STDMETHODIMP AXPlatformNodeTextChildProviderWin::get_TextRange( + ITextRangeProvider** result) { + WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TEXTCHILD_GET_TEXTRANGE); + UIA_VALIDATE_TEXTCHILDPROVIDER_CALL(); + + *result = nullptr; + + AXPlatformNodeWin* container = GetTextContainer(owner_); + if (container && container->IsDescendant(owner())) { + *result = + AXPlatformNodeTextProviderWin::GetRangeFromChild(container, owner()); + } + + return S_OK; +} + +AXPlatformNodeWin* AXPlatformNodeTextChildProviderWin::GetTextContainer( + AXPlatformNodeWin* descendant) { + for (AXPlatformNodeWin* parent = GetParentAXPlatformNodeWin(descendant); + parent; parent = GetParentAXPlatformNodeWin(parent)) { + if (parent->IsPatternProviderSupported(UIA_TextPatternId)) { + return parent; + } + } + + return nullptr; +} + +AXPlatformNodeWin* AXPlatformNodeTextChildProviderWin::owner() const { + return owner_; +} + +} // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node_textchildprovider_win.h b/ui/accessibility/platform/ax_platform_node_textchildprovider_win.h new file mode 100644 index 0000000..029516d8 --- /dev/null +++ b/ui/accessibility/platform/ax_platform_node_textchildprovider_win.h
@@ -0,0 +1,48 @@ +// 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 UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_TEXTCHILDPROVIDER_WIN_H_ +#define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_TEXTCHILDPROVIDER_WIN_H_ + +#include "ui/accessibility/platform/ax_platform_node_win.h" + +namespace ui { +class AXPlatformNodeTextChildProviderWin + : public CComObjectRootEx<CComMultiThreadModel>, + public ITextChildProvider { + public: + BEGIN_COM_MAP(AXPlatformNodeTextChildProviderWin) + COM_INTERFACE_ENTRY(ITextChildProvider) + END_COM_MAP() + + AXPlatformNodeTextChildProviderWin(); + ~AXPlatformNodeTextChildProviderWin(); + + static HRESULT CreateTextChildProvider(AXPlatformNodeWin* owner, + IUnknown** provider); + + // Retrieves this element's nearest ancestor provider that supports the Text + // control pattern. If the element does not have an ancestor which supports + // the Text control pattern, nullptr is returned. Note, an element which + // supports the Text control pattern is not an ancestor of itself. + STDMETHOD(get_TextContainer)(IRawElementProviderSimple** pRetVal) override; + + // Retrieves a text range that encloses this child element. If the element + // does not have an ancestor which supports the Text control pattern, nullptr + // is returned. Note, an element which supports the Text control pattern is + // not an ancestor of itself. + STDMETHOD(get_TextRange)(ITextRangeProvider** pRetVal) override; + + // Helper function to get_TextContainer(). + static AXPlatformNodeWin* GetTextContainer(AXPlatformNodeWin* descendant); + + private: + AXPlatformNodeWin* owner() const; + + CComPtr<AXPlatformNodeWin> owner_; +}; + +} // namespace ui + +#endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_TEXTCHILDPROVIDER_WIN_H_
diff --git a/ui/accessibility/platform/ax_platform_node_textchildprovider_win_unittest.cc b/ui/accessibility/platform/ax_platform_node_textchildprovider_win_unittest.cc new file mode 100644 index 0000000..37bf56a1 --- /dev/null +++ b/ui/accessibility/platform/ax_platform_node_textchildprovider_win_unittest.cc
@@ -0,0 +1,342 @@ +// 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 "ui/accessibility/platform/ax_platform_node_win_unittest.h" + +#include "ui/accessibility/platform/ax_fragment_root_win.h" +#include "ui/accessibility/platform/ax_platform_node_textchildprovider_win.cc" +#include "ui/accessibility/platform/ax_platform_node_textprovider_win.cc" +#include "ui/accessibility/platform/ax_platform_node_textrangeprovider_win.cc" + +using Microsoft::WRL::ComPtr; + +namespace ui { + +class AXPlatformNodeTextChildProviderTest : public ui::AXPlatformNodeWinTest { + protected: + // Construct an accessibility tree for testing ITextChildProvider resolution + // from various positions in the tree. The following tree configuration + // is constructed: + // + // root_______________ + // | | + // nontext____ text + // | | | + // nontext text text + void SetUp() override { + ui::AXNodeData root; + root.id = 0; + root.role = ax::mojom::Role::kRootWebArea; + + ui::AXNodeData nontext_child_of_root; + nontext_child_of_root.id = 1; + nontext_child_of_root.role = ax::mojom::Role::kGroup; + root.child_ids.push_back(1); + + ui::AXNodeData text_child_of_root; + text_child_of_root.id = 2; + text_child_of_root.role = ax::mojom::Role::kStaticText; + root.child_ids.push_back(2); + + ui::AXNodeData nontext_child_of_nontext; + nontext_child_of_nontext.id = 3; + nontext_child_of_nontext.role = ax::mojom::Role::kGroup; + nontext_child_of_root.child_ids.push_back(3); + + ui::AXNodeData text_child_of_nontext; + text_child_of_nontext.id = 4; + text_child_of_nontext.role = ax::mojom::Role::kStaticText; + nontext_child_of_root.child_ids.push_back(4); + + ui::AXNodeData text_child_of_text; + text_child_of_text.id = 5; + text_child_of_text.role = ax::mojom::Role::kStaticText; + text_child_of_root.child_ids.push_back(5); + + ui::AXTreeUpdate update; + ui::AXTreeData tree_data; + tree_data.tree_id = ui::AXTreeID::CreateNewAXTreeID(); + update.tree_data = tree_data; + update.has_tree_data = true; + update.root_id = root.id; + update.nodes.push_back(root); + update.nodes.push_back(nontext_child_of_root); + update.nodes.push_back(text_child_of_root); + update.nodes.push_back(nontext_child_of_nontext); + update.nodes.push_back(text_child_of_nontext); + update.nodes.push_back(text_child_of_text); + + Init(update); + + AXNode* root_node = GetRootNode(); + AXNodePosition::SetTreeForTesting(tree_.get()); + AXNode* nontext_child_of_root_node = root_node->children()[0]; + AXNode* text_child_of_root_node = root_node->children()[1]; + AXNode* nontext_child_of_nontext_node = + nontext_child_of_root_node->children()[0]; + AXNode* text_child_of_nontext_node = + nontext_child_of_root_node->children()[1]; + AXNode* text_child_of_text_node = text_child_of_root_node->children()[0]; + + InitITextChildProvider(root_node, root_provider_raw_, + root_text_child_provider_); + InitITextChildProvider(nontext_child_of_root_node, + nontext_child_of_root_provider_raw_, + nontext_child_of_root_text_child_provider_); + InitITextChildProvider(text_child_of_root_node, + text_child_of_root_text_provider_raw_, + text_child_of_root_text_child_provider_); + InitITextChildProvider(nontext_child_of_nontext_node, + nontext_child_of_nontext_text_provider_raw_, + nontext_child_of_nontext_text_child_provider_); + InitITextChildProvider(text_child_of_nontext_node, + text_child_of_nontext_text_provider_raw_, + text_child_of_nontext_text_child_provider_); + InitITextChildProvider(text_child_of_text_node, + text_child_of_text_text_provider_raw_, + text_child_of_text_text_child_provider_); + } + + void TearDown() override { AXNodePosition::SetTreeForTesting(nullptr); } + + void InitITextChildProvider( + AXNode* node, + ComPtr<IRawElementProviderSimple>& raw_element_provider, + ComPtr<ITextChildProvider>& text_child_provider) { + raw_element_provider = + QueryInterfaceFromNode<IRawElementProviderSimple>(node); + + EXPECT_HRESULT_SUCCEEDED(raw_element_provider->GetPatternProvider( + UIA_TextChildPatternId, &text_child_provider)); + + // If the element does not support ITextChildProvider, create one anyways + // for testing purposes. + if (!text_child_provider) { + ui::AXPlatformNodeWin* platform_node = + (ui::AXPlatformNodeWin*)raw_element_provider.Get(); + ui::AXPlatformNodeTextChildProviderWin::CreateTextChildProvider( + platform_node, &text_child_provider); + } + } + + ComPtr<IRawElementProviderSimple> root_provider_raw_; + ComPtr<IRawElementProviderSimple> nontext_child_of_root_provider_raw_; + ComPtr<IRawElementProviderSimple> text_child_of_root_text_provider_raw_; + ComPtr<IRawElementProviderSimple> nontext_child_of_nontext_text_provider_raw_; + ComPtr<IRawElementProviderSimple> text_child_of_nontext_text_provider_raw_; + ComPtr<IRawElementProviderSimple> text_child_of_text_text_provider_raw_; + + ComPtr<ITextChildProvider> root_text_child_provider_; + ComPtr<ITextChildProvider> nontext_child_of_root_text_child_provider_; + ComPtr<ITextChildProvider> text_child_of_root_text_child_provider_; + ComPtr<ITextChildProvider> nontext_child_of_nontext_text_child_provider_; + ComPtr<ITextChildProvider> text_child_of_nontext_text_child_provider_; + ComPtr<ITextChildProvider> text_child_of_text_text_child_provider_; +}; + +// ITextChildProvider::TextContainer Tests +// +// For each possible position in the tree verify: +// 1) A text container can/cannot be retrieved if an ancestor does/doesn't +// support the UIA Text control pattern. +// 2) Any retrieved text container is the nearest ancestor text container. +// 3) A Text control can in fact be retrieved from any retrieved text +// container. + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextContainerFromRoot) { + CComPtr<IRawElementProviderSimple> text_container; + ASSERT_HRESULT_SUCCEEDED( + root_text_child_provider_->get_TextContainer(&text_container)); + ASSERT_EQ(nullptr, text_container); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextContainerFromNontextChildOfRoot) { + CComPtr<IRawElementProviderSimple> text_container; + ASSERT_HRESULT_SUCCEEDED( + nontext_child_of_root_text_child_provider_->get_TextContainer( + &text_container)); + ASSERT_NE(nullptr, text_container); + + ASSERT_EQ(root_provider_raw_.Get(), text_container); + + CComPtr<ITextProvider> text_container_text_provider; + text_container->GetPatternProvider( + UIA_TextPatternId, + reinterpret_cast<IUnknown**>(&text_container_text_provider)); + ASSERT_NE(nullptr, text_container_text_provider); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextContainerFromTextChildOfRoot) { + CComPtr<IRawElementProviderSimple> text_container; + ASSERT_HRESULT_SUCCEEDED( + text_child_of_root_text_child_provider_->get_TextContainer( + &text_container)); + ASSERT_NE(nullptr, text_container); + + ASSERT_EQ(root_provider_raw_.Get(), text_container); + + CComPtr<ITextProvider> text_container_text_provider; + text_container->GetPatternProvider( + UIA_TextPatternId, + reinterpret_cast<IUnknown**>(&text_container_text_provider)); + ASSERT_NE(nullptr, text_container_text_provider); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextContainerFromNontextChildOfNontext) { + CComPtr<IRawElementProviderSimple> text_container; + ASSERT_HRESULT_SUCCEEDED( + nontext_child_of_nontext_text_child_provider_->get_TextContainer( + &text_container)); + ASSERT_NE(nullptr, text_container); + + ASSERT_EQ(root_provider_raw_.Get(), text_container); + + CComPtr<ITextProvider> text_container_text_provider; + text_container->GetPatternProvider( + UIA_TextPatternId, + reinterpret_cast<IUnknown**>(&text_container_text_provider)); + ASSERT_NE(nullptr, text_container_text_provider); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextContainerFromTextChildOfNontext) { + CComPtr<IRawElementProviderSimple> text_container; + ASSERT_HRESULT_SUCCEEDED( + text_child_of_nontext_text_child_provider_->get_TextContainer( + &text_container)); + ASSERT_NE(nullptr, text_container); + + ASSERT_EQ(root_provider_raw_.Get(), text_container); + + CComPtr<ITextProvider> text_container_text_provider; + text_container->GetPatternProvider( + UIA_TextPatternId, + reinterpret_cast<IUnknown**>(&text_container_text_provider)); + ASSERT_NE(nullptr, text_container_text_provider); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextContainerFromTextChildOfText) { + CComPtr<IRawElementProviderSimple> text_container; + ASSERT_HRESULT_SUCCEEDED( + text_child_of_text_text_child_provider_->get_TextContainer( + &text_container)); + ASSERT_NE(nullptr, text_container); + + ASSERT_EQ(text_child_of_root_text_provider_raw_.Get(), text_container); + + CComPtr<ITextProvider> text_container_text_provider; + text_container->GetPatternProvider( + UIA_TextPatternId, + reinterpret_cast<IUnknown**>(&text_container_text_provider)); + ASSERT_NE(nullptr, text_container_text_provider); +} + +// ITextChildProvider::TextRange Tests +// +// For each possible position in the tree verify: +// 1) A text range can/cannot be retrieved if an ancestor does/doesn't +// support the UIA Text control pattern. +// 2) Any retrieved text range encloses the child element. +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextRangeFromRoot) { + CComPtr<ITextRangeProvider> text_range_provider; + ASSERT_HRESULT_SUCCEEDED( + root_text_child_provider_->get_TextRange(&text_range_provider)); + ASSERT_EQ(nullptr, text_range_provider); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextRangeFromNontextChildOfRoot) { + CComPtr<ITextRangeProvider> text_range_provider; + ASSERT_HRESULT_SUCCEEDED( + nontext_child_of_root_text_child_provider_->get_TextRange( + &text_range_provider)); + ASSERT_NE(nullptr, text_range_provider); + + CComPtr<IRawElementProviderSimple> enclosing_element; + text_range_provider->GetEnclosingElement(&enclosing_element); + ASSERT_EQ(nontext_child_of_nontext_text_provider_raw_.Get(), + enclosing_element); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextRangeFromTextChildOfRoot) { + CComPtr<ITextRangeProvider> text_range_provider; + ASSERT_HRESULT_SUCCEEDED( + text_child_of_root_text_child_provider_->get_TextRange( + &text_range_provider)); + ASSERT_NE(nullptr, text_range_provider); + + CComPtr<IRawElementProviderSimple> enclosing_element; + text_range_provider->GetEnclosingElement(&enclosing_element); + ASSERT_EQ(text_child_of_text_text_provider_raw_.Get(), enclosing_element); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextRangeFromNontextChildOfNontext) { + CComPtr<ITextRangeProvider> text_range_provider; + ASSERT_HRESULT_SUCCEEDED( + nontext_child_of_nontext_text_child_provider_->get_TextRange( + &text_range_provider)); + ASSERT_NE(nullptr, text_range_provider); + + CComPtr<IRawElementProviderSimple> enclosing_element; + text_range_provider->GetEnclosingElement(&enclosing_element); + ASSERT_EQ(nontext_child_of_nontext_text_provider_raw_.Get(), + enclosing_element); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextRangeFromTextChildOfNontext) { + CComPtr<ITextRangeProvider> text_range_provider; + ASSERT_HRESULT_SUCCEEDED( + text_child_of_nontext_text_child_provider_->get_TextRange( + &text_range_provider)); + ASSERT_NE(nullptr, text_range_provider); + + CComPtr<IRawElementProviderSimple> enclosing_element; + text_range_provider->GetEnclosingElement(&enclosing_element); + ASSERT_EQ(text_child_of_nontext_text_provider_raw_.Get(), enclosing_element); +} + +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderTextRangeFromTextChildOfText) { + CComPtr<ITextRangeProvider> text_range_provider; + ASSERT_HRESULT_SUCCEEDED( + text_child_of_text_text_child_provider_->get_TextRange( + &text_range_provider)); + ASSERT_NE(nullptr, text_range_provider); + + CComPtr<IRawElementProviderSimple> enclosing_element; + text_range_provider->GetEnclosingElement(&enclosing_element); + ASSERT_EQ(text_child_of_text_text_provider_raw_.Get(), enclosing_element); +} + +// ITextChildProvider Tests - Inactive AX Tree +// +// Test that both ITextChildProvider::GetTextContainer and +// ITextChildProvider::GetTextContainer fail under an inactive AX tree. +TEST_F(AXPlatformNodeTextChildProviderTest, + TestITextChildProviderInactiveAccessibilityTree) { + tree_.reset(); + + // Test that GetTextContainer fails under an inactive tree. + CComPtr<IRawElementProviderSimple> text_container; + HRESULT hr = nontext_child_of_root_text_child_provider_->get_TextContainer( + &text_container); + ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), hr); + + // Test that GetTextRange fails under an inactive tree. + CComPtr<ITextRangeProvider> text_range_provider; + hr = nontext_child_of_root_text_child_provider_->get_TextRange( + &text_range_provider); + ASSERT_EQ(static_cast<HRESULT>(UIA_E_ELEMENTNOTAVAILABLE), hr); +} + +} // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node_textprovider_win.cc b/ui/accessibility/platform/ax_platform_node_textprovider_win.cc index ea2f2bb..529906e 100644 --- a/ui/accessibility/platform/ax_platform_node_textprovider_win.cc +++ b/ui/accessibility/platform/ax_platform_node_textprovider_win.cc
@@ -133,32 +133,21 @@ STDMETHODIMP AXPlatformNodeTextProviderWin::RangeFromChild( IRawElementProviderSimple* child, ITextRangeProvider** range) { + WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TEXT_RANGEFROMCHILD); UIA_VALIDATE_TEXTPROVIDER_CALL_1_ARG(child); - DVLOG(1) << __func__; - *range = nullptr; Microsoft::WRL::ComPtr<ui::AXPlatformNodeWin> child_platform_node; - if (child->QueryInterface(IID_PPV_ARGS(&child_platform_node)) != S_OK) + if (!SUCCEEDED(child->QueryInterface(IID_PPV_ARGS(&child_platform_node)))) return UIA_E_INVALIDOPERATION; if (!owner()->IsDescendant(child_platform_node.Get())) return E_INVALIDARG; - // Start and end should be leaf text positions. - AXNodePosition::AXPositionInstance start = child_platform_node->GetDelegate() - ->CreateTextPositionAt(0) - ->AsLeafTextPosition(); + *range = GetRangeFromChild(owner(), child_platform_node.Get()); - AXNodePosition::AXPositionInstance end = - child_platform_node->GetDelegate() - ->CreateTextPositionAt(start->MaxTextOffset()) - ->AsLeafTextPosition() - ->CreatePositionAtEndOfAnchor(); - - return AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( - owner_, std::move(start), std::move(end), range); + return S_OK; } STDMETHODIMP AXPlatformNodeTextProviderWin::RangeFromPoint( @@ -231,6 +220,34 @@ return E_NOTIMPL; } +ITextRangeProvider* AXPlatformNodeTextProviderWin::GetRangeFromChild( + ui::AXPlatformNodeWin* ancestor, + ui::AXPlatformNodeWin* descendant) { + ITextRangeProvider* range = nullptr; + + DCHECK(ancestor); + DCHECK(descendant); + DCHECK(descendant->GetDelegate()); + DCHECK(ancestor->IsDescendant(descendant)); + + // Start and end should be leaf text positions. + AXNodePosition::AXPositionInstance start = + descendant->GetDelegate()->CreateTextPositionAt(0)->AsLeafTextPosition(); + + AXNodePosition::AXPositionInstance end = + descendant->GetDelegate() + ->CreateTextPositionAt(start->MaxTextOffset()) + ->AsLeafTextPosition() + ->CreatePositionAtEndOfAnchor(); + + if (!SUCCEEDED(AXPlatformNodeTextRangeProviderWin::CreateTextRangeProvider( + ancestor, std::move(start), std::move(end), &range))) { + return nullptr; + } + + return range; +} + ui::AXPlatformNodeWin* AXPlatformNodeTextProviderWin::owner() const { return owner_; }
diff --git a/ui/accessibility/platform/ax_platform_node_textprovider_win.h b/ui/accessibility/platform/ax_platform_node_textprovider_win.h index 003bfad..4e77aeb 100644 --- a/ui/accessibility/platform/ax_platform_node_textprovider_win.h +++ b/ui/accessibility/platform/ax_platform_node_textprovider_win.h
@@ -53,6 +53,12 @@ STDMETHOD(GetConversionTarget)(ITextRangeProvider** range) override; + // ITextProvider supporting methods. + + static ITextRangeProvider* GetRangeFromChild( + ui::AXPlatformNodeWin* ancestor, + ui::AXPlatformNodeWin* descendant); + private: friend class AXPlatformNodeTextProviderTest; ui::AXPlatformNodeWin* owner() const;
diff --git a/ui/accessibility/platform/ax_platform_node_win.cc b/ui/accessibility/platform/ax_platform_node_win.cc index 4ac0780..733aef6 100644 --- a/ui/accessibility/platform/ax_platform_node_win.cc +++ b/ui/accessibility/platform/ax_platform_node_win.cc
@@ -34,6 +34,7 @@ #include "ui/accessibility/platform/ax_fragment_root_win.h" #include "ui/accessibility/platform/ax_platform_node_delegate.h" #include "ui/accessibility/platform/ax_platform_node_delegate_utils_win.h" +#include "ui/accessibility/platform/ax_platform_node_textchildprovider_win.h" #include "ui/accessibility/platform/ax_platform_node_textprovider_win.h" #include "ui/accessibility/platform/ax_platform_relation_win.h" #include "ui/base/win/atl_module.h" @@ -201,6 +202,15 @@ *string += base::string16(L". ") + extra_text; } +// Helper function to GetPatternProviderFactoryMethod that, given a node, +// will return a pattern interface through result based on the provided type T. +template <typename T> +HRESULT PatternProvider(AXPlatformNodeWin* node, IUnknown** result) { + node->AddRef(); + *result = static_cast<T*>(node); + return S_OK; +} + } // namespace void AXPlatformNodeWin::AddAttributeToList(const char* name, @@ -3494,137 +3504,13 @@ WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_PATTERN_PROVIDER); UIA_VALIDATE_CALL_1_ARG(result); - const AXNodeData& data = GetData(); + *result = nullptr; - switch (pattern_id) { - case UIA_ExpandCollapsePatternId: - if (SupportsExpandCollapse(data)) { - AddRef(); - *result = static_cast<IExpandCollapseProvider*>(this); - } - break; + PatternProviderFactoryMethod factory_method = + GetPatternProviderFactoryMethod(pattern_id); + if (factory_method) + (*factory_method)(this, result); - case UIA_GridPatternId: - if (IsTableLike(data.role)) { - AddRef(); - *result = static_cast<IGridProvider*>(this); - } - break; - - case UIA_GridItemPatternId: - if (IsCellOrTableHeader(data.role)) { - AddRef(); - *result = static_cast<IGridItemProvider*>(this); - } - break; - - case UIA_InvokePatternId: - if (IsInvokable(data)) { - AddRef(); - *result = static_cast<IInvokeProvider*>(this); - } - break; - - case UIA_RangeValuePatternId: - if (IsRangeValueSupported(data)) { - AddRef(); - *result = static_cast<IRangeValueProvider*>(this); - } - break; - - case UIA_ScrollPatternId: - if (IsScrollable()) { - AddRef(); - *result = static_cast<IScrollProvider*>(this); - } - break; - - case UIA_ScrollItemPatternId: - AddRef(); - *result = static_cast<IScrollItemProvider*>(this); - break; - - case UIA_SelectionItemPatternId: - if (IsSelectionItemSupported()) { - AddRef(); - *result = static_cast<ISelectionItemProvider*>(this); - } - break; - - case UIA_SelectionPatternId: - if (IsContainerWithSelectableChildren(data.role)) { - AddRef(); - *result = static_cast<ISelectionProvider*>(this); - } - break; - - case UIA_TablePatternId: - if (IsTableLike(data.role)) { - AddRef(); - *result = static_cast<ITableProvider*>(this); - } - break; - - case UIA_TableItemPatternId: - if (IsCellOrTableHeader(data.role)) { - AddRef(); - *result = static_cast<ITableItemProvider*>(this); - } - break; - - case UIA_TextEditPatternId: - case UIA_TextPatternId: - if (IsTextOnlyObject() || IsDocument() || - HasBoolAttribute(ax::mojom::BoolAttribute::kEditableRoot)) { - return AXPlatformNodeTextProviderWin::Create(this, result); - } - break; - - case UIA_TogglePatternId: - if (SupportsToggle(data.role)) { - AddRef(); - *result = static_cast<IToggleProvider*>(this); - } - break; - - case UIA_ValuePatternId: - if (IsValuePatternSupported(GetDelegate())) { - AddRef(); - *result = static_cast<IValueProvider*>(this); - } - break; - - case UIA_WindowPatternId: - if (HasBoolAttribute(ax::mojom::BoolAttribute::kModal)) { - AddRef(); - *result = static_cast<IWindowProvider*>(this); - } - break; - - // Not currently implemented. - case UIA_AnnotationPatternId: - case UIA_CustomNavigationPatternId: - case UIA_DockPatternId: - case UIA_DragPatternId: - case UIA_DropTargetPatternId: - case UIA_ItemContainerPatternId: - case UIA_MultipleViewPatternId: - case UIA_ObjectModelPatternId: - case UIA_SpreadsheetPatternId: - case UIA_SpreadsheetItemPatternId: - case UIA_StylesPatternId: - case UIA_SynchronizedInputPatternId: - case UIA_TextChildPatternId: - case UIA_TextPattern2Id: - case UIA_TransformPatternId: - case UIA_TransformPattern2Id: - case UIA_VirtualizedItemPatternId: - break; - - // Provided by UIA Core; we should not implement. - case UIA_LegacyIAccessiblePatternId: - break; - } return S_OK; } @@ -4101,6 +3987,12 @@ return S_OK; } +// IRawElementProviderSimple support methods. + +bool AXPlatformNodeWin::IsPatternProviderSupported(PATTERNID pattern_id) { + return GetPatternProviderFactoryMethod(pattern_id); +} + // // Private member functions. // @@ -6710,4 +6602,133 @@ return 100.0 * (y - y_min) / (y_max - y_min); } +// IRawElementProviderSimple support methods. + +AXPlatformNodeWin::PatternProviderFactoryMethod +AXPlatformNodeWin::GetPatternProviderFactoryMethod(PATTERNID pattern_id) { + const AXNodeData& data = GetData(); + + switch (pattern_id) { + case UIA_ExpandCollapsePatternId: + if (SupportsExpandCollapse(data)) { + return &PatternProvider<IExpandCollapseProvider>; + } + break; + + case UIA_GridPatternId: + if (IsTableLike(data.role)) { + return &PatternProvider<IGridProvider>; + } + break; + + case UIA_GridItemPatternId: + if (IsCellOrTableHeader(data.role)) { + return &PatternProvider<IGridItemProvider>; + } + break; + + case UIA_InvokePatternId: + if (IsInvokable(data)) { + return &PatternProvider<IInvokeProvider>; + } + break; + + case UIA_RangeValuePatternId: + if (IsRangeValueSupported(data)) { + return &PatternProvider<IRangeValueProvider>; + } + break; + + case UIA_ScrollPatternId: + if (IsScrollable()) { + return &PatternProvider<IScrollProvider>; + } + break; + + case UIA_ScrollItemPatternId: + return &PatternProvider<IScrollItemProvider>; + break; + + case UIA_SelectionItemPatternId: + if (IsSelectionItemSupported()) { + return &PatternProvider<ISelectionItemProvider>; + } + break; + + case UIA_SelectionPatternId: + if (IsContainerWithSelectableChildren(data.role)) { + return &PatternProvider<ISelectionProvider>; + } + break; + + case UIA_TablePatternId: + if (IsTableLike(data.role)) { + return &PatternProvider<ITableProvider>; + } + break; + + case UIA_TableItemPatternId: + if (IsCellOrTableHeader(data.role)) { + return &PatternProvider<ITableItemProvider>; + } + break; + + case UIA_TextChildPatternId: + if (AXPlatformNodeTextChildProviderWin::GetTextContainer(this)) { + return &AXPlatformNodeTextChildProviderWin::CreateTextChildProvider; + } + break; + + case UIA_TextEditPatternId: + case UIA_TextPatternId: + if (IsTextOnlyObject() || IsDocument() || + HasBoolAttribute(ax::mojom::BoolAttribute::kEditableRoot)) { + return &AXPlatformNodeTextProviderWin::Create; + } + break; + + case UIA_TogglePatternId: + if (SupportsToggle(data.role)) { + return &PatternProvider<IToggleProvider>; + } + break; + + case UIA_ValuePatternId: + if (IsValuePatternSupported(GetDelegate())) { + return &PatternProvider<IValueProvider>; + } + break; + + case UIA_WindowPatternId: + if (HasBoolAttribute(ax::mojom::BoolAttribute::kModal)) { + return &PatternProvider<IWindowProvider>; + } + break; + + // Not currently implemented. + case UIA_AnnotationPatternId: + case UIA_CustomNavigationPatternId: + case UIA_DockPatternId: + case UIA_DragPatternId: + case UIA_DropTargetPatternId: + case UIA_ItemContainerPatternId: + case UIA_MultipleViewPatternId: + case UIA_ObjectModelPatternId: + case UIA_SpreadsheetPatternId: + case UIA_SpreadsheetItemPatternId: + case UIA_StylesPatternId: + case UIA_SynchronizedInputPatternId: + case UIA_TextPattern2Id: + case UIA_TransformPatternId: + case UIA_TransformPattern2Id: + case UIA_VirtualizedItemPatternId: + break; + + // Provided by UIA Core; we should not implement. + case UIA_LegacyIAccessiblePatternId: + break; + } + return nullptr; +} + } // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node_win.h b/ui/accessibility/platform/ax_platform_node_win.h index 9b7577f..190f838 100644 --- a/ui/accessibility/platform/ax_platform_node_win.h +++ b/ui/accessibility/platform/ax_platform_node_win.h
@@ -997,6 +997,9 @@ // Support method for ITextRangeProvider::GetAttributeValue HRESULT GetTextAttributeValue(TEXTATTRIBUTEID attribute_id, VARIANT* result); + // IRawElementProviderSimple support method. + bool IsPatternProviderSupported(PATTERNID pattern_id); + protected: // This is hard-coded; all products based on the Chromium engine will have the // same framework name, so that assistive technology can detect any @@ -1194,6 +1197,14 @@ // Helper method for getting the vertical scroll percent. double GetVerticalScrollPercent(); + + // IRawElementProviderSimple support methods. + + using PatternProviderFactoryMethod = HRESULT (*)(AXPlatformNodeWin*, + IUnknown**); + + PatternProviderFactoryMethod GetPatternProviderFactoryMethod( + PATTERNID pattern_id); }; } // namespace ui
diff --git a/ui/accessibility/platform/ax_platform_node_win_unittest.cc b/ui/accessibility/platform/ax_platform_node_win_unittest.cc index 4749bef..15fbc3e0 100644 --- a/ui/accessibility/platform/ax_platform_node_win_unittest.cc +++ b/ui/accessibility/platform/ax_platform_node_win_unittest.cc
@@ -4537,40 +4537,41 @@ GetSupportedPatternsFromNodeId(root_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId, - UIA_ExpandCollapsePatternId}), + UIA_ExpandCollapsePatternId, UIA_TextChildPatternId}), GetSupportedPatternsFromNodeId(text_field_with_combo_box_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_GridPatternId, - UIA_TablePatternId}), + UIA_TablePatternId, UIA_TextChildPatternId}), GetSupportedPatternsFromNodeId(table_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_GridItemPatternId, - UIA_TableItemPatternId}), + UIA_TableItemPatternId, UIA_TextChildPatternId}), GetSupportedPatternsFromNodeId(table_cell_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId, - UIA_RangeValuePatternId}), + UIA_RangeValuePatternId, UIA_TextChildPatternId}), GetSupportedPatternsFromNodeId(meter_id)); - EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ScrollPatternId}), + EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ScrollPatternId, + UIA_TextChildPatternId}), GetSupportedPatternsFromNodeId(group_with_scroll_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId, UIA_SelectionPatternId, UIA_GridPatternId, - UIA_TablePatternId}), + UIA_TablePatternId, UIA_TextChildPatternId}), GetSupportedPatternsFromNodeId(grid_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId, UIA_GridItemPatternId, UIA_TableItemPatternId, - UIA_SelectionItemPatternId}), + UIA_TextChildPatternId, UIA_SelectionItemPatternId}), GetSupportedPatternsFromNodeId(grid_cell_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId, - UIA_TogglePatternId}), + UIA_TextChildPatternId, UIA_TogglePatternId}), GetSupportedPatternsFromNodeId(checkbox_id)); EXPECT_EQ(PatternSet({UIA_ScrollItemPatternId, UIA_ValuePatternId, - UIA_InvokePatternId}), + UIA_InvokePatternId, UIA_TextChildPatternId}), GetSupportedPatternsFromNodeId(link_id)); }
diff --git a/ui/android/event_forwarder.cc b/ui/android/event_forwarder.cc index aa6d68e..8f8d0f1 100644 --- a/ui/android/event_forwarder.cc +++ b/ui/android/event_forwarder.cc
@@ -223,14 +223,17 @@ if (velocity_x == 0 && velocity_y == 0) return; + float dip_scale = view_->GetDipScale(); // Use velocity as delta in scroll event. view_->OnGestureEvent(GestureEventAndroid( GESTURE_EVENT_TYPE_SCROLL_START, gfx::PointF(), gfx::PointF(), time_ms, 0, - velocity_x, velocity_y, 0, 0, /*target_viewport*/ true, synthetic_scroll, + velocity_x / dip_scale, velocity_y / dip_scale, 0, 0, + /*target_viewport*/ true, synthetic_scroll, /*prevent_boosting*/ false)); view_->OnGestureEvent(GestureEventAndroid( GESTURE_EVENT_TYPE_FLING_START, gfx::PointF(), gfx::PointF(), time_ms, 0, - 0, 0, velocity_x, velocity_y, /*target_viewport*/ true, synthetic_scroll, + 0, 0, velocity_x / dip_scale, velocity_y / dip_scale, + /*target_viewport*/ true, synthetic_scroll, /*prevent_boosting*/ false)); }
diff --git a/ui/base/BUILD.gn b/ui/base/BUILD.gn index a9f5ba1f..bb7336e 100644 --- a/ui/base/BUILD.gn +++ b/ui/base/BUILD.gn
@@ -664,6 +664,8 @@ "test/cocoa_helper.mm", "test/menu_test_observer.h", "test/menu_test_observer.mm", + "test/ns_ax_tree_validator.h", + "test/ns_ax_tree_validator.mm", "test/nswindow_fullscreen_notification_waiter.h", "test/nswindow_fullscreen_notification_waiter.mm", "test/scoped_fake_full_keyboard_access.h",
diff --git a/ui/base/ime/win/tsf_text_store.cc b/ui/base/ime/win/tsf_text_store.cc index 43f87a9..602c5523 100644 --- a/ui/base/ime/win/tsf_text_store.cc +++ b/ui/base/ime/win/tsf_text_store.cc
@@ -563,13 +563,17 @@ } // If we saved a keydown event before this, now is the right time to fire it - // We should only fire JS key event during composition. - if (has_composition_range_ && wparam_keydown_cached_ != 0 && - lparam_keydown_cached_ != 0) { + // We should only fire JS key event during composition or OnStartComposition() + // is called during current edit session. + if ((has_composition_range_ || on_start_composition_called_) && + wparam_keydown_cached_ != 0 && lparam_keydown_cached_ != 0) { DispatchKeyEvent(ui::ET_KEY_PRESSED, wparam_keydown_cached_, lparam_keydown_cached_); } + // reset |on_start_composition_called_| for next edit session. + on_start_composition_called_ = false; + // If the text store is edited in OnLockGranted(), we may need to call // TextInputClient::InsertText() or TextInputClient::SetCompositionText(). const size_t new_composition_start = composition_start_; @@ -728,6 +732,8 @@ BOOL* ok) { if (ok) *ok = TRUE; + + on_start_composition_called_ = true; return S_OK; } @@ -758,6 +764,11 @@ STDMETHODIMP TSFTextStore::OnKeyTraceUp(WPARAM wParam, LPARAM lParam) { if (has_composition_range_ || wparam_keydown_fired_ == wParam) { DispatchKeyEvent(ui::ET_KEY_RELEASED, wParam, lParam); + } else if (wparam_keydown_cached_ == wParam) { + // If we didn't fire corresponding keydown event, then we need to clear the + // cached keydown wParam and lParam. + wparam_keydown_cached_ = 0; + lparam_keydown_cached_ = 0; } return S_OK; }
diff --git a/ui/base/ime/win/tsf_text_store.h b/ui/base/ime/win/tsf_text_store.h index fdd7d3c1..afe21967 100644 --- a/ui/base/ime/win/tsf_text_store.h +++ b/ui/base/ime/win/tsf_text_store.h
@@ -332,6 +332,10 @@ bool has_composition_range_ = false; gfx::Range composition_range_; + // |on_start_composition_called_| indicates that OnStartComposition() is + // called duriing current edit session. + bool on_start_composition_called_ = false; + // |previous_composition_string_| indicicates composition string in last // edit session during same composition. |previous_composition_start_| // indicates composition start in last session during same composition. If
diff --git a/ui/base/test/ns_ax_tree_validator.h b/ui/base/test/ns_ax_tree_validator.h new file mode 100644 index 0000000..6cecee0 --- /dev/null +++ b/ui/base/test/ns_ax_tree_validator.h
@@ -0,0 +1,57 @@ +// 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 UI_BASE_TEST_NS_AX_TREE_VALIDATOR_H_ +#define UI_BASE_TEST_NS_AX_TREE_VALIDATOR_H_ + +#include "base/optional.h" + +@protocol NSAccessibility; + +namespace ui { + +struct NSAXTreeProblemDetails { + enum ProblemType { + // |node_a| (the child node) is not a child of |node_b| (its parent). + NSAX_NOT_CHILD_OF_PARENT, + + // |node_a| (the child node) is a child of |node_b|, but |node_a|'s parent + // is |node_c| instead. + NSAX_CHILD_PARENT_NOT_THIS, + + // |node_a| (a supplied root node) is non-nil but does not conform to + // NSAccessibility. + NSAX_NOT_NSACCESSIBILITY, + + // |node_a| (the child node)'s parent |node_b| is non-nil but does not + // conform to NSAccessibility. + NSAX_PARENT_NOT_NSACCESSIBILITY, + }; + + NSAXTreeProblemDetails(ProblemType type, id node_a, id node_b, id node_c); + + ProblemType type; + // These aren't id<NSAccessibility> because some kinds of problem are caused + // by them not conforming to NSAccessibility. + id node_a; + id node_b; + id node_c; + + std::string ToString(); +}; + +// Validates the accessibility tree rooted at |root|. If at least one problem is +// found, returns an |AXTreeProblemDetails| as described above; if not, returns +// base::nullopt. +base::Optional<NSAXTreeProblemDetails> ValidateNSAXTree( + id<NSAccessibility> root, + size_t* nodes_visited); + +// Prints the accessibility tree rooted at |root|. This function is useful for +// debugging failures of ValidateNSAXTree tests. +void PrintNSAXTree(id<NSAccessibility> root); + +} // ui + +#endif // UI_BASE_TEST_NS_AX_TREE_VALIDATOR_H_
diff --git a/ui/base/test/ns_ax_tree_validator.mm b/ui/base/test/ns_ax_tree_validator.mm new file mode 100644 index 0000000..f9312c2 --- /dev/null +++ b/ui/base/test/ns_ax_tree_validator.mm
@@ -0,0 +1,103 @@ +// 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 "ui/base/test/ns_ax_tree_validator.h" + +#include <Cocoa/Cocoa.h> + +#include "base/strings/sys_string_conversions.h" + +namespace { + +id<NSAccessibility> ToNSAccessibility(id obj) { + return [obj conformsToProtocol:@protocol(NSAccessibility)] ? obj : nil; +} + +void PrintNSAXTreeHelper(id<NSAccessibility> root, int depth) { + std::string desc; + for (int i = 0; i < depth; i++) + desc += " "; + desc += base::SysNSStringToUTF8([NSString stringWithFormat:@"%@", root]); + LOG(INFO) << desc; + for (id child in root.accessibilityChildren) + PrintNSAXTreeHelper(child, depth + 1); +} + +} + +namespace ui { + +NSAXTreeProblemDetails::NSAXTreeProblemDetails(ProblemType type, + id node_a, + id node_b, + id node_c) + : type(type), node_a(node_a), node_b(node_b), node_c(node_c) {} + +std::string NSAXTreeProblemDetails::ToString() { + NSString* s; + switch (type) { + case NSAX_NOT_CHILD_OF_PARENT: + s = [NSString + stringWithFormat:@"Node %@ isn't a child of %@", node_a, node_b]; + break; + case NSAX_CHILD_PARENT_NOT_THIS: + s = [NSString stringWithFormat:@"Node %@'s child %@'s parent is %@", + node_a, node_b, node_c]; + break; + case NSAX_NOT_NSACCESSIBILITY: + s = [NSString stringWithFormat:@"Node %@ does not conform to" + " to NSAccessibility", + node_a]; + break; + case NSAX_PARENT_NOT_NSACCESSIBILITY: + s = [NSString stringWithFormat:@"Node %@'s parent %@ does not conform" + " to NSAccessibility", + node_a, node_b]; + break; + } + return base::SysNSStringToUTF8(s); +} + +base::Optional<NSAXTreeProblemDetails> ValidateNSAXTree( + id<NSAccessibility> root, + size_t* nodes_visited) { + if (!ToNSAccessibility(root)) { + return base::make_optional<NSAXTreeProblemDetails>( + NSAXTreeProblemDetails::NSAX_NOT_NSACCESSIBILITY, root, nil, nil); + } + (*nodes_visited)++; + + if (root.accessibilityParent) { + id<NSAccessibility> parent = ToNSAccessibility(root.accessibilityParent); + if (!parent) { + return base::make_optional<NSAXTreeProblemDetails>( + NSAXTreeProblemDetails::NSAX_PARENT_NOT_NSACCESSIBILITY, root, parent, + nil); + } + + NSArray<id<NSAccessibility>>* parent_children = + parent.accessibilityChildren; + + if ([parent_children indexOfObjectIdenticalTo:root] == NSNotFound) { + return base::make_optional<NSAXTreeProblemDetails>( + NSAXTreeProblemDetails::NSAX_NOT_CHILD_OF_PARENT, root, parent, nil); + } + } + + NSArray<id<NSAccessibility>>* children = root.accessibilityChildren; + for (id<NSAccessibility> child in children) { + base::Optional<NSAXTreeProblemDetails> details = + ValidateNSAXTree(child, nodes_visited); + if (details.has_value()) + return details; + } + + return base::nullopt; +} + +void PrintNSAXTree(id<NSAccessibility> root) { + PrintNSAXTreeHelper(root, 0); +} + +} // namespace ui
diff --git a/ui/base/ui_base_features.cc b/ui/base/ui_base_features.cc index bf87596..5109cbe 100644 --- a/ui/base/ui_base_features.cc +++ b/ui/base/ui_base_features.cc
@@ -16,11 +16,6 @@ "CalculateNativeWinOcclusion", base::FEATURE_DISABLED_BY_DEFAULT}; #endif // OW_WIN -// Enables all upcoming UI features. -// Deprecated - DO NOT USE (See http://crbug.com/947314). -const base::Feature kExperimentalUi{"ExperimentalUi", - base::FEATURE_DISABLED_BY_DEFAULT}; - #if defined(OS_CHROMEOS) // Integrate input method specific settings to Chrome OS settings page. // https://crbug.com/895886.
diff --git a/ui/base/ui_base_features.h b/ui/base/ui_base_features.h index 12c426b6..dc605a9 100644 --- a/ui/base/ui_base_features.h +++ b/ui/base/ui_base_features.h
@@ -16,8 +16,6 @@ COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kCompositorThreadedScrollbarScrolling; -// Deprecated - DO NOT USE (See http://crbug.com/947314). -COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kExperimentalUi; #if defined(OS_CHROMEOS) COMPONENT_EXPORT(UI_BASE_FEATURES) extern const base::Feature kSettingsShowsPerKeyboardSettings;
diff --git a/ui/compositor/compositor.h b/ui/compositor/compositor.h index af204058..102c2fc 100644 --- a/ui/compositor/compositor.h +++ b/ui/compositor/compositor.h
@@ -382,6 +382,7 @@ // LayerTreeHostClient implementation. void WillBeginMainFrame() override {} void DidBeginMainFrame() override {} + void WillUpdateLayers() override {} void DidUpdateLayers() override; void BeginMainFrame(const viz::BeginFrameArgs& args) override; void BeginMainFrameNotExpectedSoon() override;
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index fe7f544..aa3d8b5 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc
@@ -679,7 +679,6 @@ cc_layer_->SetTransformOrigin(gfx::Point3F()); cc_layer_->SetContentsOpaque(fills_bounds_opaquely_); cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); - cc_layer_->SetHitTestable(type_ != LAYER_NOT_DRAWN); cc_layer_->SetHideLayerAndSubtree(!visible_); cc_layer_->SetBackdropFilterQuality(backdrop_filter_quality_); cc_layer_->SetElementId(cc::ElementId(cc_layer_->id())); @@ -1383,9 +1382,6 @@ cc_layer_->SetContentsOpaque(true); cc_layer_->SetSafeOpaqueBackgroundColor(SK_ColorWHITE); cc_layer_->SetIsDrawable(type_ != LAYER_NOT_DRAWN); - // TODO(sunxd): Allow ui::Layers to set if they accept events or not. See - // https://crbug.com/924294. - cc_layer_->SetHitTestable(type_ != LAYER_NOT_DRAWN); cc_layer_->SetLayerClient(weak_ptr_factory_.GetWeakPtr()); cc_layer_->SetElementId(cc::ElementId(cc_layer_->id())); RecomputePosition();
diff --git a/ui/display/manager/display_manager.cc b/ui/display/manager/display_manager.cc index 0d0a960..03816a0 100644 --- a/ui/display/manager/display_manager.cc +++ b/ui/display/manager/display_manager.cc
@@ -1329,11 +1329,14 @@ return true; } - if (num_connected_displays_ <= 1) { - // The ChromeOS just boots up or it only has one display. Restore mirror - // mode based on the external displays' mirror info stored in the - // preferences. Mirror mode should be on if one of the external displays was - // in mirror mode before. + if (should_restore_mirror_mode_from_display_prefs_ || + num_connected_displays_ <= 1) { + // The ChromeOS just boots up, the display prefs have just been loaded, or + // we only have one display. Restore mirror mode based on the external + // displays' mirror info stored in the preferences. Mirror mode should be on + // if one of the external displays was in mirror mode before. + should_restore_mirror_mode_from_display_prefs_ = false; + for (int64_t id : new_id_list) { if (external_display_mirror_info_.count( GetDisplayIdWithoutOutputIndex(id))) {
diff --git a/ui/display/manager/display_manager.h b/ui/display/manager/display_manager.h index d69d405..9bceae9 100644 --- a/ui/display/manager/display_manager.h +++ b/ui/display/manager/display_manager.h
@@ -337,6 +337,10 @@ external_display_mirror_info_ = external_display_mirror_info; } + void set_should_restore_mirror_mode_from_display_prefs(bool value) { + should_restore_mirror_mode_from_display_prefs_ = value; + } + const base::Optional<MixedMirrorModeParams>& mixed_mirror_mode_params() const { return mixed_mirror_mode_params_; @@ -644,6 +648,11 @@ // Stores external displays that were in mirror mode before. std::set<int64_t> external_display_mirror_info_; + // This is set to true when the display prefs have been loaded from local + // state to signal that we should restore the mirror mode state from + // |external_display_mirror_info_| in the upcoming display re-configuration. + bool should_restore_mirror_mode_from_display_prefs_ = false; + // True if mirror mode should not be restored. Only used in test. bool disable_restoring_mirror_mode_for_test_ = false;
diff --git a/ui/file_manager/file_manager/common/js/util.js b/ui/file_manager/file_manager/common/js/util.js index 5cac3462..741f2fb0 100644 --- a/ui/file_manager/file_manager/common/js/util.js +++ b/ui/file_manager/file_manager/common/js/util.js
@@ -1332,6 +1332,14 @@ }; /** + * Examines whether the new feedback panel mode is enabled. + * @return {boolean} True if the new feedback panel UI mode is enabled. + */ +util.isFeedbackPanelEnabled = () => { + return loadTimeData.getBoolean('FEEDBACK_PANEL_ENABLED'); +}; + +/** * Retrieves all entries inside the given |rootEntry|. * @param {!DirectoryEntry} rootEntry * @param {function(!Array<!Entry>)} entriesCallback Called when some chunk of
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js index 55f0ef7..4699046 100644 --- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js +++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_dispatcher.js
@@ -38,21 +38,6 @@ this.port_ = port; this.port_.onmessage = this.onMessage.bind(this); - // Make sure to update component_extension_resources.grd - // when adding new parsers. - importScripts( - FILE_MANAGER_HOST__METADATA_DISPATCHER + - '/foreground/js/metadata/exif_parser.js'); - importScripts( - FILE_MANAGER_HOST__METADATA_DISPATCHER + - '/foreground/js/metadata/image_parsers.js'); - importScripts( - FILE_MANAGER_HOST__METADATA_DISPATCHER + - '/foreground/js/metadata/mpeg_parser.js'); - importScripts( - FILE_MANAGER_HOST__METADATA_DISPATCHER + - '/foreground/js/metadata/id3_parser.js'); - const patterns = []; this.parserInstances_ = []; @@ -260,3 +245,19 @@ registerParserClass = parserClass => { MetadataDispatcher.parserClasses_.push(parserClass); }; + +// Note: update component_extension_resources.grd when adding new parsers and +// that these parser scripts imports must be done last, see crbug.com/946959, +// at least after the definition of registerParserClass above. +importScripts( + FILE_MANAGER_HOST__METADATA_DISPATCHER + + '/foreground/js/metadata/exif_parser.js'); +importScripts( + FILE_MANAGER_HOST__METADATA_DISPATCHER + + '/foreground/js/metadata/image_parsers.js'); +importScripts( + FILE_MANAGER_HOST__METADATA_DISPATCHER + + '/foreground/js/metadata/mpeg_parser.js'); +importScripts( + FILE_MANAGER_HOST__METADATA_DISPATCHER + + '/foreground/js/metadata/id3_parser.js');
diff --git a/ui/login/display_manager.js b/ui/login/display_manager.js index a229ff25..4c1a725 100644 --- a/ui/login/display_manager.js +++ b/ui/login/display_manager.js
@@ -21,7 +21,6 @@ /** @const */ var SCREEN_OOBE_AUTO_ENROLLMENT_CHECK = 'auto-enrollment-check'; /** @const */ var SCREEN_GAIA_SIGNIN = 'gaia-signin'; /** @const */ var SCREEN_ACCOUNT_PICKER = 'account-picker'; -/** @const */ var SCREEN_USER_IMAGE_PICKER = 'user-image'; /** @const */ var SCREEN_ERROR_MESSAGE = 'error-message'; /** @const */ var SCREEN_TPM_ERROR = 'tpm-error-message'; /** @const */ var SCREEN_PASSWORD_CHANGED = 'password-changed'; @@ -141,7 +140,6 @@ SCREEN_ACCOUNT_PICKER, SCREEN_KIOSK_ENABLE, SCREEN_ERROR_MESSAGE, - SCREEN_USER_IMAGE_PICKER, SCREEN_TPM_ERROR, SCREEN_PASSWORD_CHANGED, SCREEN_TERMS_OF_SERVICE,
diff --git a/ui/ozone/platform/headless/BUILD.gn b/ui/ozone/platform/headless/BUILD.gn index 046dec9..64198049 100644 --- a/ui/ozone/platform/headless/BUILD.gn +++ b/ui/ozone/platform/headless/BUILD.gn
@@ -26,7 +26,6 @@ "//base", "//skia", "//ui/base", - "//ui/display/manager", "//ui/events", "//ui/events/ozone:events_ozone_layout", "//ui/events/platform",