diff --git a/DEPS b/DEPS index 7b324a1..b0d483f 100644 --- a/DEPS +++ b/DEPS
@@ -112,11 +112,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': '9b61866c69fd29f7fc7e7bc94d59896efc200932', + 'skia_revision': '88deeb1d92d1c62e0e450f5fd9fcff2702945929', # 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': '01b0845ac6d223aa3217fe195822b19e83cf9d6a', + 'v8_revision': '84e2ca990290b9a4f21ff8ee212b7019f59a56c9', # 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. @@ -172,7 +172,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': '43e8ebcaf28498c50c27fcf3b63b6e189ff12fb4', + 'catapult_revision': '17079a5cc1f27a2dc57558a0897666cac4a5bc64', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libFuzzer # and whatever else without interference from each other. @@ -220,7 +220,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': '095cc6722fa589a816b722d217128f8350d2c0bf', + 'spv_tools_revision': '9e71de132fbcf91db836ac0c2019a5052defd37b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -676,7 +676,7 @@ }, 'src/third_party/depot_tools': - Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '25c4fce2cebbd11987a9eadafdf9258b10efcb7e', + Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '6c18a1afa1a7a30421775c8d6c1cfb7edb3f272a', 'src/third_party/devtools-node-modules': Var('chromium_git') + '/external/github.com/ChromeDevTools/devtools-node-modules' + '@' + Var('devtools_node_modules_revision'), @@ -1008,7 +1008,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + '1a5db00d4018b18d134dffe34c3552fcc1cfbc8a', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '46505d3c656ff355cb8e9e4b17728943d96568ed', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + 'ac0d98b5cee6c024b0cffeb4f8f45b6fc5ccdb78', @@ -1191,7 +1191,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@f8d95114b66d50df3fb43015ecde6a8728d7a8ee', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@39cb969f1a0952d98efa850bdf31b3a21a110128', 'condition': 'checkout_src_internal', }, @@ -1199,7 +1199,7 @@ 'packages': [ { 'package': 'chromium/third_party/android_deps/libs/com_google_android_play_core_verification', - 'version': 'version:1.3.6-cr1', + 'version': 'version:1.3.7-cr0', }, ], 'condition': 'checkout_android',
diff --git a/android_webview/browser/aw_contents_io_thread_client.cc b/android_webview/browser/aw_contents_io_thread_client.cc index 936a948..d6bfc3a 100644 --- a/android_webview/browser/aw_contents_io_thread_client.cc +++ b/android_webview/browser/aw_contents_io_thread_client.cc
@@ -29,6 +29,7 @@ #include "jni/AwContentsIoThreadClient_jni.h" #include "net/base/data_url.h" #include "net/url_request/url_request.h" +#include "services/network/public/cpp/resource_request.h" using base::android::AttachCurrentThread; using base::android::ConvertUTF8ToJavaString; @@ -341,7 +342,7 @@ namespace { std::unique_ptr<AwWebResourceResponse> RunShouldInterceptRequest( - const AwWebResourceRequest& request, + AwWebResourceRequest request, JavaObjectWeakGlobalRef ref) { base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK); @@ -372,7 +373,7 @@ } // namespace void AwContentsIoThreadClient::ShouldInterceptRequestAsync( - const net::URLRequest* request, + AwWebResourceRequest request, ShouldInterceptRequestResultCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); base::OnceCallback<std::unique_ptr<AwWebResourceResponse>()> get_response = @@ -385,7 +386,7 @@ } if (!bg_thread_client_object_.is_null()) { get_response = base::BindOnce( - &RunShouldInterceptRequest, AwWebResourceRequest(*request), + &RunShouldInterceptRequest, std::move(request), JavaObjectWeakGlobalRef(env, bg_thread_client_object_.obj())); } base::PostTaskAndReplyWithResult(sequenced_task_runner_.get(), FROM_HERE,
diff --git a/android_webview/browser/aw_contents_io_thread_client.h b/android_webview/browser/aw_contents_io_thread_client.h index b994655..546092eb 100644 --- a/android_webview/browser/aw_contents_io_thread_client.h +++ b/android_webview/browser/aw_contents_io_thread_client.h
@@ -27,6 +27,7 @@ namespace android_webview { class AwWebResourceResponse; +struct AwWebResourceRequest; // This class provides a means of calling Java methods on an instance that has // a 1:1 relationship with a WebContents instance directly from the IO thread. @@ -111,7 +112,7 @@ using ShouldInterceptRequestResultCallback = base::OnceCallback<void(std::unique_ptr<AwWebResourceResponse>)>; void ShouldInterceptRequestAsync( - const net::URLRequest* request, + AwWebResourceRequest request, ShouldInterceptRequestResultCallback callback); // Retrieve the AllowContentAccess setting value of this AwContents.
diff --git a/android_webview/browser/aw_proxying_url_loader_factory.cc b/android_webview/browser/aw_proxying_url_loader_factory.cc index 5eab1301..bb1506b4 100644 --- a/android_webview/browser/aw_proxying_url_loader_factory.cc +++ b/android_webview/browser/aw_proxying_url_loader_factory.cc
@@ -8,6 +8,7 @@ #include "android_webview/browser/aw_contents_client_bridge.h" #include "android_webview/browser/aw_contents_io_thread_client.h" +#include "android_webview/browser/net/aw_web_resource_response.h" #include "android_webview/browser/net_helpers.h" #include "android_webview/browser/renderer_host/auto_login_parser.h" #include "base/strings/stringprintf.h" @@ -71,6 +72,10 @@ void PauseReadingBodyFromNet() override; void ResumeReadingBodyFromNet() override; + void ContinueAfterIntercept(); + void InterceptResponseReceived( + std::unique_ptr<AwWebResourceResponse> response); + private: std::unique_ptr<AwContentsIoThreadClient> GetIoThreadClient(); void OnRequestError(const network::URLLoaderCompletionStatus& status); @@ -131,8 +136,31 @@ // TODO(timvolodine): add async check shouldOverrideUrlLoading and // shouldInterceptRequest. - request_.load_flags = GetCacheModeForClient(GetIoThreadClient().get()); + std::unique_ptr<AwContentsIoThreadClient> io_thread_client = + GetIoThreadClient(); + DCHECK(io_thread_client); + request_.load_flags = GetCacheModeForClient(io_thread_client.get()); + // TODO: verify the case when WebContents::RenderFrameDeleted is called + // before network request is intercepted (i.e. if that's possible and + // whether it can result in any issues). + io_thread_client->ShouldInterceptRequestAsync( + AwWebResourceRequest(request_), + base::BindOnce(&InterceptedRequest::InterceptResponseReceived, + weak_factory_.GetWeakPtr())); +} + +void InterceptedRequest::InterceptResponseReceived( + std::unique_ptr<AwWebResourceResponse> response) { + if (response) { + // TODO(timvolodine): handle the case where response contains data, + // i.e. is actually overridden, crbug.com/893566. + } else { + ContinueAfterIntercept(); + } +} + +void InterceptedRequest::ContinueAfterIntercept() { if (!target_loader_ && target_factory_) { network::mojom::URLLoaderClientPtr proxied_client; proxied_client_binding_.Bind(mojo::MakeRequest(&proxied_client));
diff --git a/android_webview/browser/net/aw_request_interceptor.cc b/android_webview/browser/net/aw_request_interceptor.cc index d94a51d..07629be8 100644 --- a/android_webview/browser/net/aw_request_interceptor.cc +++ b/android_webview/browser/net/aw_request_interceptor.cc
@@ -10,6 +10,7 @@ #include "android_webview/browser/aw_contents_io_thread_client.h" #include "android_webview/browser/input_stream.h" #include "android_webview/browser/net/android_stream_reader_url_request_job.h" +#include "android_webview/browser/net/aw_web_resource_request.h" #include "android_webview/browser/net/aw_web_resource_response.h" #include "base/memory/weak_ptr.h" #include "base/strings/string_number_conversions.h" @@ -90,7 +91,7 @@ callback_ = std::move(callback); io_thread_client_->ShouldInterceptRequestAsync( // The request is only used while preparing the call, not retained. - request, + AwWebResourceRequest(*request), base::BindOnce( &ShouldInterceptRequestAdaptor::WebResourceResponseObtained, // The lifetime of the DelegateObtainer is managed by
diff --git a/build/android/gyp/dex.py b/build/android/gyp/dex.py index ccad716..74cdb94 100755 --- a/build/android/gyp/dex.py +++ b/build/android/gyp/dex.py
@@ -314,15 +314,18 @@ # by creating an empty JAR with zipfile.ZipFile(options.dex_path, 'w') as outfile: outfile.comment = 'empty' - elif is_dex: + else: # .dex files can't specify a name for D8. Instead, we output them to a # temp directory then move them after the command has finished running # (see _MoveTempDexFile). For other files, tmp_dex_dir is None. with build_utils.TempDir() as tmp_dex_dir: _RunD8(dex_cmd, paths, tmp_dex_dir) - _MoveTempDexFile(tmp_dex_dir, options.dex_path) - else: - _RunD8(dex_cmd, paths, options.dex_path) + if is_dex: + _MoveTempDexFile(tmp_dex_dir, options.dex_path) + else: + # d8 supports outputting to a .zip, but does not have deterministic file + # ordering: https://issuetracker.google.com/issues/119945929 + build_utils.ZipDir(options.dex_path, tmp_dex_dir) if options.dexlayout_profile: with build_utils.TempDir() as temp_dir:
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index abd8160..5f21c20 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -61f4c2d4843bb8fd503254d01634b1b888c7eee6 \ No newline at end of file +9b65862bfc102e5078ddc9c9acb440d537ad0acb \ No newline at end of file
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 9d52acc2..2e62591b 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -59e2a1c3c856575f1d7c415ff393da4480c2d23e \ No newline at end of file +b1656b70748395e8817fe545ab1fc65232181b61 \ No newline at end of file
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc index aefad53..5c4c58f 100644 --- a/cc/layers/picture_layer_impl.cc +++ b/cc/layers/picture_layer_impl.cc
@@ -526,7 +526,8 @@ if (!has_draw_quad) { // Checkerboard. SkColor color = SafeOpaqueBackgroundColor(); - if (ShowDebugBorders(DebugBorderType::LAYER)) { + if (mask_type_ == Layer::LayerMaskType::NOT_MASK && + ShowDebugBorders(DebugBorderType::LAYER)) { // Fill the whole tile with the missing tile color. color = DebugColors::OOMTileBorderColor(); }
diff --git a/cc/mojo_embedder/async_layer_tree_frame_sink.cc b/cc/mojo_embedder/async_layer_tree_frame_sink.cc index c62acab..1d0f6e61 100644 --- a/cc/mojo_embedder/async_layer_tree_frame_sink.cc +++ b/cc/mojo_embedder/async_layer_tree_frame_sink.cc
@@ -206,7 +206,7 @@ else hit_test_region_list = client_->BuildHitTestData(); - if (show_hit_test_borders) + if (show_hit_test_borders && hit_test_region_list) hit_test_region_list->flags |= viz::HitTestRegionFlags::kHitTestDebug; if (last_submitted_local_surface_id_ != local_surface_id_) {
diff --git a/chrome/VERSION b/chrome/VERSION index 525e30533..2b92af2 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=72 MINOR=0 -BUILD=3620 +BUILD=3622 PATCH=0
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index d5bfbb1..a70c99ee 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -8,9 +8,9 @@ import("//build/config/android/rules.gni") import("//build/util/process_version.gni") import("//chrome/android/chrome_public_apk_tmpl.gni") -import("//chrome/android/feed/feed_java_sources.gni") import("//chrome/android/monochrome_android_manifest_jinja_variables.gni") import("//chrome/chrome_paks.gni") +import("//chrome/android/feed/feed_java_sources.gni") import("//chrome/common/features.gni") import("//chrome/process_version_rc_template.gni") # For branding_file_path. import("//device/vr/buildflags/buildflags.gni") @@ -1078,27 +1078,14 @@ } } -# This template creates a native library for Chrome's APK or bundle. -template("libchrome_apk_or_bundle_tmpl") { - chrome_shared_library(target_name) { - forward_variables_from(invoker, "*") - sources = [ - "../browser/android/chrome_entry_point.cc", - chrome_jni_registration_header, - ] - deps = [ - ":chrome_jni_registration($default_toolchain)", - ] - } -} - -# Chrome APK's native library. -libchrome_apk_or_bundle_tmpl("libchrome") { -} - -# Chrome bundle's base module native library. This is currently the same as the -# APK version, but will diverge when code moves into feature modules. -libchrome_apk_or_bundle_tmpl("libchrome_base") { +chrome_shared_library("libchrome") { + sources = [ + "../browser/android/chrome_entry_point.cc", + chrome_jni_registration_header, + ] + deps = [ + ":chrome_jni_registration($default_toolchain)", + ] } chrome_shared_library("libchromefortest") { @@ -1148,20 +1135,22 @@ # is_monochrome: If true, generate Monochrome targets rather than Chrome. # is_bundle: If true, generate resources for bundles rather than APK. template("resource_packaging") { + not_needed([ "target_name" ]) + _is_monochrome = invoker.is_monochrome _is_bundle = invoker.is_bundle if (_is_monochrome) { - _type = "monochrome" + _prefix = "monochrome" } else { - _type = "chrome" + _prefix = "chrome" } if (_is_bundle) { _output_type = "bundle" } else { _output_type = "apk" } - _variant = "${_type}_${_output_type}" + _variant = "${_prefix}_${_output_type}" if (enable_resource_whitelist_generation) { _resource_whitelist_target = "${_variant}_resource_whitelist" @@ -1169,17 +1158,10 @@ "$target_gen_dir/${_variant}_resource_whitelist.txt" if (_is_monochrome) { - _target_prefix = "" + _target = "monochrome" } else { - _target_prefix = "lib" + _target = "libchrome" } - if (_is_bundle) { - _suffix = "_base" - } else { - _suffix = "" - } - _lib_path = "/lib.unstripped/lib" + _type + _suffix + shlib_extension - _lib_target = _target_prefix + _type + _suffix generate_resource_whitelist(_resource_whitelist_target) { _fat_lib_toolchain = "" @@ -1193,10 +1175,11 @@ } } deps = [ - ":${_lib_target}($_fat_lib_toolchain)", + ":${_target}($_fat_lib_toolchain)", ] - input = get_label_info(deps[0], "root_out_dir") + _lib_path + input = get_label_info(deps[0], "root_out_dir") + + "/lib.unstripped/lib${_prefix}$shlib_extension" output = _resource_whitelist_file } @@ -1208,13 +1191,10 @@ _locale_whitelist_target = "${_variant}_locale_whitelist" _locale_whitelist_file = "$target_gen_dir/${_variant}_locale_whitelist.txt" - _system_webview_locale_whitelist_target = - "${_variant}_system_webview_locale_resource_whitelist" - _system_webview_locale_whitelist_file = - "$target_gen_dir/" + - "${_variant}_system_webview_locale_resource_id_list.txt" + _system_webview_locale_resource_id_list = + "$target_gen_dir/system_webview_locale_resource_id_list.txt" - action(_system_webview_locale_whitelist_target) { + action("system_webview_locale_resource_id_list") { script = "//tools/grit/pak_util.py" _system_webview_en_US_locale_pak = @@ -1225,7 +1205,7 @@ ] outputs = [ - _system_webview_locale_whitelist_file, + _system_webview_locale_resource_id_list, ] deps = [ @@ -1235,7 +1215,8 @@ args = [ "list-id", "--output", - rebase_path(_system_webview_locale_whitelist_file, root_build_dir), + rebase_path(_system_webview_locale_resource_id_list, + root_build_dir), rebase_path(_system_webview_en_US_locale_pak, root_build_dir), ] } @@ -1245,7 +1226,7 @@ inputs = [ _resource_whitelist_file, - _system_webview_locale_whitelist_file, + _system_webview_locale_resource_id_list, ] outputs = [ @@ -1253,8 +1234,8 @@ ] deps = [ - ":$_resource_whitelist_target", - ":$_system_webview_locale_whitelist_target", + ":${_resource_whitelist_target}", + ":system_webview_locale_resource_id_list", "//android_webview:system_webview_pak_whitelist", ] @@ -1262,7 +1243,8 @@ "--input", rebase_path(_resource_whitelist_file, root_build_dir), "--filter", - rebase_path(_system_webview_locale_whitelist_file, root_build_dir), + rebase_path(_system_webview_locale_resource_id_list, + root_build_dir), "--output", rebase_path(_locale_whitelist_file, root_build_dir), ] @@ -1271,7 +1253,7 @@ } chrome_paks("${_variant}_paks") { - output_dir = "$target_gen_dir/${_variant}_paks" + output_dir = "$target_gen_dir/$target_name" deps = [] if (_is_monochrome) { @@ -1285,7 +1267,7 @@ deps += [ ":${_resource_whitelist_target}" ] if (_is_monochrome) { locale_whitelist = _locale_whitelist_file - deps += [ ":$_locale_whitelist_target" ] + deps += [ ":${_variant}_locale_whitelist" ] } } } @@ -1308,8 +1290,7 @@ } # This target explicitly includes locale paks via deps. - android_assets(target_name) { - assert("${_variant}_pak_assets" == target_name) + android_assets("${_variant}_pak_assets") { sources = [ "$target_gen_dir/${_variant}_paks/chrome_100_percent.pak", "$target_gen_dir/${_variant}_paks/resources.pak", @@ -1326,24 +1307,14 @@ } } - # Resource packaging varies with Monochrome and bundles because the pak - # resource whitelist is derived from the native library. - resource_packaging("chrome_apk_pak_assets") { + resource_packaging("") { is_monochrome = false is_bundle = false } - resource_packaging("monochrome_apk_pak_assets") { + resource_packaging("") { is_monochrome = true is_bundle = false } - resource_packaging("chrome_bundle_pak_assets") { - is_monochrome = false - is_bundle = true - } - resource_packaging("monochrome_bundle_pak_assets") { - is_monochrome = true - is_bundle = true - } # TODO(cjgrant): Remove this temporary alias after downstream renaming lands. java_group("chrome_public_pak_assets") { @@ -1361,29 +1332,17 @@ # for 64-bit APK. if (!android_64bit_target_cpu || current_toolchain == android_secondary_abi_toolchain) { - # Monochrome equivalent of Chrome's APK or bundle library template. - template("libmonochrome_apk_or_bundle_tmpl") { - chrome_common_shared_library(target_name) { - forward_variables_from(invoker, "*") - sources = [ - "../browser/android/monochrome_entry_point.cc", - ] - deps = [ - "//android_webview:common", - ] + chrome_common_shared_library("monochrome") { + sources = [ + "../browser/android/monochrome_entry_point.cc", + ] + deps = [ + "//android_webview:common", + ] - export_java_symbols = true - enable_compressed_relocations = use_lld - use_gnu_hash_style = true - } - } - - # Monochrome APK native library. - libmonochrome_apk_or_bundle_tmpl("monochrome") { - } - - # Monochrome bundle native library. - libmonochrome_apk_or_bundle_tmpl("monochrome_base") { + export_java_symbols = true + enable_compressed_relocations = use_lld + use_gnu_hash_style = true } } else { group("monochrome_secondary_abi_lib") { @@ -1391,11 +1350,6 @@ ":monochrome($android_secondary_abi_toolchain)", ] } - group("monochrome_base_secondary_abi_lib") { - public_deps = [ - ":monochrome_base($android_secondary_abi_toolchain)", - ] - } } # Java libraries that go into each public chrome APK and base module. The chrome @@ -1428,6 +1382,7 @@ ":chrome_public_apk_resources", ":chrome_public_base_module_java", ":chrome_public_non_pak_assets", + ":chrome_apk_pak_assets", ] generate_jni("test_support_jni_headers") { @@ -1511,18 +1466,10 @@ android_manifest_dep = ":chrome_public_android_manifest" } - if (invoker.target_type == "android_app_bundle_module") { - deps += [ ":chrome_bundle_pak_assets" ] - _suffix = "_base" - } else { - deps += [ ":chrome_apk_pak_assets" ] - _suffix = "" - } - - shared_libraries = [ ":libchrome${_suffix}" ] + shared_libraries = [ ":libchrome" ] add_unwind_tables_in_apk = _add_unwind_tables_in_chrome_public_apk if (_add_unwind_tables_in_chrome_public_apk) { - shared_library_for_unwind_asset = "chrome${_suffix}" + shared_library_for_unwind_asset = "chrome" } # Android supports webp transparent resources properly since API level 18, @@ -1775,7 +1722,6 @@ } deps = _chrome_public_shared_deps + invoker.deps + [ - ":chrome_apk_pak_assets", ":chrome_public_base_module_java_for_test", "//third_party/android_support_test_runner:runner_java", "//third_party/android_tools:android_test_base_java",
diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni index 0a95682..3915df1f 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni
@@ -4,10 +4,10 @@ import("//base/android/linker/config.gni") import("//base/android/proguard/proguard.gni") -import("//build/config/android/extract_unwind_tables.gni") import("//build/config/android/rules.gni") -import("//build/config/compiler/compiler.gni") import("//build/config/locales.gni") +import("//build/config/android/extract_unwind_tables.gni") +import("//build/config/compiler/compiler.gni") import("//chrome/common/features.gni") import("//device/vr/buildflags/buildflags.gni") import("channel.gni") @@ -220,25 +220,14 @@ !invoker.use_trichrome_library) { # Always build 64-bit //android_webview:monochrome because Chrome runs # in 32-bit mode. - if (invoker.target_type == "android_app_bundle_module") { - _suffix = "_base" - } else { - _suffix = "" - } if (android_64bit_target_cpu) { shared_libraries = [ "//android_webview:monochrome" ] - if (invoker.add_unwind_tables_in_apk) { - shared_library_for_unwind_asset = "monochrome" - } - if (build_apk_secondary_abi) { - secondary_abi_shared_libraries = - [ "//chrome/android:monochrome${_suffix}_secondary_abi_lib" ] - } } else { - shared_libraries = [ "//chrome/android:monochrome${_suffix}" ] - if (invoker.add_unwind_tables_in_apk) { - shared_library_for_unwind_asset = "monochrome${_suffix}" - } + shared_libraries = [ "//chrome/android:monochrome" ] + } + if (android_64bit_target_cpu && build_apk_secondary_abi) { + secondary_abi_shared_libraries = + [ "//chrome/android:monochrome_secondary_abi_lib" ] } } else { # Include a 32-bit placeholder library to ensure that Chrome runs in @@ -250,6 +239,9 @@ native_lib_placeholders = [ "libdummy.so" ] } } + if (invoker.add_unwind_tables_in_apk) { + shared_library_for_unwind_asset = "monochrome" + } alternative_android_sdk_dep = webview_framework_dep app_as_shared_lib = true @@ -290,13 +282,9 @@ "//android_webview/apk:webview_license_activity_java", "//android_webview/glue", "//chrome/android:chrome_public_non_pak_assets", + "//chrome/android:monochrome_apk_pak_assets", "//chrome/android/monochrome:monochrome_license_provider_java", ] - if (invoker.target_type == "android_app_bundle_module") { - deps += [ "//chrome/android:monochrome_bundle_pak_assets" ] - } else { - deps += [ "//chrome/android:monochrome_apk_pak_assets" ] - } if (_enable_multidex && invoker.target_type == "android_apk" && !defined(invoker.negative_main_dex_globs)) { @@ -340,3 +328,21 @@ } } } + +# These empty templates are still being called from the clank/ BUILD.gn +# scripts. Remove them when they have been fixed to call the +# xxx_common_apk_or_module_tmpl templates above. + +template("chrome_public_apk_tmpl") { + chrome_public_common_apk_or_module_tmpl(target_name) { + forward_variables_from(invoker, "*") + target_type = "android_apk" + } +} + +template("monochrome_public_apk_tmpl") { + monochrome_public_common_apk_or_module_tmpl(target_name) { + forward_variables_from(invoker, "*") + target_type = "android_apk" + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java index 103e459f..361fe03 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiController.java
@@ -222,19 +222,22 @@ assert scriptNames.length == scriptPaths.length; assert scriptNames.length == scriptsHighlightFlags.length; - ArrayList<AutofillAssistantUiDelegate.ScriptHandle> scriptHandles = new ArrayList<>(); - // Note that scriptNames, scriptPaths and scriptsHighlightFlags are one-on-one matched by + List<AutofillAssistantUiDelegate.ScriptHandle> scriptHandles = new ArrayList<>(); + // Note that scriptNames, scriptsHighlightFlags and scriptPaths are one-on-one matched by // index. for (int i = 0; i < scriptNames.length; i++) { scriptHandles.add(new AutofillAssistantUiDelegate.ScriptHandle( - scriptNames[i], scriptPaths[i], scriptsHighlightFlags[i])); + scriptNames[i], scriptsHighlightFlags[i], scriptPaths[i])); } mUiDelegateHolder.performUiOperation(uiDelegate -> uiDelegate.updateScripts(scriptHandles)); } @CalledByNative - private void onChoose(String[] names, byte[][] serverPayloads) { + private void onChoose(String[] names, byte[][] serverPayloads, boolean[] highlightFlags) { + assert names.length == serverPayloads.length; + assert names.length == highlightFlags.length; + // An empty choice list is supported, as selection can still be forced. onForceChoose should // be a no-op in this case. if (names.length == 0) return; @@ -242,7 +245,8 @@ List<AutofillAssistantUiDelegate.Choice> choices = new ArrayList<>(); assert (names.length == serverPayloads.length); for (int i = 0; i < names.length; i++) { - choices.add(new AutofillAssistantUiDelegate.Choice(names[i], serverPayloads[i])); + choices.add(new AutofillAssistantUiDelegate.Choice( + names[i], highlightFlags[i], serverPayloads[i])); } mUiDelegateHolder.performUiOperation(uiDelegate -> uiDelegate.showChoices(choices)); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiDelegate.java index dc9111f..f51a4b1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiDelegate.java
@@ -181,59 +181,62 @@ void onInitOk(); } - /** - * Java side equivalent of autofill_assistant::ScriptHandle. - */ - protected static class ScriptHandle { - /** The display name of this script. */ + /** Describes a chip to display. */ + static class Chip { private final String mName; - /** The script path. */ - private final String mPath; - /** Whether the script should be highlighted. */ private final boolean mHighlight; - /** Constructor. */ - public ScriptHandle(String name, String path, boolean highlight) { - mName = name; - mPath = path; - mHighlight = highlight; - } - - /** Returns the display name. */ - public String getName() { - return mName; - } - - /** Returns the script path. */ - public String getPath() { - return mPath; - } - - /** Returns whether the script should be highlighted. */ - public boolean isHighlight() { - return mHighlight; - } - } - - /** A choice to pass to {@link AutofillAssistantUiDelegate#onChoose}. */ - static class Choice { - private final String mName; - private final byte[] mServerPayload; - /** Returns the localized name to display. */ String getName() { return mName; } - /** Returns the server payload associated with this choice, to pass to the callback. */ - byte[] getServerPayload() { - return mServerPayload; + /** Returns {@code true} if the choice should be highlight. */ + boolean isHighlight() { + return mHighlight; } - Choice(String name, byte[] serverPayload) { + Chip(String name, boolean highlight) { mName = name; + mHighlight = highlight; + } + } + + /** Functional interface that acts on a chip. */ + interface ChipAction<T extends Chip> { + void apply(T chip); + } + + /** Java side equivalent of autofill_assistant::ScriptHandle. */ + static class ScriptHandle extends Chip { + private final String mPath; + + /** Constructor. */ + ScriptHandle(String name, boolean highlight, String path) { + super(name, highlight); + mPath = path; + } + + /** Returns the script path. */ + String getPath() { + return mPath; + } + } + + /** Java side equivalent of autofill_assistant::UiController::Choice. */ + static class Choice extends Chip { + private final byte[] mServerPayload; + + /** Constructor. */ + Choice(String name, boolean highlight, byte[] serverPayload) { + super(name, highlight); mServerPayload = serverPayload; } + + /** Returns the serverPayload that corresponds to that choice. */ + byte[] getServerPayload() { + return mServerPayload; + } } // Names borrowed from : @@ -319,34 +322,36 @@ * * @param scriptHandles List of scripts to show. */ - public void updateScripts(ArrayList<ScriptHandle> scriptHandles) { + public void updateScripts(List<ScriptHandle> scriptHandles) { if (scriptHandles.isEmpty()) { clearCarousel(); return; } - boolean alignRight = hasHighlightedScript(scriptHandles); + addChips(scriptHandles, scriptHandle -> { + clearCarousel(); + mClient.onScriptSelected(scriptHandle.getPath()); + }); + } + + private <T extends Chip> void addChips(Iterable<T> chips, ChipAction<T> onClick) { + boolean alignRight = hasHighlightedScript(chips); @ChipStyle int nonHighlightStyle = alignRight ? ChipStyle.BUTTON_HAIRLINE : ChipStyle.CHIP_ASSISTIVE; - ArrayList<View> childViews = new ArrayList<>(); - for (int i = 0; i < scriptHandles.size(); i++) { - ScriptHandle scriptHandle = scriptHandles.get(i); + List<View> childViews = new ArrayList<>(); + for (T chip : chips) { @ChipStyle - int chipStyle = - scriptHandle.isHighlight() ? ChipStyle.BUTTON_FILLED : nonHighlightStyle; - TextView chipView = createChipView(scriptHandle.getName(), chipStyle); - chipView.setOnClickListener((unusedView) -> { - clearCarousel(); - mClient.onScriptSelected(scriptHandle.getPath()); - }); + int chipStyle = chip.isHighlight() ? ChipStyle.BUTTON_FILLED : nonHighlightStyle; + TextView chipView = createChipView(chip.getName(), chipStyle); + chipView.setOnClickListener((unusedView) -> onClick.apply(chip)); childViews.add(chipView); } setCarouselChildViews(childViews, alignRight); } - private boolean hasHighlightedScript(ArrayList<ScriptHandle> scripts) { - for (int i = 0; i < scripts.size(); i++) { - if (scripts.get(i).isHighlight()) { + private boolean hasHighlightedScript(Iterable<? extends Chip> chips) { + for (Chip chip : chips) { + if (chip.isHighlight()) { return true; } } @@ -693,16 +698,10 @@ /** Shows chip with the given choices. */ public void showChoices(List<Choice> choices) { - List<View> childViews = new ArrayList<>(); - for (Choice choice : choices) { - TextView chipView = createChipView(choice.getName(), ChipStyle.CHIP_ASSISTIVE); - chipView.setOnClickListener(unusedView -> { - clearCarousel(); - mClient.onChoice(choice.getServerPayload()); - }); - childViews.add(chipView); - } - setCarouselChildViews(childViews, /* alignRight= */ false); + addChips(choices, choice -> { + clearCarousel(); + mClient.onChoice(choice.getServerPayload()); + }); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java index 7131988..d16f79f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java
@@ -132,6 +132,12 @@ if (!accountsChanged) { mAccountTrackerService.validateSystemAccounts(); } + if (mSigninManager.isOperationInProgress()) { + // Wait for ongoing sign-in/sign-out operation to finish before validating accounts. + mSigninManager.runAfterOperationInProgress( + () -> validateAccountsInternal(accountsChanged)); + return; + } Account syncAccount = mChromeSigninController.getSignedInUser(); if (syncAccount == null) { @@ -159,11 +165,13 @@ @Override protected void onPostExecute(Void result) { String renamedAccount = getNewSignedInAccountName(); - if (renamedAccount == null) { - mSigninManager.signOut(SignoutReason.ACCOUNT_REMOVED_FROM_DEVICE); - } else { + if (renamedAccount != null || mSigninManager.isOperationInProgress()) { + // Found account rename event or there's a sign-in/sign-out operation in + // progress. Restart validation process. validateAccountsInternal(true); + return; } + mSigninManager.signOut(SignoutReason.ACCOUNT_REMOVED_FROM_DEVICE); } }; task.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java index 332f8ff..51bf184 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninManager.java
@@ -8,6 +8,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; +import android.support.annotation.MainThread; import android.support.annotation.Nullable; import org.chromium.base.ActivityState; @@ -31,6 +32,9 @@ import org.chromium.components.signin.ChromeSigninController; import org.chromium.components.sync.AndroidSyncSettings; +import java.util.ArrayList; +import java.util.List; + /** * Android wrapper of the SigninManager which provides access from the Java layer. * <p/> @@ -177,6 +181,7 @@ private final ObserverList<SignInStateObserver> mSignInStateObservers = new ObserverList<>(); private final ObserverList<SignInAllowedObserver> mSignInAllowedObservers = new ObserverList<>(); + private List<Runnable> mCallbacksWaitingForPendingOperation = new ArrayList<>(); private boolean mSigninAllowedByPolicy; /** @@ -491,6 +496,7 @@ Log.d(TAG, "Signin completed."); mSignInState = null; + notifyCallbacksWaitingForOperation(); notifySignInAllowedChanged(); for (SignInStateObserver observer : mSignInStateObservers) { @@ -499,6 +505,39 @@ } /** + * Returns true if a sign-in or sign-out operation is in progress. See also + * {@link #runAfterOperationInProgress}. + */ + @MainThread + public boolean isOperationInProgress() { + ThreadUtils.assertOnUiThread(); + return mSignInState != null || mSignOutState != null; + } + + /** + * Schedules the runnable to be invoked after currently ongoing a sign-in or sign-out operation + * is finished. If there's no operation is progress, posts the callback to the UI thread right + * away. See also {@link #isOperationInProgress}. + */ + @MainThread + public void runAfterOperationInProgress(Runnable runnable) { + ThreadUtils.assertOnUiThread(); + if (isOperationInProgress()) { + mCallbacksWaitingForPendingOperation.add(runnable); + return; + } + ThreadUtils.postOnUiThread(runnable); + } + + private void notifyCallbacksWaitingForOperation() { + ThreadUtils.assertOnUiThread(); + for (Runnable callback : mCallbacksWaitingForPendingOperation) { + callback.run(); + } + mCallbacksWaitingForPendingOperation.clear(); + } + + /** * Invokes signOut and returns a {@link Promise} that will be fulfilled on completion. * This is equivalent to calling {@link #signOut(@SignoutReason int signoutSource, Runnable * callback)} with a callback that fulfills the returned {@link Promise}. @@ -574,6 +613,7 @@ SignInState signInState = mSignInState; assert signInState != null; mSignInState = null; + notifyCallbacksWaitingForOperation(); if (signInState.mCallback != null) { signInState.mCallback.onSignInAborted(); @@ -670,6 +710,7 @@ ThreadUtils.postOnUiThread(mSignOutState.mCallback); } mSignOutState = null; + notifyCallbacksWaitingForOperation(); for (SignInStateObserver observer : mSignInStateObservers) { observer.onSignedOut();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java index 2cd1bdb1..fc1c5ef2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/developer/TracingPreferencesTest.java
@@ -276,6 +276,7 @@ @MediumTest @Feature({"Preferences"}) @Features.EnableFeatures(ChromeFeatureList.DEVELOPER_PREFERENCES) + @DisableIf.Build(sdk_is_less_than = 21, message = "crbug.com/908118") public void testSelectCategories() throws Exception { Context context = ContextUtils.getApplicationContext(); // We need a renderer so that its tracing categories will be populated.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java index c5485fe..50ca2765 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/BookmarksTest.java
@@ -17,7 +17,6 @@ import org.chromium.base.ThreadUtils; import org.chromium.base.test.util.CommandLineFlags; -import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.bookmarks.BookmarkBridge; @@ -104,6 +103,7 @@ assertClientBookmarkCount(0); assertServerBookmarkCountWithName(0, TITLE); assertServerBookmarkCountWithName(0, MODIFIED_TITLE); + assertServerBookmarkCountWithName(0, FOLDER_TITLE); } // Test syncing a new bookmark from server to client. @@ -315,7 +315,6 @@ @Test @LargeTest @Feature({"Sync"}) - @DisabledTest(message = "crbug.com/823484") public void testUploadMovedBookmark() throws Exception { // Add the entity to test moving. BookmarkId bookmarkId = addClientBookmark(TITLE, URL); @@ -497,7 +496,8 @@ String id = entity.getIdString(); String parentId = entity.getParentIdString(); BookmarkSpecifics specifics = entity.getSpecifics().getBookmark(); - bookmarks.add(new Bookmark(id, specifics.getTitle(), specifics.getUrl(), parentId)); + bookmarks.add(new Bookmark(id, specifics.getTitle(), + entity.getFolder() ? null : specifics.getUrl(), parentId)); } return bookmarks; }
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.cc b/chrome/browser/android/autofill_assistant/ui_controller_android.cc index 3210eab..f1be6789 100644 --- a/chrome/browser/android/autofill_assistant/ui_controller_android.cc +++ b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
@@ -324,15 +324,19 @@ std::vector<std::string> names; std::vector<std::string> server_payload; + bool highlights[choices.size()]; + int i = 0; for (const auto& choice : choices) { names.emplace_back(choice.name); server_payload.emplace_back(choice.server_payload); + highlights[i++] = choice.highlight; } JNIEnv* env = AttachCurrentThread(); Java_AutofillAssistantUiController_onChoose( env, java_autofill_assistant_ui_controller_, base::android::ToJavaArrayOfStrings(env, names), - base::android::ToJavaArrayOfByteArray(env, server_payload)); + base::android::ToJavaArrayOfByteArray(env, server_payload), + base::android::ToJavaBooleanArray(env, highlights, choices.size())); } void UiControllerAndroid::ForceChoose(const std::string& result) {
diff --git a/chrome/browser/autofill/autofill_interactive_uitest.cc b/chrome/browser/autofill/autofill_interactive_uitest.cc index b835f31..6167c0b4 100644 --- a/chrome/browser/autofill/autofill_interactive_uitest.cc +++ b/chrome/browser/autofill/autofill_interactive_uitest.cc
@@ -2231,11 +2231,39 @@ EXPECT_EQ("red.swingline@initech.com", value) << "for second field"; } -// The following three tests verify that we can autofill forms with multiple +// The following four tests verify that we can autofill forms with multiple // nameless forms, and repetitive field names and make sure that the dynamic // refill would not trigger a wrong refill, regardless of the form. IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, - Dynamic_MultipleNoNameForms_BadNames_LastForm) { + Dynamic_MultipleNoNameForms_BadNames_FourthForm) { + CreateTestProfile(); + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeature(features::kAutofillDynamicForms); + + GURL url = embedded_test_server()->GetURL( + "a.com", "/autofill/multiple_noname_forms_badnames.html"); + + ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), url)); + + TriggerFormFill("firstname_4"); + DoNothingAndWait(2); // Wait to make sure possible refills have happened. + // Make sure the correct form was filled. + ExpectFieldValue("firstname_1", ""); + ExpectFieldValue("lastname_1", ""); + ExpectFieldValue("email_1", ""); + ExpectFieldValue("firstname_2", ""); + ExpectFieldValue("lastname_2", ""); + ExpectFieldValue("email_2", ""); + ExpectFieldValue("firstname_3", ""); + ExpectFieldValue("lastname_3", ""); + ExpectFieldValue("email_3", ""); + ExpectFieldValue("firstname_4", "Milton"); + ExpectFieldValue("lastname_4", "Waddams"); + ExpectFieldValue("email_4", "red.swingline@initech.com"); +} + +IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, + Dynamic_MultipleNoNameForms_BadNames_ThirdForm) { CreateTestProfile(); base::test::ScopedFeatureList scoped_feature_list; scoped_feature_list.InitAndEnableFeature(features::kAutofillDynamicForms); @@ -2257,6 +2285,9 @@ ExpectFieldValue("firstname_3", "Milton"); ExpectFieldValue("lastname_3", "Waddams"); ExpectFieldValue("email_3", "red.swingline@initech.com"); + ExpectFieldValue("firstname_4", ""); + ExpectFieldValue("lastname_4", ""); + ExpectFieldValue("email_4", ""); } IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest,
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index d9a9d11..39307fa 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -878,7 +878,9 @@ if (result_code_ == service_manager::RESULT_CODE_NORMAL_EXIT) { #if !defined(OS_ANDROID) // These members must be initialized before exiting this function normally. +#if !defined(OS_CHROMEOS) DCHECK(master_prefs_.get()); +#endif // !defined(OS_CHROMEOS) DCHECK(browser_creator_.get()); #endif // !defined(OS_ANDROID) for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) @@ -912,16 +914,17 @@ } #endif // defined(OS_WIN) -#if !defined(OS_ANDROID) - master_prefs_ = std::make_unique<first_run::MasterPrefs>(); -#endif - if (browser_process_->actual_locale().empty()) { *failed_to_load_resource_bundle = true; return chrome::RESULT_CODE_MISSING_DATA; } - const int apply_first_run_result = ApplyFirstRunPrefs(); +#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) + master_prefs_ = chrome_feature_list_creator_->TakeMasterPrefs(); +#endif + + const int apply_first_run_result = + chrome_feature_list_creator_->master_prefs_apply_result(); if (apply_first_run_result != service_manager::RESULT_CODE_NORMAL_EXIT) return apply_first_run_result; @@ -935,59 +938,6 @@ return service_manager::RESULT_CODE_NORMAL_EXIT; } -int ChromeBrowserMainParts::ApplyFirstRunPrefs() { -// Android does first run in Java instead of native. -// Chrome OS has its own out-of-box-experience code. -#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) - // On first run, we need to process the predictor preferences before the - // browser's profile_manager object is created, but after ResourceBundle - // is initialized. - if (!first_run::IsChromeFirstRun()) - return service_manager::RESULT_CODE_NORMAL_EXIT; - - first_run::ProcessMasterPreferencesResult pmp_result = - first_run::ProcessMasterPreferences(user_data_dir_, master_prefs_.get()); - if (pmp_result == first_run::EULA_EXIT_NOW) - return chrome::RESULT_CODE_EULA_REFUSED; - - // TODO(macourteau): refactor preferences that are copied from - // master_preferences into local_state, as a "local_state" section in - // master preferences. If possible, a generic solution would be preferred - // over a copy one-by-one of specific preferences. Also see related TODO - // in first_run.h. - - PrefService* local_state = g_browser_process->local_state(); - // Store the initial VariationsService seed in local state, if it exists - // in master prefs. - if (!master_prefs_->compressed_variations_seed.empty()) { - local_state->SetString(variations::prefs::kVariationsCompressedSeed, - master_prefs_->compressed_variations_seed); - if (!master_prefs_->variations_seed_signature.empty()) { - local_state->SetString(variations::prefs::kVariationsSeedSignature, - master_prefs_->variations_seed_signature); - } - // Set the variation seed date to the current system time. If the user's - // clock is incorrect, this may cause some field trial expiry checks to - // not do the right thing until the next seed update from the server, - // when this value will be updated. - local_state->SetInt64(variations::prefs::kVariationsSeedDate, - base::Time::Now().ToInternalValue()); - } - - if (!master_prefs_->suppress_default_browser_prompt_for_version.empty()) { - local_state->SetString( - prefs::kBrowserSuppressDefaultBrowserPrompt, - master_prefs_->suppress_default_browser_prompt_for_version); - } - -#if defined(OS_WIN) - if (!master_prefs_->welcome_page_on_os_upgrade_enabled) - local_state->SetBoolean(prefs::kWelcomePageOnOSUpgradeEnabled, false); -#endif -#endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS) - return service_manager::RESULT_CODE_NORMAL_EXIT; -} - int ChromeBrowserMainParts::PreCreateThreadsImpl() { TRACE_EVENT0("startup", "ChromeBrowserMainParts::PreCreateThreadsImpl") run_message_loop_ = false;
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h index f21f7543..dba40fc0 100644 --- a/chrome/browser/chrome_browser_main.h +++ b/chrome/browser/chrome_browser_main.h
@@ -123,11 +123,6 @@ // if the ResourceBundle couldn't be loaded. int OnLocalStateLoaded(bool* failed_to_load_resource_bundle); - // Applies any preferences (to local state) needed for first run. This is - // always called and early outs if not first-run. Return value is an exit - // status, RESULT_CODE_NORMAL_EXIT indicates success. - int ApplyFirstRunPrefs(); - // Methods for Main Message Loop ------------------------------------------- int PreCreateThreadsImpl();
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc index c5858972..cb3389cd 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
@@ -282,7 +282,6 @@ ZipCase("zipFileOpenDownloadsShiftJIS"), ZipCase("zipFileOpenDownloadsMacOs"), ZipCase("zipFileOpenDownloadsWithAbsolutePaths"), - ZipCase("zipFileOpenDownloadsEncryptedCancelPassphrase"), ZipCase("zipFileOpenDrive").DisableDriveFs(), ZipCase("zipFileOpenDrive").EnableDriveFs(), ZipCase("zipFileOpenUsb"),
diff --git a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc index 90b87a4..681c27a88 100644 --- a/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc
@@ -18,9 +18,7 @@ #include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/strcat.h" -#include "base/strings/string_number_conversions.h" #include "base/strings/string_piece.h" -#include "base/strings/utf_string_conversions.h" #include "base/threading/thread_restrictions.h" #include "base/time/time.h" #include "chrome/browser/browser_process.h" @@ -1602,71 +1600,6 @@ return; } - if (name == "getAppWindowId") { - std::string window_url; - ASSERT_TRUE(value.GetString("windowUrl", &window_url)); - - const auto& app_windows = - extensions::AppWindowRegistry::Get(profile())->app_windows(); - ASSERT_FALSE(app_windows.empty()); - *output = "none"; - for (auto* window : app_windows) { - if (!window->web_contents()) - continue; - - if (window->web_contents()->GetLastCommittedURL() == window_url) { - *output = base::NumberToString(window->session_id().id()); - break; - } - } - return; - } - - if (name == "countAppWindows") { - std::string app_id; - ASSERT_TRUE(value.GetString("appId", &app_id)); - - const auto& app_windows = - extensions::AppWindowRegistry::Get(profile())->app_windows(); - ASSERT_FALSE(app_windows.empty()); - int window_count = 0; - for (auto* window : app_windows) { - if (window->extension_id() == app_id) - window_count++; - } - *output = base::NumberToString(window_count); - return; - } - - if (name == "runJsInAppWindow") { - std::string window_id_str; - ASSERT_TRUE(value.GetString("windowId", &window_id_str)); - int window_id = 0; - ASSERT_TRUE(base::StringToInt(window_id_str, &window_id)); - std::string script; - ASSERT_TRUE(value.GetString("script", &script)); - - const auto& app_windows = - extensions::AppWindowRegistry::Get(profile())->app_windows(); - ASSERT_FALSE(app_windows.empty()); - for (auto* window : app_windows) { - CHECK(window); - if (window->session_id().id() != window_id) { - continue; - } - - if (!window->web_contents()) - break; - - CHECK(window->web_contents()->GetMainFrame()); - window->web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( - base::UTF8ToUTF16(script)); - - break; - } - return; - } - if (name == "enableTabletMode") { ::test::SetAndWaitForTabletMode(true); *output = "tabletModeEnabled";
diff --git a/chrome/browser/conflicts/module_database_win.cc b/chrome/browser/conflicts/module_database_win.cc index d00e1c5..145f969 100644 --- a/chrome/browser/conflicts/module_database_win.cc +++ b/chrome/browser/conflicts/module_database_win.cc
@@ -11,6 +11,7 @@ #include "base/files/file_path.h" #include "base/location.h" #include "chrome/browser/conflicts/module_database_observer_win.h" +#include "content/public/browser/browser_task_traits.h" #if defined(GOOGLE_CHROME_BUILD) #include "base/feature_list.h" @@ -22,6 +23,7 @@ #include "chrome/browser/conflicts/third_party_conflicts_manager_win.h" #include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" +#include "chrome_elf/third_party_dlls/public_api.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" @@ -263,6 +265,20 @@ return !third_party_blocking_enabled_pref->IsManaged() || third_party_blocking_enabled_pref->GetValue()->GetBool(); } + +// static +void ModuleDatabase::DisableThirdPartyBlocking() { + // Immediately disable the hook. DisableHook() can be called concurrently. + DisableHook(); + + // Notify the ThirdPartyMetricsRecorder instance that the hook is disabled. + // Since this is meant for a heartbeat metric, the small latency introduced + // with the thread-hopping is perfectly acceptable. + base::PostTaskWithTraits( + FROM_HERE, {content::BrowserThread::UI}, base::BindOnce([]() { + ModuleDatabase::GetInstance()->third_party_metrics_.SetHookDisabled(); + })); +} #endif // defined(GOOGLE_CHROME_BUILD) // static
diff --git a/chrome/browser/conflicts/module_database_win.h b/chrome/browser/conflicts/module_database_win.h index 70e4c3707..94b87ee5 100644 --- a/chrome/browser/conflicts/module_database_win.h +++ b/chrome/browser/conflicts/module_database_win.h
@@ -140,6 +140,15 @@ // administrative policy. static bool IsThirdPartyBlockingPolicyEnabled(); + // Disables the blocking of third-party modules in the browser process. It is + // safe to invoke this function from any thread. + // This function is meant to be used only as a workaround for the in-process + // printing code that may require that third-party DLLs be successfully + // loaded into the process to work correctly. + // TODO(pmonette): Remove this workaround when printing is moved to a utility + // process. See https://crbug.com/809738. + static void DisableThirdPartyBlocking(); + // Accessor for the third party conflicts manager. // Returns null if both the tracking of incompatible applications and the // blocking of third-party modules are disabled.
diff --git a/chrome/browser/conflicts/module_load_attempt_log_listener_win.cc b/chrome/browser/conflicts/module_load_attempt_log_listener_win.cc index 1fd45e5..8c1f504 100644 --- a/chrome/browser/conflicts/module_load_attempt_log_listener_win.cc +++ b/chrome/browser/conflicts/module_load_attempt_log_listener_win.cc
@@ -18,8 +18,8 @@ #include "base/task/post_task.h" #include "base/task_runner_util.h" #include "chrome/browser/conflicts/module_blacklist_cache_util_win.h" -#include "chrome_elf/third_party_dlls/logging_api.h" #include "chrome_elf/third_party_dlls/packed_list_format.h" +#include "chrome_elf/third_party_dlls/public_api.h" namespace {
diff --git a/chrome/browser/conflicts/third_party_metrics_recorder_win.cc b/chrome/browser/conflicts/third_party_metrics_recorder_win.cc index 5a67861..f64d5a6e 100644 --- a/chrome/browser/conflicts/third_party_metrics_recorder_win.cc +++ b/chrome/browser/conflicts/third_party_metrics_recorder_win.cc
@@ -18,11 +18,10 @@ #include "components/crash/core/common/crash_key.h" #if defined(GOOGLE_CHROME_BUILD) -#include "chrome_elf/third_party_dlls/logging_api.h" +#include "chrome_elf/third_party_dlls/public_api.h" #endif namespace { - // Returns true if the module is signed by Google. bool IsGoogleModule(base::StringPiece16 subject) { static const wchar_t kGoogle[] = L"Google Inc"; @@ -41,6 +40,9 @@ FROM_HERE, base::TimeDelta::FromMinutes(5), base::BindRepeating(&ThirdPartyMetricsRecorder::RecordHeartbeatMetrics, base::Unretained(this))); + + // Emit the result of applying the NtMapViewOfSection hook in chrome_elf.dll. + base::UmaHistogramSparse("ChromeElf.ApplyHookResult", GetApplyHookResult()); #endif } @@ -157,15 +159,23 @@ "ThirdPartyModules.Heartbeat.UniqueBlockedModulesCount", GetUniqueBlockedModulesCount()); - uint32_t blocked_modules_count = GetBlockedModulesCount(); - UMA_HISTOGRAM_COUNTS_1M("ThirdPartyModules.Heartbeat.BlockedModulesCount", - blocked_modules_count); + if (record_blocked_modules_count_) { + uint32_t blocked_modules_count = GetBlockedModulesCount(); + UMA_HISTOGRAM_COUNTS_1M("ThirdPartyModules.Heartbeat.BlockedModulesCount", + blocked_modules_count); - // Stop recording when |blocked_modules_count| gets too high. This is to avoid - // dealing with the possible integer overflow that would result in emitting - // wrong values. The exact cutoff point is not important but it must be higher - // than the max value for the histogram (1M in this case). - if (blocked_modules_count > std::numeric_limits<uint32_t>::max() / 2) - heartbeat_metrics_timer_.Reset(); + // Stop recording when |blocked_modules_count| gets too high. This is to + // avoid dealing with the possible integer overflow that would result in + // emitting wrong values. The exact cutoff point is not important but it + // must be higher than the max value for the histogram (1M in this case). + // It's ok to continue logging the count of unique blocked modules because + // there's no expectation that this count can reach a high value. + if (blocked_modules_count > std::numeric_limits<uint32_t>::max() / 2) + record_blocked_modules_count_ = false; + } + + UMA_HISTOGRAM_BOOLEAN( + "ThirdPartyModules.Heartbeat.PrintingWorkaround.BlockingEnabled", + hook_enabled_); } #endif
diff --git a/chrome/browser/conflicts/third_party_metrics_recorder_win.h b/chrome/browser/conflicts/third_party_metrics_recorder_win.h index f367f39a..7507671 100644 --- a/chrome/browser/conflicts/third_party_metrics_recorder_win.h +++ b/chrome/browser/conflicts/third_party_metrics_recorder_win.h
@@ -29,6 +29,10 @@ const ModuleInfoData& module_data) override; void OnModuleDatabaseIdle() override; +#if defined(GOOGLE_CHROME_BUILD) + void SetHookDisabled() { hook_enabled_ = false; } +#endif + private: // The size of the unsigned modules crash keys. static constexpr size_t kCrashKeySize = 256; @@ -47,6 +51,15 @@ // Timer that controls when heartbeat metrics are recorded. base::RepeatingTimer heartbeat_metrics_timer_; + + // Indicates if the ThirdPartyModules.Heartbeat.BlockedModulesCount heartbeat + // metric is being recorded. + bool record_blocked_modules_count_ = true; + + // Indicates if the blocking of third-party DLLs is still enabled or if it + // was disabled because in-process printing was invoked. + // See ModuleDatabase::DisableThirdPartyBlocking(). + bool hook_enabled_ = true; #endif // The index of the crash key that is currently being updated.
diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc index 8cdcb29..e671bc9 100644 --- a/chrome/browser/first_run/first_run_browsertest.cc +++ b/chrome/browser/first_run/first_run_browsertest.cc
@@ -12,6 +12,7 @@ #include "base/run_loop.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/metrics/histogram_tester.h" #include "build/build_config.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/component_loader.h" @@ -28,6 +29,9 @@ #include "chrome/test/base/ui_test_utils.h" #include "components/prefs/pref_service.h" #include "components/user_prefs/user_prefs.h" +#include "components/variations/metrics.h" +#include "components/variations/pref_names.h" +#include "components/variations/variations_switches.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "content/public/test/browser_test_utils.h" @@ -301,4 +305,56 @@ chrome_prefs::internals:: kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE)); +#define COMPRESSED_SEED_TEST_VALUE \ + "H4sICMNRYFcAA3NlZWRfYmluAOPSMEwxsjQxM0lLMk4xt0hLMzQ1NUs1TTI1NUw2MzExT05KNj" \ + "dJNU1LMRDay8glH+rrqBual5mWX5SbWVKpG1KUmZija2igG5BalJyaVyLRMGfSUlYLRif2lNS0" \ + "xNKcEi9uLhhTgNGLh4sjvSi/tCDewBCFZ4TCM0bhmaDwTFF4Zig8cxSeBQrPUoARAEVeJPrqAAAA" +#define SEED_SIGNATURE_TEST_VALUE \ + "MEQCIDD1IVxjzWYncun+9IGzqYjZvqxxujQEayJULTlbTGA/AiAr0oVmEgVUQZBYq5VLOSvy96" \ + "JkMYgzTkHPwbv7K/CmgA==" + +constexpr char kCompressedSeedTestValue[] = COMPRESSED_SEED_TEST_VALUE; +constexpr char kSignatureValue[] = SEED_SIGNATURE_TEST_VALUE; + +extern const char kWithVariationsPrefs[] = + "{\n" + " \"variations_compressed_seed\": \"" COMPRESSED_SEED_TEST_VALUE "\",\n" + " \"variations_seed_signature\": \"" SEED_SIGNATURE_TEST_VALUE "\"\n" + "}\n"; + +class FirstRunMasterPrefsVariationsSeedTest + : public FirstRunMasterPrefsBrowserTestT<kWithVariationsPrefs> { + public: + FirstRunMasterPrefsVariationsSeedTest() { + base::CommandLine::ForCurrentProcess()->AppendSwitch( + variations::switches::kDisableFieldTrialTestingConfig); + } + ~FirstRunMasterPrefsVariationsSeedTest() override = default; + + protected: + base::HistogramTester histogram_tester_; + + private: + DISALLOW_COPY_AND_ASSIGN(FirstRunMasterPrefsVariationsSeedTest); +}; + +#undef COMPRESSED_SEED_TEST_VALUE +#undef SEED_SIGNATURE_TEST_VALUE + +IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsVariationsSeedTest, Test) { + // Tests variation migration from master_preferences to local_state. + EXPECT_EQ(kCompressedSeedTestValue, + g_browser_process->local_state()->GetString( + variations::prefs::kVariationsCompressedSeed)); + EXPECT_EQ(kSignatureValue, g_browser_process->local_state()->GetString( + variations::prefs::kVariationsSeedSignature)); + + // Verify variations loaded in VariationsService by metrics. + histogram_tester_.ExpectUniqueSample("Variations.SeedLoadResult", + variations::StoreSeedResult::SUCCESS, 1); + histogram_tester_.ExpectUniqueSample( + "Variations.LoadSeedSignature", + variations::VerifySignatureResult::VALID_SIGNATURE, 1); +} + #endif // !defined(OS_CHROMEOS)
diff --git a/chrome/browser/media/webrtc/webrtc_browsertest.cc b/chrome/browser/media/webrtc/webrtc_browsertest.cc index a88de924..f85e1b4 100644 --- a/chrome/browser/media/webrtc/webrtc_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_browsertest.cc
@@ -122,12 +122,20 @@ content::WebContents* right_tab_; }; -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, +// TODO(898546): many of these tests are failing on ASan builds. +#if defined(ADDRESS_SANITIZER) +#define MAYBE_WebRtcBrowserTest DISABLED_WebRtcBrowserTest +class DISABLED_WebRtcBrowserTest : public WebRtcBrowserTest {}; +#else +#define MAYBE_WebRtcBrowserTest WebRtcBrowserTest +#endif + +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsVP8) { RunsAudioVideoWebRTCCallInTwoTabs("VP8"); } -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsVP9) { RunsAudioVideoWebRTCCallInTwoTabs("VP9"); } @@ -172,14 +180,14 @@ ASSERT_FALSE(tab->IsCrashed()); } -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsOfferRsaAnswerRsa) { RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec, false /* prefer_hw_video_codec */, kKeygenAlgorithmRsa, kKeygenAlgorithmRsa); } -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsOfferEcdsaAnswerEcdsa) { RunsAudioVideoWebRTCCallInTwoTabs( WebRtcTestBase::kUseDefaultVideoCodec, false /* prefer_hw_video_codec */, @@ -187,32 +195,32 @@ } IN_PROC_BROWSER_TEST_F( - WebRtcBrowserTest, + MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificateRsa) { RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificate(kKeygenAlgorithmRsa); } IN_PROC_BROWSER_TEST_F( - WebRtcBrowserTest, + MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificateEcdsa) { RunsAudioVideoWebRTCCallInTwoTabsWithClonedCertificate(kKeygenAlgorithmEcdsa); } -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsOfferRsaAnswerEcdsa) { RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec, false /* prefer_hw_video_codec */, kKeygenAlgorithmRsa, kKeygenAlgorithmEcdsa); } -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsOfferEcdsaAnswerRsa) { RunsAudioVideoWebRTCCallInTwoTabs(WebRtcTestBase::kUseDefaultVideoCodec, false /* prefer_hw_video_codec */, kKeygenAlgorithmEcdsa, kKeygenAlgorithmRsa); } -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsGetStatsCallback) { StartServerAndOpenTabs(); SetupPeerconnectionWithLocalStream(left_tab_); @@ -224,15 +232,8 @@ DetectVideoAndHangUp(); } -#if defined(OS_LINUX) && defined(ADDRESS_SANITIZER) -#define MAYBE_RunsAudioVideoWebRTCCallInTwoTabsGetStatsPromise \ - DISABLED_RunsAudioVideoWebRTCCallInTwoTabsGetStatsPromise -#else -#define MAYBE_RunsAudioVideoWebRTCCallInTwoTabsGetStatsPromise \ - RunsAudioVideoWebRTCCallInTwoTabsGetStatsPromise -#endif -IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, - MAYBE_RunsAudioVideoWebRTCCallInTwoTabsGetStatsPromise) { +IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, + RunsAudioVideoWebRTCCallInTwoTabsGetStatsPromise) { StartServerAndOpenTabs(); SetupPeerconnectionWithLocalStream(left_tab_); SetupPeerconnectionWithLocalStream(right_tab_); @@ -255,7 +256,7 @@ } IN_PROC_BROWSER_TEST_F( - WebRtcBrowserTest, + MAYBE_WebRtcBrowserTest, RunsAudioVideoWebRTCCallInTwoTabsEmitsGatheringStateChange) { StartServerAndOpenTabs(); SetupPeerconnectionWithLocalStream(left_tab_);
diff --git a/chrome/browser/metrics/chrome_feature_list_creator.cc b/chrome/browser/metrics/chrome_feature_list_creator.cc index 7a9ac6b..670bb56 100644 --- a/chrome/browser/metrics/chrome_feature_list_creator.cc +++ b/chrome/browser/metrics/chrome_feature_list_creator.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/metrics/chrome_feature_list_creator.h" #include <set> +#include <vector> #include "base/base_switches.h" #include "base/feature_list.h" @@ -23,6 +24,7 @@ #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/chrome_pref_service_factory.h" #include "chrome/common/chrome_paths.h" +#include "chrome/common/chrome_result_codes.h" #include "chrome/common/pref_names.h" #include "components/flags_ui/flags_ui_pref_names.h" #include "components/flags_ui/pref_service_flags_storage.h" @@ -38,6 +40,7 @@ #include "components/variations/pref_names.h" #include "components/variations/service/variations_service.h" #include "components/variations/variations_crash_keys.h" +#include "services/service_manager/embedder/result_codes.h" #include "ui/base/resource/resource_bundle.h" #if defined(OS_CHROMEOS) @@ -76,6 +79,7 @@ CreatePrefService(); ConvertFlagsToSwitches(); CreateMetricsServices(); + SetupMasterPrefs(); SetupFieldTrials(); } @@ -103,6 +107,13 @@ return std::move(pref_service_factory_); } +#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) +std::unique_ptr<first_run::MasterPrefs> +ChromeFeatureListCreator::TakeMasterPrefs() { + return std::move(master_prefs_); +} +#endif + void ChromeFeatureListCreator::CreatePrefService() { base::FilePath local_state_file; bool result = @@ -194,3 +205,64 @@ std::make_unique<metrics_services_manager::MetricsServicesManager>( std::move(client)); } + +void ChromeFeatureListCreator::SetupMasterPrefs() { + master_prefs_apply_result_ = ApplyFirstRunPrefs(); +} + +int ChromeFeatureListCreator::ApplyFirstRunPrefs() { +// Android does first run in Java instead of native. +// Chrome OS has its own out-of-box-experience code. +#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) + master_prefs_ = std::make_unique<first_run::MasterPrefs>(); + // On first run, we need to process the predictor preferences before the + // browser's profile_manager object is created, but after ResourceBundle + // is initialized. + if (!first_run::IsChromeFirstRun()) + return service_manager::RESULT_CODE_NORMAL_EXIT; + + base::FilePath user_data_dir; + if (!base::PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) + return chrome::RESULT_CODE_MISSING_DATA; + + first_run::ProcessMasterPreferencesResult pmp_result = + first_run::ProcessMasterPreferences(user_data_dir, master_prefs_.get()); + if (pmp_result == first_run::EULA_EXIT_NOW) + return chrome::RESULT_CODE_EULA_REFUSED; + + // TODO(macourteau): refactor preferences that are copied from + // master_preferences into local_state, as a "local_state" section in + // master preferences. If possible, a generic solution would be preferred + // over a copy one-by-one of specific preferences. Also see related TODO + // in first_run.h. + + // Store the initial VariationsService seed in local state, if it exists + // in master prefs. + if (!master_prefs_->compressed_variations_seed.empty()) { + local_state_->SetString(variations::prefs::kVariationsCompressedSeed, + master_prefs_->compressed_variations_seed); + if (!master_prefs_->variations_seed_signature.empty()) { + local_state_->SetString(variations::prefs::kVariationsSeedSignature, + master_prefs_->variations_seed_signature); + } + // Set the variation seed date to the current system time. If the user's + // clock is incorrect, this may cause some field trial expiry checks to + // not do the right thing until the next seed update from the server, + // when this value will be updated. + local_state_->SetInt64(variations::prefs::kVariationsSeedDate, + base::Time::Now().ToInternalValue()); + } + + if (!master_prefs_->suppress_default_browser_prompt_for_version.empty()) { + local_state_->SetString( + prefs::kBrowserSuppressDefaultBrowserPrompt, + master_prefs_->suppress_default_browser_prompt_for_version); + } + +#if defined(OS_WIN) + if (!master_prefs_->welcome_page_on_os_upgrade_enabled) + local_state_->SetBoolean(prefs::kWelcomePageOnOSUpgradeEnabled, false); +#endif +#endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS) + return service_manager::RESULT_CODE_NORMAL_EXIT; +}
diff --git a/chrome/browser/metrics/chrome_feature_list_creator.h b/chrome/browser/metrics/chrome_feature_list_creator.h index ac157364..c0ec41ac 100644 --- a/chrome/browser/metrics/chrome_feature_list_creator.h +++ b/chrome/browser/metrics/chrome_feature_list_creator.h
@@ -5,8 +5,13 @@ #ifndef CHROME_BROWSER_METRICS_CHROME_FEATURE_LIST_CREATOR_H_ #define CHROME_BROWSER_METRICS_CHROME_FEATURE_LIST_CREATOR_H_ +#include <memory> +#include <string> + #include "base/macros.h" +#include "build/build_config.h" #include "chrome/browser/chrome_browser_field_trials.h" +#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/metrics/field_trial_synchronizer.h" #include "chrome/browser/policy/chrome_browser_policy_connector.h" #include "components/metrics_services_manager/metrics_services_manager.h" @@ -44,6 +49,16 @@ std::unique_ptr<policy::ChromeBrowserPolicyConnector> TakeChromeBrowserPolicyConnector(); +#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) + std::unique_ptr<first_run::MasterPrefs> TakeMasterPrefs(); +#endif + + // Returns result of |ApplyFirstRunPrefs()|. + int master_prefs_apply_result() const { + DCHECK_NE(-1, master_prefs_apply_result_); + return master_prefs_apply_result_; + } + // Passes ownership of the |pref_service_factory_| to the caller. std::unique_ptr<prefs::InProcessPrefServiceFactory> TakePrefServiceFactory(); @@ -62,6 +77,12 @@ void ConvertFlagsToSwitches(); void SetupFieldTrials(); void CreateMetricsServices(); + void SetupMasterPrefs(); + + // Applies any preferences (to local state) needed for first run. This is + // always called and early outs if not first-run. Return value is an exit + // status, RESULT_CODE_NORMAL_EXIT indicates success. + int ApplyFirstRunPrefs(); // If TakePrefService() is called, the caller will take the ownership // of this variable. Stop using this variable afterwards. @@ -86,6 +107,13 @@ std::unique_ptr<prefs::InProcessPrefServiceFactory> pref_service_factory_; +#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) + std::unique_ptr<first_run::MasterPrefs> master_prefs_; +#endif + + // Keeps result of |ApplyFirstRunPrefs()| + int master_prefs_apply_result_ = -1; + DISALLOW_COPY_AND_ASSIGN(ChromeFeatureListCreator); };
diff --git a/chrome/browser/printing/DEPS b/chrome/browser/printing/DEPS index f5a9247..43cad55e 100644 --- a/chrome/browser/printing/DEPS +++ b/chrome/browser/printing/DEPS
@@ -1,3 +1,4 @@ include_rules = [ + "+chrome_elf/third_party_dlls/public_api.h", "+pdf/pdf.h", # Test only. ]
diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc index 2b7cd45..2283ce8c 100644 --- a/chrome/browser/printing/print_preview_dialog_controller.cc +++ b/chrome/browser/printing/print_preview_dialog_controller.cc
@@ -43,6 +43,10 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/web_dialogs/web_dialog_delegate.h" +#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) +#include "chrome/browser/conflicts/module_database_win.h" +#endif + using content::NavigationController; using content::WebContents; using content::WebUIMessageHandler; @@ -166,6 +170,10 @@ // static void PrintPreviewDialogController::PrintPreview(WebContents* initiator) { +#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) + ModuleDatabase::GetInstance()->DisableThirdPartyBlocking(); +#endif + if (initiator->ShowingInterstitialPage() || initiator->IsCrashed()) return;
diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc index b21042e..e415483 100644 --- a/chrome/browser/printing/printing_message_filter.cc +++ b/chrome/browser/printing/printing_message_filter.cc
@@ -37,6 +37,10 @@ #include "chrome/browser/printing/print_view_manager_basic.h" #endif +#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) +#include "chrome/browser/conflicts/module_database_win.h" +#endif + using content::BrowserThread; namespace printing { @@ -237,6 +241,10 @@ void PrintingMessageFilter::OnScriptedPrint( const PrintHostMsg_ScriptedPrint_Params& params, IPC::Message* reply_msg) { +#if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) + ModuleDatabase::GetInstance()->DisableThirdPartyBlocking(); +#endif + scoped_refptr<PrinterQuery> printer_query = queue_->PopPrinterQuery(params.cookie); if (!printer_query.get()) {
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc index a7fb8264..bebf223 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.cc
@@ -96,7 +96,7 @@ const std::string& passphrase) { base::AutoLock al(shared_state_lock_); // Signal VolumeReaderJavaScriptStream::Passphrase to continue execution. - available_passphrase_ = base::make_optional(passphrase); + available_passphrase_ = passphrase; available_passphrase_cond_.Signal(); } @@ -212,12 +212,14 @@ } base::Optional<std::string> VolumeReaderJavaScriptStream::Passphrase() { - // Reset the state and prompt the user for a passphrase. Assume a correct - // passphrase from a previous request has been saved by the requestor. + // The error is not recoverable. Once passphrase fails to be provided, it is + // never asked again. Note, that still users are able to retry entering the + // password, unless they click Cancel. { base::AutoLock al(shared_state_lock_); - passphrase_error_ = false; - available_passphrase_.reset(); + if (passphrase_error_) { + return {}; + } } // Request the passphrase outside of the lock. @@ -225,10 +227,13 @@ base::AutoLock al(shared_state_lock_); // Wait for the passphrase from JavaScript. - while (!passphrase_error_ && !available_passphrase_) - available_passphrase_cond_.Wait(); + // TODO(amistry): Handle spurious wakeups. + available_passphrase_cond_.Wait(); - return available_passphrase_; + if (passphrase_error_) + return {}; + + return base::make_optional<std::string>(available_passphrase_); } void VolumeReaderJavaScriptStream::RequestChunk(int64_t length) {
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h index 19540b21..db83d1f 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader_javascript_stream.h
@@ -9,7 +9,6 @@ #include <memory> #include <string> -#include "base/optional.h" #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h" #include "chrome/browser/resources/chromeos/zip_archiver/cpp/volume_reader.h" @@ -93,9 +92,7 @@ bool available_data_; // Indicates whether any data is available. bool read_error_; // Marks an error in reading from JavaScript. - // Stores a passphrase from JavaScript. Stored as a base::Optional<> because - // the user could have entered an empty passphrase. - base::Optional<std::string> available_passphrase_; + std::string available_passphrase_; // Stores a passphrase from JavaScript. bool passphrase_error_; // Marks an error in getting the passphrase. // The shared_state_lock_ is used to protect members which are accessed by
diff --git a/chrome/browser/resources/chromeos/zip_archiver/js/app.js b/chrome/browser/resources/chromeos/zip_archiver/js/app.js index be90d73..9bf237b1 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/js/app.js +++ b/chrome/browser/resources/chromeos/zip_archiver/js/app.js
@@ -188,15 +188,13 @@ if (chrome.extension.inIncognitoContext) return; - if (chrome.storage && chrome.storage.local) { - chrome.storage.local.get([unpacker.app.STORAGE_KEY], function(result) { - if (result[unpacker.app.STORAGE_KEY]) { - chrome.storage.local.clear(function() { - console.info('Cleaned up archive mount info from older versions.'); - }); - } - }); - } + chrome.storage.local.get([unpacker.app.STORAGE_KEY], function(result) { + if (result[unpacker.app.STORAGE_KEY]) { + chrome.storage.local.clear(function() { + console.info('Cleaned up archive mount info from older versions.'); + }); + } + }); }, /**
diff --git a/chrome/browser/resources/chromeos/zip_archiver/js/decompressor.js b/chrome/browser/resources/chromeos/zip_archiver/js/decompressor.js index 71fd2326..3aca206 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/js/decompressor.js +++ b/chrome/browser/resources/chromeos/zip_archiver/js/decompressor.js
@@ -307,5 +307,9 @@ this.naclModule_.postMessage( unpacker.request.createReadPassphraseErrorResponse( this.fileSystemId_, requestId)); + // TODO(mtomasz): Instead of unmounting just let the current operation + // fail and ask for password for another files. This is however + // impossible for now due to a bug in minizip. + unpacker.app.unmountVolume(this.fileSystemId_, true); }.bind(this)); };
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index 82e49c29..9d52c42 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc
@@ -736,7 +736,7 @@ // Test for crbug.com/22004. Reloading a page with a before unload handler and // then canceling the dialog should not leave the throbber spinning. // https://crbug.com/898370: Test is flakily timing out -IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { +IN_PROC_BROWSER_TEST_F(BrowserTest, DISABLED_ReloadThenCancelBeforeUnload) { GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); ui_test_utils::NavigateToURL(browser(), url); WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/renderer/extensions/cast_streaming_native_handler.cc b/chrome/renderer/extensions/cast_streaming_native_handler.cc index 6637e66..92e08b8 100644 --- a/chrome/renderer/extensions/cast_streaming_native_handler.cc +++ b/chrome/renderer/extensions/cast_streaming_native_handler.cc
@@ -511,7 +511,7 @@ CHECK_EQ(1, args.Length()); CHECK(args[0]->IsInt32()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); if (!GetRtpStreamOrThrow(transport_id)) return; rtp_stream_map_.erase(transport_id); @@ -522,7 +522,7 @@ CHECK_EQ(1, args.Length()); CHECK(args[0]->IsInt32()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); CastRtpStream* transport = GetRtpStreamOrThrow(transport_id); if (!transport) return; @@ -548,7 +548,7 @@ CHECK(args[0]->IsInt32()); CHECK(args[1]->IsObject()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); CastRtpStream* transport = GetRtpStreamOrThrow(transport_id); if (!transport) return; @@ -599,7 +599,7 @@ CHECK_EQ(1, args.Length()); CHECK(args[0]->IsInt32()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); CastRtpStream* transport = GetRtpStreamOrThrow(transport_id); if (!transport) return; @@ -611,7 +611,7 @@ CHECK_EQ(1, args.Length()); CHECK(args[0]->IsInt32()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); if (!GetUdpTransportOrThrow(transport_id)) return; udp_transport_map_.erase(transport_id); @@ -623,7 +623,7 @@ CHECK(args[0]->IsInt32()); CHECK(args[1]->IsObject()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); CastUdpTransport* transport = GetUdpTransportOrThrow(transport_id); if (!transport) return; @@ -647,7 +647,7 @@ CHECK(args[0]->IsInt32()); CHECK(args[1]->IsObject()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); CastUdpTransport* transport = GetUdpTransportOrThrow(transport_id); if (!transport) return; @@ -671,7 +671,7 @@ CHECK(args[0]->IsInt32()); CHECK(args[1]->IsBoolean()); - const int stream_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int stream_id = args[0].As<v8::Int32>()->Value(); CastRtpStream* stream = GetRtpStreamOrThrow(stream_id); if (!stream) return; @@ -687,7 +687,7 @@ CHECK(args[1]->IsNull() || args[1]->IsString()); CHECK(args[2]->IsFunction()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); v8::Isolate* isolate = args.GetIsolate(); v8::Global<v8::Function> callback(isolate, args[2].As<v8::Function>()); std::string extra_data; @@ -714,7 +714,7 @@ CHECK_EQ(2, args.Length()); CHECK(args[0]->IsInt32()); CHECK(args[1]->IsFunction()); - const int transport_id = args[0]->ToInt32(args.GetIsolate())->Value(); + const int transport_id = args[0].As<v8::Int32>()->Value(); CastRtpStream* transport = GetRtpStreamOrThrow(transport_id); if (!transport) return;
diff --git a/chrome/renderer/searchbox/searchbox_extension.cc b/chrome/renderer/searchbox/searchbox_extension.cc index 657a421f..311121b 100644 --- a/chrome/renderer/searchbox/searchbox_extension.cc +++ b/chrome/renderer/searchbox/searchbox_extension.cc
@@ -1041,7 +1041,7 @@ if (newtabpage_controller.IsEmpty()) return; - v8::Handle<v8::Object> chrome = + v8::Local<v8::Object> chrome = content::GetOrCreateChromeObject(isolate, context->Global()); v8::Local<v8::Object> embedded_search = v8::Object::New(isolate); embedded_search
diff --git a/chrome/test/data/autofill/multiple_noname_forms_badnames.html b/chrome/test/data/autofill/multiple_noname_forms_badnames.html index f5244ff..bce6ca59 100644 --- a/chrome/test/data/autofill/multiple_noname_forms_badnames.html +++ b/chrome/test/data/autofill/multiple_noname_forms_badnames.html
@@ -25,5 +25,11 @@ Email:<input type="text" name="email" id="email_3"/> </form> +<form> + Name:<input type="text" name="firstname" id="firstname_4" /> + Last Name:<input type="text" name="lastname" id="lastname_4"> + Email:<input type="text" name="email" id="email_4"/> +</form> + <hr /> </body>
diff --git a/chrome/test/data/chromeos/file_manager/encrypted.zip b/chrome/test/data/chromeos/file_manager/encrypted.zip deleted file mode 100644 index 99f3cce..0000000 --- a/chrome/test/data/chromeos/file_manager/encrypted.zip +++ /dev/null Binary files differ
diff --git a/chrome_elf/BUILD.gn b/chrome_elf/BUILD.gn index 7f780b5..61efc526 100644 --- a/chrome_elf/BUILD.gn +++ b/chrome_elf/BUILD.gn
@@ -256,10 +256,10 @@ source_set("third_party_shared_defines") { sources = [ "sha1/sha1.h", - "third_party_dlls/logging_api.cc", - "third_party_dlls/logging_api.h", "third_party_dlls/packed_list_format.cc", "third_party_dlls/packed_list_format.h", + "third_party_dlls/public_api.cc", + "third_party_dlls/public_api.h", "third_party_dlls/status_codes.cc", "third_party_dlls/status_codes.h", ]
diff --git a/chrome_elf/chrome_elf_test_stubs.cc b/chrome_elf/chrome_elf_test_stubs.cc index 23b1120..b35d37d 100644 --- a/chrome_elf/chrome_elf_test_stubs.cc +++ b/chrome_elf/chrome_elf_test_stubs.cc
@@ -10,7 +10,7 @@ #include "base/win/windows_types.h" #include "chrome/common/chrome_switches.h" #include "chrome_elf/chrome_elf_main.h" -#include "chrome_elf/third_party_dlls/logging_api.h" +#include "chrome_elf/third_party_dlls/public_api.h" // This function is a temporary workaround for https://crbug.com/655788. We // need to come up with a better way to initialize crash reporting that can @@ -43,7 +43,7 @@ //------------------------------------------------------------------------------ // chrome_elf\third_party_dlls export test stubs. // - For use by \\chrome\browser\conflicts\* testing. -// - Stubs should shadow third_party_dlls\logging_api.h and logs_unittest.cc. +// - Stubs should shadow third_party_dlls\public_api.h and logs_unittest.cc. //------------------------------------------------------------------------------ struct TestLogEntry { @@ -104,3 +104,9 @@ uint32_t GetUniqueBlockedModulesCount() { return 0; } + +void DisableHook() {} + +int32_t GetApplyHookResult() { + return 0; +}
diff --git a/chrome_elf/chrome_elf_x64.def b/chrome_elf/chrome_elf_x64.def index 1ba7006..c4d832c 100644 --- a/chrome_elf/chrome_elf_x64.def +++ b/chrome_elf/chrome_elf_x64.def
@@ -42,3 +42,7 @@ RegisterLogNotification GetBlockedModulesCount GetUniqueBlockedModulesCount + + ; From chrome_elf/third_party_dlls/hook.cc + DisableHook + GetApplyHookResult
diff --git a/chrome_elf/chrome_elf_x86.def b/chrome_elf/chrome_elf_x86.def index 9145a482..f2bd11e 100644 --- a/chrome_elf/chrome_elf_x86.def +++ b/chrome_elf/chrome_elf_x86.def
@@ -38,3 +38,7 @@ RegisterLogNotification GetBlockedModulesCount GetUniqueBlockedModulesCount + + ; From chrome_elf/third_party_dlls/hook.cc + DisableHook + GetApplyHookResult
diff --git a/chrome_elf/third_party_dlls/hook.cc b/chrome_elf/third_party_dlls/hook.cc index 68db6ab2..43a2fdcc 100644 --- a/chrome_elf/third_party_dlls/hook.cc +++ b/chrome_elf/third_party_dlls/hook.cc
@@ -4,6 +4,7 @@ #include "chrome_elf/third_party_dlls/hook.h" +#include <atomic> #include <limits> #include <memory> @@ -18,6 +19,7 @@ #include "chrome_elf/third_party_dlls/main.h" #include "chrome_elf/third_party_dlls/packed_list_file.h" #include "chrome_elf/third_party_dlls/packed_list_format.h" +#include "chrome_elf/third_party_dlls/public_api.h" #include "sandbox/win/src/interception_internal.h" #include "sandbox/win/src/internal_types.h" #include "sandbox/win/src/nt_internals.h" @@ -49,6 +51,12 @@ // Set if and when ApplyHook() has been successfully executed. bool g_hook_active = false; +// Indicates if the hook was disabled after the hook was activated. +std::atomic<bool> g_hook_disabled(false); + +// Set to a different NTSTATUS if an error occured while applying the hook. +std::atomic<int32_t> g_apply_hook_result(STATUS_SUCCESS); + // Set up NTDLL function pointers. bool InitImports() { HMODULE ntdll = ::GetModuleHandleW(sandbox::kNtdllName); @@ -267,6 +275,9 @@ commit_size, offset, view_size, inherit, allocation_type, protect); + if (g_hook_disabled.load(std::memory_order_relaxed)) + return ret; + // If there was an OS-level failure, if the mapping target is NOT this // process, or if the section is not a (valid) Portable Executable, // we're not interested. Return the OS-level result code. @@ -454,8 +465,12 @@ thunk_storage, sizeof(sandbox::ThunkData), nullptr); #endif // defined(_WIN64) - if (!NT_SUCCESS(ntstatus)) + if (!NT_SUCCESS(ntstatus)) { + // Remember the status code. + g_apply_hook_result.store(ntstatus, std::memory_order_relaxed); + return ThirdPartyStatus::kHookApplyFailure; + } // Mark the thunk storage (original system service) as executable and prevent // any future writes to it. @@ -485,3 +500,13 @@ } } // namespace third_party_dlls + +using namespace third_party_dlls; + +void DisableHook() { + g_hook_disabled.store(true, std::memory_order_relaxed); +} + +int32_t GetApplyHookResult() { + return g_apply_hook_result.load(std::memory_order_relaxed); +}
diff --git a/chrome_elf/third_party_dlls/logs.h b/chrome_elf/third_party_dlls/logs.h index 48bb657..f6e2704 100644 --- a/chrome_elf/third_party_dlls/logs.h +++ b/chrome_elf/third_party_dlls/logs.h
@@ -11,7 +11,7 @@ #include <string> -#include "chrome_elf/third_party_dlls/logging_api.h" +#include "chrome_elf/third_party_dlls/public_api.h" #include "chrome_elf/third_party_dlls/status_codes.h" namespace third_party_dlls {
diff --git a/chrome_elf/third_party_dlls/logs_unittest.cc b/chrome_elf/third_party_dlls/logs_unittest.cc index 3aea400..23ddfd0 100644 --- a/chrome_elf/third_party_dlls/logs_unittest.cc +++ b/chrome_elf/third_party_dlls/logs_unittest.cc
@@ -14,7 +14,7 @@ #include "base/synchronization/waitable_event.h" #include "base/time/time.h" #include "chrome_elf/sha1/sha1.h" -#include "chrome_elf/third_party_dlls/logging_api.h" +#include "chrome_elf/third_party_dlls/public_api.h" #include "testing/gtest/include/gtest/gtest.h" namespace third_party_dlls {
diff --git a/chrome_elf/third_party_dlls/main_unittest_exe.cc b/chrome_elf/third_party_dlls/main_unittest_exe.cc index f2acb80..e33ac26 100644 --- a/chrome_elf/third_party_dlls/main_unittest_exe.cc +++ b/chrome_elf/third_party_dlls/main_unittest_exe.cc
@@ -17,9 +17,9 @@ #include "chrome/install_static/install_util.h" #include "chrome/install_static/product_install_details.h" #include "chrome_elf/nt_registry/nt_registry.h" -#include "chrome_elf/third_party_dlls/logging_api.h" #include "chrome_elf/third_party_dlls/main.h" #include "chrome_elf/third_party_dlls/packed_list_file.h" +#include "chrome_elf/third_party_dlls/public_api.h" using namespace third_party_dlls::main_unittest_exe;
diff --git a/chrome_elf/third_party_dlls/logging_api.cc b/chrome_elf/third_party_dlls/public_api.cc similarity index 91% rename from chrome_elf/third_party_dlls/logging_api.cc rename to chrome_elf/third_party_dlls/public_api.cc index 107bca6a..8a912b4 100644 --- a/chrome_elf/third_party_dlls/logging_api.cc +++ b/chrome_elf/third_party_dlls/public_api.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_elf/third_party_dlls/logging_api.h" +#include "chrome_elf/third_party_dlls/public_api.h" #include <stddef.h>
diff --git a/chrome_elf/third_party_dlls/logging_api.h b/chrome_elf/third_party_dlls/public_api.h similarity index 85% rename from chrome_elf/third_party_dlls/logging_api.h rename to chrome_elf/third_party_dlls/public_api.h index 3a1778b..9f770fd 100644 --- a/chrome_elf/third_party_dlls/logging_api.h +++ b/chrome_elf/third_party_dlls/public_api.h
@@ -6,9 +6,10 @@ // 1. The packed-data format used to pass information from chrome.dll // to chrome_elf.dll across restarts. // 2. The APIs exported by chrome_elf.dll to share logs of module load attempts. +// 3. The API used to disable the NtMapViewOfSection hook. -#ifndef CHROME_ELF_THIRD_PARTY_DLLS_LOGGING_API_H_ -#define CHROME_ELF_THIRD_PARTY_DLLS_LOGGING_API_H_ +#ifndef CHROME_ELF_THIRD_PARTY_DLLS_PUBLIC_API_H_ +#define CHROME_ELF_THIRD_PARTY_DLLS_PUBLIC_API_H_ #include <windows.h> @@ -89,4 +90,12 @@ // Returns the number of unique modules that have been blocked. extern "C" uint32_t GetUniqueBlockedModulesCount(); -#endif // CHROME_ELF_THIRD_PARTY_DLLS_LOGGING_API_H_ +// Disables the hook for NtMapViewOfSection. This function does not remove the +// hook but merely makes the hook forward the call to the original function. +extern "C" void DisableHook(); + +// Returns STATUS_SUCCESS if the hook was applied successfully, or the error +// code on failure. +extern "C" int32_t GetApplyHookResult(); + +#endif // CHROME_ELF_THIRD_PARTY_DLLS_PUBLIC_API_H_
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index cff59d3..f5bed4cc 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -1129,6 +1129,7 @@ potential_match_encountered = true; } else if (current_element.AutofillSection() != original_element_section && + !matching_element.IsNull() && matching_element.AutofillSection() != original_element_section) { // The so far matching fields are equally bad. Continue the search if @@ -1137,6 +1138,7 @@ matching_element.Reset(); } else if (current_element.AutofillSection() == original_element_section && + !matching_element.IsNull() && matching_element.AutofillSection() == original_element_section) { // If two or more fields have the matching name and section, we can't
diff --git a/components/autofill_assistant/browser/actions/prompt_action.cc b/components/autofill_assistant/browser/actions/prompt_action.cc index 5d6e955..3b96fe08 100644 --- a/components/autofill_assistant/browser/actions/prompt_action.cc +++ b/components/autofill_assistant/browser/actions/prompt_action.cc
@@ -35,6 +35,7 @@ choices.emplace_back(); auto& choice = choices.back(); choice.name = choice_proto.name(); + choice.highlight = choice_proto.highlight(); choice_proto.SerializeToString(&choice.server_payload); } delegate->Choose(choices, base::BindOnce(&PromptAction::OnSuggestionChosen,
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index b5f7cc6..7f177bd 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -449,13 +449,14 @@ // One of these protos must is transmitted as-is back to the server as part of // ProcessedActionProto. message Choice { - oneof type { - // A localized text message to display. - string name = 2; + // Localized text message to display. Not required if element_exists is set. + optional string name = 2; - // Auto-select if the given element exist. - ElementReferenceProto element_exists = 4; - } + // If set, the choice should be highlighted. Ignored unless name is set. + optional bool highlight = 3; + + // Optionally auto-select this choice if the given element exist. + optional ElementReferenceProto element_exists = 4; // Server payload originally sent by the server. This should // be transmitted as-is by the client without interpreting.
diff --git a/components/autofill_assistant/browser/ui_controller.h b/components/autofill_assistant/browser/ui_controller.h index f699834..6ceeaa20 100644 --- a/components/autofill_assistant/browser/ui_controller.h +++ b/components/autofill_assistant/browser/ui_controller.h
@@ -27,6 +27,9 @@ // Localized string to display. std::string name; + // If true, highlight this choice in the UI. + bool highlight = false; + // Opaque data to send back to the callback. Not necessarily a UTF8 string. std::string server_payload; };
diff --git a/components/guest_view/renderer/guest_view_container.cc b/components/guest_view/renderer/guest_view_container.cc index 4fcc45c..2f3f776e 100644 --- a/components/guest_view/renderer/guest_view_container.cc +++ b/components/guest_view/renderer/guest_view_container.cc
@@ -181,7 +181,8 @@ v8::MicrotasksScope microtasks( destruction_isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); - callback->Call(context->Global(), 0 /* argc */, nullptr); + callback->Call(context, context->Global(), 0 /* argc */, nullptr) + .FromMaybe(v8::Local<v8::Value>()); } } @@ -269,7 +270,8 @@ v8::MicrotasksScope microtasks( element_resize_isolate_, v8::MicrotasksScope::kDoNotRunMicrotasks); - callback->Call(context->Global(), argc, argv); + callback->Call(context, context->Global(), argc, argv) + .FromMaybe(v8::Local<v8::Value>()); } base::WeakPtr<content::BrowserPluginDelegate> GuestViewContainer::GetWeakPtr() {
diff --git a/components/guest_view/renderer/guest_view_request.cc b/components/guest_view/renderer/guest_view_request.cc index 52fa874d..230fe5d0 100644 --- a/components/guest_view/renderer/guest_view_request.cc +++ b/components/guest_view/renderer/guest_view_request.cc
@@ -45,7 +45,8 @@ v8::MicrotasksScope microtasks( isolate(), v8::MicrotasksScope::kDoNotRunMicrotasks); - callback->Call(context->Global(), argc, argv.get()); + callback->Call(context, context->Global(), argc, argv.get()) + .FromMaybe(v8::Local<v8::Value>()); } GuestViewAttachRequest::GuestViewAttachRequest(
diff --git a/components/sync/PRESUBMIT.py b/components/sync/PRESUBMIT.py index 0d138565..130a337 100644 --- a/components/sync/PRESUBMIT.py +++ b/components/sync/PRESUBMIT.py
@@ -28,7 +28,9 @@ # Deprecated types: 'DEPRECATED_SUPERVISED_USERS', - 'DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS'] + 'DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS', + 'DEPRECATED_ARTICLES', + 'DEPRECATED_WIFI_CREDENTIALS'] # Root tags are used as prefixes when creating storage keys, so certain strings # are blacklisted in order to prevent prefix collision.
diff --git a/components/sync/base/data_type_histogram.h b/components/sync/base/data_type_histogram.h index 80ddcfd8..a341889 100644 --- a/components/sync/base/data_type_histogram.h +++ b/components/sync/base/data_type_histogram.h
@@ -131,7 +131,7 @@ case ::syncer::APP_LIST: \ PER_DATA_TYPE_MACRO("AppList"); \ break; \ - case ::syncer::WIFI_CREDENTIALS: \ + case ::syncer::DEPRECATED_WIFI_CREDENTIALS: \ PER_DATA_TYPE_MACRO("WifiCredentials"); \ break; \ case ::syncer::SUPERVISED_USER_WHITELISTS: \
diff --git a/components/sync/base/model_type.h b/components/sync/base/model_type.h index 9ac434e5..ba4472b 100644 --- a/components/sync/base/model_type.h +++ b/components/sync/base/model_type.h
@@ -120,7 +120,7 @@ APP_LIST, // WiFi credentials. Each item contains the information for connecting to one // WiFi network. This includes, e.g., network name and password. - WIFI_CREDENTIALS, + DEPRECATED_WIFI_CREDENTIALS, // Supervised user whitelists. Each item contains a CRX ID (like an extension // ID) and a name. SUPERVISED_USER_WHITELISTS, @@ -214,8 +214,8 @@ FAVICON_IMAGES, FAVICON_TRACKING, DEVICE_INFO, PRIORITY_PREFERENCES, SUPERVISED_USER_SETTINGS, DEPRECATED_SUPERVISED_USERS, DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, DEPRECATED_ARTICLES, APP_LIST, - WIFI_CREDENTIALS, SUPERVISED_USER_WHITELISTS, ARC_PACKAGE, PRINTERS, - READING_LIST, USER_EVENTS, NIGORI, EXPERIMENTS, MOUNTAIN_SHARES, + DEPRECATED_WIFI_CREDENTIALS, SUPERVISED_USER_WHITELISTS, ARC_PACKAGE, + PRINTERS, READING_LIST, USER_EVENTS, NIGORI, EXPERIMENTS, MOUNTAIN_SHARES, USER_CONSENTS, SEND_TAB_TO_SELF); }
diff --git a/components/sync/base/sync_prefs.cc b/components/sync/base/sync_prefs.cc index b7877201..b267351 100644 --- a/components/sync/base/sync_prefs.cc +++ b/components/sync/base/sync_prefs.cc
@@ -374,7 +374,7 @@ return prefs::kSyncArticles; case APP_LIST: return prefs::kSyncAppList; - case WIFI_CREDENTIALS: + case DEPRECATED_WIFI_CREDENTIALS: return prefs::kSyncWifiCredentials; case SUPERVISED_USER_WHITELISTS: return prefs::kSyncSupervisedUserWhitelists;
diff --git a/components/sync/driver/model_association_manager.cc b/components/sync/driver/model_association_manager.cc index 3181aee..a5bcb2fa 100644 --- a/components/sync/driver/model_association_manager.cc +++ b/components/sync/driver/model_association_manager.cc
@@ -41,9 +41,10 @@ ARC_PACKAGE, READING_LIST, THEMES, SEARCH_ENGINES, SESSIONS, APP_NOTIFICATIONS, DICTIONARY, FAVICON_IMAGES, FAVICON_TRACKING, PRINTERS, USER_CONSENTS, USER_EVENTS, SUPERVISED_USER_SETTINGS, - SUPERVISED_USER_WHITELISTS, WIFI_CREDENTIALS, DEPRECATED_SUPERVISED_USERS, - MOUNTAIN_SHARES, DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, - DEPRECATED_ARTICLES, SEND_TAB_TO_SELF}; + SUPERVISED_USER_WHITELISTS, DEPRECATED_WIFI_CREDENTIALS, + DEPRECATED_SUPERVISED_USERS, MOUNTAIN_SHARES, + DEPRECATED_SUPERVISED_USER_SHARED_SETTINGS, DEPRECATED_ARTICLES, + SEND_TAB_TO_SELF}; static_assert(arraysize(kStartOrder) == MODEL_TYPE_COUNT - FIRST_REAL_MODEL_TYPE,
diff --git a/components/sync/engine/sync_encryption_handler.cc b/components/sync/engine/sync_encryption_handler.cc index a14aec02..abb88a7 100644 --- a/components/sync/engine/sync_encryption_handler.cc +++ b/components/sync/engine/sync_encryption_handler.cc
@@ -16,7 +16,7 @@ ModelTypeSet SyncEncryptionHandler::SensitiveTypes() { ModelTypeSet types; types.Put(PASSWORDS); // Has its own encryption, but include it anyway. - types.Put(WIFI_CREDENTIALS); + types.Put(DEPRECATED_WIFI_CREDENTIALS); return types; }
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 e7fb105..7e4dc2f 100644 --- a/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc +++ b/components/sync/engine_impl/sync_encryption_handler_impl_unittest.cc
@@ -674,7 +674,8 @@ EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_EQ(ModelTypeSet(PASSWORDS, WIFI_CREDENTIALS), encrypted_types); + EXPECT_EQ(ModelTypeSet(PASSWORDS, DEPRECATED_WIFI_CREDENTIALS), + encrypted_types); { WriteTransaction trans(FROM_HERE, user_share()); @@ -707,7 +708,8 @@ EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_EQ(ModelTypeSet(PASSWORDS, WIFI_CREDENTIALS), encrypted_types); + EXPECT_EQ(ModelTypeSet(PASSWORDS, DEPRECATED_WIFI_CREDENTIALS), + encrypted_types); { WriteTransaction trans(FROM_HERE, user_share()); @@ -748,7 +750,8 @@ EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); ModelTypeSet encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_EQ(ModelTypeSet(PASSWORDS, WIFI_CREDENTIALS), encrypted_types); + EXPECT_EQ(ModelTypeSet(PASSWORDS, DEPRECATED_WIFI_CREDENTIALS), + encrypted_types); { WriteTransaction trans(FROM_HERE, user_share()); @@ -758,7 +761,7 @@ EXPECT_FALSE(encryption_handler()->IsEncryptEverythingEnabled()); encrypted_types = encryption_handler()->GetEncryptedTypesUnsafe(); - EXPECT_EQ(ModelTypeSet(BOOKMARKS, PASSWORDS, WIFI_CREDENTIALS), + EXPECT_EQ(ModelTypeSet(BOOKMARKS, PASSWORDS, DEPRECATED_WIFI_CREDENTIALS), encrypted_types); }
diff --git a/components/sync/syncable/model_type.cc b/components/sync/syncable/model_type.cc index 96b374b2..191c4ae 100644 --- a/components/sync/syncable/model_type.cc +++ b/components/sync/syncable/model_type.cc
@@ -129,7 +129,7 @@ "Deprecated Articles", sync_pb::EntitySpecifics::kArticleFieldNumber, 28}, {APP_LIST, "APP_LIST", "app_list", "App List", sync_pb::EntitySpecifics::kAppListFieldNumber, 29}, - {WIFI_CREDENTIALS, "WIFI_CREDENTIAL", "wifi_credentials", + {DEPRECATED_WIFI_CREDENTIALS, "WIFI_CREDENTIAL", "wifi_credentials", "WiFi Credentials", sync_pb::EntitySpecifics::kWifiCredentialFieldNumber, 32}, {SUPERVISED_USER_WHITELISTS, "MANAGED_USER_WHITELIST", @@ -263,7 +263,7 @@ case APP_LIST: specifics->mutable_app_list(); break; - case WIFI_CREDENTIALS: + case DEPRECATED_WIFI_CREDENTIALS: specifics->mutable_wifi_credential(); break; case SUPERVISED_USER_WHITELISTS: @@ -416,7 +416,7 @@ if (specifics.has_app_list()) return APP_LIST; if (specifics.has_wifi_credential()) - return WIFI_CREDENTIALS; + return DEPRECATED_WIFI_CREDENTIALS; if (specifics.has_managed_user_whitelist()) return SUPERVISED_USER_WHITELISTS; if (specifics.has_arc_package())
diff --git a/components/sync/user_events/user_event_sync_bridge.cc b/components/sync/user_events/user_event_sync_bridge.cc index 9a53a14..924ab0c 100644 --- a/components/sync/user_events/user_event_sync_bridge.cc +++ b/components/sync/user_events/user_event_sync_bridge.cc
@@ -77,10 +77,7 @@ weak_ptr_factory_.GetWeakPtr())); } -UserEventSyncBridge::~UserEventSyncBridge() { - if (!deferred_user_events_while_initializing_.empty()) - LOG(ERROR) << "Non-empty event queue at shutdown!"; -} +UserEventSyncBridge::~UserEventSyncBridge() = default; std::unique_ptr<MetadataChangeList> UserEventSyncBridge::CreateMetadataChangeList() { @@ -93,7 +90,6 @@ DCHECK(entity_data.empty()); DCHECK(change_processor()->IsTrackingMetadata()); DCHECK(!change_processor()->TrackedAccountId().empty()); - ReadAllDataAndResubmit(); return ApplySyncChanges(std::move(metadata_change_list), std::move(entity_data)); } @@ -151,104 +147,21 @@ ModelTypeSyncBridge::StopSyncResponse UserEventSyncBridge::ApplyStopSyncChanges( std::unique_ptr<MetadataChangeList> delete_metadata_change_list) { - // Sync can only be stopped after initialization. - DCHECK(deferred_user_events_while_initializing_.empty()); - if (delete_metadata_change_list) { - // Delete everything except user consents. With DICE the signout may happen - // frequently. It is important to report all user consents, thus, they are - // persisted for some time even after signout. - store_->ReadAllData( - base::BindOnce(&UserEventSyncBridge::OnReadAllDataToDelete, - weak_ptr_factory_.GetWeakPtr(), - std::move(delete_metadata_change_list))); + store_->DeleteAllDataAndMetadata(base::BindOnce( + &UserEventSyncBridge::OnCommit, weak_ptr_factory_.GetWeakPtr())); } return StopSyncResponse::kModelStillReadyToSync; } -void UserEventSyncBridge::OnReadAllDataToDelete( - std::unique_ptr<MetadataChangeList> delete_metadata_change_list, - const base::Optional<ModelError>& error, - std::unique_ptr<RecordList> data_records) { - if (error) { - LOG(WARNING) << "OnReadAllDataToDelete received a model error: " - << error->ToString(); - return; - } - - std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch(); - // We delete all the metadata (even for consents), because it may become - // invalid when the sync is reenabled. This may lead to the same consent - // being reported multiple times, which is allowed. - batch->TakeMetadataChangesFrom(std::move(delete_metadata_change_list)); - - UserEventSpecifics specifics; - for (const Record& r : *data_records) { - if (!specifics.ParseFromString(r.value) || - specifics.event_case() != UserEventSpecifics::EventCase::kUserConsent) { - batch->DeleteData(r.id); - } - } - - store_->CommitWriteBatch(std::move(batch), - base::BindOnce(&UserEventSyncBridge::OnCommit, - weak_ptr_factory_.GetWeakPtr())); -} - -void UserEventSyncBridge::ReadAllDataAndResubmit() { - DCHECK(change_processor()->IsTrackingMetadata()); - DCHECK(store_); - store_->ReadAllData( - base::BindOnce(&UserEventSyncBridge::OnReadAllDataToResubmit, - weak_ptr_factory_.GetWeakPtr())); -} - -void UserEventSyncBridge::OnReadAllDataToResubmit( - const base::Optional<ModelError>& error, - std::unique_ptr<RecordList> data_records) { - if (change_processor()->TrackedAccountId().empty()) { - // Meanwhile the sync has been disabled. We will try next time. - return; - } - DCHECK(change_processor()->IsTrackingMetadata()); - - if (error) { - change_processor()->ReportError(*error); - return; - } - - std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch(); - - for (const Record& r : *data_records) { - auto specifics = std::make_unique<UserEventSpecifics>(); - if (specifics->ParseFromString(r.value) && - specifics->event_case() == - UserEventSpecifics::EventCase::kUserConsent && - specifics->user_consent().account_id() == - change_processor()->TrackedAccountId()) { - change_processor()->Put(r.id, MoveToEntityData(std::move(specifics)), - batch->GetMetadataChangeList()); - } - } - - store_->CommitWriteBatch(std::move(batch), - base::BindOnce(&UserEventSyncBridge::OnCommit, - weak_ptr_factory_.GetWeakPtr())); -} - void UserEventSyncBridge::RecordUserEvent( std::unique_ptr<UserEventSpecifics> specifics) { - // TODO(vitaliii): Sanity-check specifics->user_consent().account_id() against - // change_processor()->TrackedAccountId(), maybe DCHECK. - DCHECK(!specifics->has_user_consent() || - !specifics->user_consent().account_id().empty()); + DCHECK(!specifics->has_user_consent()); if (store_) { RecordUserEventImpl(std::move(specifics)); return; } - if (specifics->has_user_consent()) - deferred_user_events_while_initializing_.push_back(std::move(specifics)); } // static @@ -265,8 +178,7 @@ std::unique_ptr<UserEventSpecifics> specifics) { DCHECK(store_); - if (specifics->event_case() != UserEventSpecifics::EventCase::kUserConsent && - !change_processor()->IsTrackingMetadata()) { + if (!change_processor()->IsTrackingMetadata()) { return; } @@ -291,29 +203,15 @@ std::unique_ptr<WriteBatch> batch = store_->CreateWriteBatch(); batch->WriteData(storage_key, specifics->SerializeAsString()); - // For consents, only Put() if account ID matches, and unconditionally for - // other event types. - if (specifics->event_case() != UserEventSpecifics::EventCase::kUserConsent || - specifics->user_consent().account_id() == - change_processor()->TrackedAccountId()) { - DCHECK(change_processor()->IsTrackingMetadata()); - change_processor()->Put(storage_key, MoveToEntityData(std::move(specifics)), - batch->GetMetadataChangeList()); - } + DCHECK(change_processor()->IsTrackingMetadata()); + change_processor()->Put(storage_key, MoveToEntityData(std::move(specifics)), + batch->GetMetadataChangeList()); store_->CommitWriteBatch(std::move(batch), base::BindOnce(&UserEventSyncBridge::OnCommit, weak_ptr_factory_.GetWeakPtr())); } -void UserEventSyncBridge::ProcessQueuedEvents() { - for (std::unique_ptr<sync_pb::UserEventSpecifics>& event : - deferred_user_events_while_initializing_) { - RecordUserEventImpl(std::move(event)); - } - deferred_user_events_while_initializing_.clear(); -} - void UserEventSyncBridge::OnStoreCreated( const base::Optional<ModelError>& error, std::unique_ptr<ModelTypeStore> store) { @@ -334,10 +232,6 @@ change_processor()->ReportError(*error); } else { change_processor()->ModelReadyToSync(std::move(metadata_batch)); - if (!change_processor()->TrackedAccountId().empty()) { - ReadAllDataAndResubmit(); - } - ProcessQueuedEvents(); } }
diff --git a/components/sync/user_events/user_event_sync_bridge.h b/components/sync/user_events/user_event_sync_bridge.h index dfe36f8..2979732a 100644 --- a/components/sync/user_events/user_event_sync_bridge.h +++ b/components/sync/user_events/user_event_sync_bridge.h
@@ -54,8 +54,6 @@ private: void RecordUserEventImpl( std::unique_ptr<sync_pb::UserEventSpecifics> specifics); - // Record events in the deferred queue and clear the queue. - void ProcessQueuedEvents(); void OnStoreCreated(const base::Optional<ModelError>& error, std::unique_ptr<ModelTypeStore> store); @@ -69,18 +67,6 @@ void OnReadAllData(DataCallback callback, const base::Optional<ModelError>& error, std::unique_ptr<ModelTypeStore::RecordList> data_records); - void OnReadAllDataToDelete( - std::unique_ptr<MetadataChangeList> delete_metadata_change_list, - const base::Optional<ModelError>& error, - std::unique_ptr<ModelTypeStore::RecordList> data_records); - - // Resubmit all the events persisted in the store to sync events, which were - // preserved when sync was disabled. This may resubmit entities that the - // processor already knows about (i.e. with metadata), but it is allowed. - void ReadAllDataAndResubmit(); - void OnReadAllDataToResubmit( - const base::Optional<ModelError>& error, - std::unique_ptr<ModelTypeStore::RecordList> data_records); void HandleGlobalIdChange(int64_t old_global_id, int64_t new_global_id); @@ -88,11 +74,6 @@ // delete upon commit confirmation. std::unique_ptr<ModelTypeStore> store_; - // Used to store important events while the store or change processor are not - // ready. This currently only handles user consents. - std::vector<std::unique_ptr<sync_pb::UserEventSpecifics>> - deferred_user_events_while_initializing_; - // The key is the global_id of the navigation the event is linked to. std::multimap<int64_t, sync_pb::UserEventSpecifics> in_flight_nav_linked_events_;
diff --git a/components/sync/user_events/user_event_sync_bridge_unittest.cc b/components/sync/user_events/user_event_sync_bridge_unittest.cc index d62db5d..eb6aa52 100644 --- a/components/sync/user_events/user_event_sync_bridge_unittest.cc +++ b/components/sync/user_events/user_event_sync_bridge_unittest.cc
@@ -225,27 +225,6 @@ EXPECT_THAT(GetAllData(), IsEmpty()); } -TEST_F(UserEventSyncBridgeTest, ApplyStopSyncChangesShouldKeepConsents) { - WaitUntilModelReadyToSync("account_id"); - UserEventSpecifics user_event_specifics(CreateSpecifics(2u, 2u, 2u)); - auto* consent = user_event_specifics.mutable_user_consent(); - consent->set_feature(UserEventSpecifics::UserConsent::CHROME_SYNC); - consent->set_account_id("account_id"); - bridge()->RecordUserEvent( - std::make_unique<UserEventSpecifics>(user_event_specifics)); - ASSERT_THAT(GetAllData(), SizeIs(1)); - - EXPECT_THAT( - bridge()->ApplyStopSyncChanges(WriteBatch::CreateMetadataChangeList()), - Eq(ModelTypeSyncBridge::StopSyncResponse::kModelStillReadyToSync)); - // The bridge may asynchronously query the store to choose what to delete. - base::RunLoop().RunUntilIdle(); - - // User consent specific must be persisted when sync is disabled. - EXPECT_THAT(GetAllData(), - ElementsAre(Pair(_, MatchesUserEvent(user_event_specifics)))); -} - TEST_F(UserEventSyncBridgeTest, MultipleRecords) { WaitUntilModelReadyToSync(); std::set<std::string> unique_storage_keys; @@ -380,155 +359,6 @@ EXPECT_THAT(GetAllData(), IsEmpty()); } -// User consents should be buffered if the bridge is not fully initialized. -// Other events should get dropped. -TEST_F(UserEventSyncBridgeTest, RecordWithLateInitializedStore) { - UserEventSpecifics consent1 = CreateSpecifics(1u, 1u, 1u); - consent1.mutable_user_consent()->set_account_id("account_id"); - UserEventSpecifics consent2 = CreateSpecifics(2u, 2u, 2u); - consent2.mutable_user_consent()->set_account_id("account_id"); - UserEventSpecifics specifics1 = CreateSpecifics(3u, 3u, 3u); - UserEventSpecifics specifics2 = CreateSpecifics(4u, 4u, 4u); - - bridge()->RecordUserEvent(std::make_unique<UserEventSpecifics>(consent1)); - bridge()->RecordUserEvent(std::make_unique<UserEventSpecifics>(specifics1)); - - // Initialize the store. - EXPECT_CALL(*processor(), ModelReadyToSync(NotNull())); - WaitUntilModelReadyToSync("account_id"); - - // Record events after metadata is ready. - bridge()->RecordUserEvent(std::make_unique<UserEventSpecifics>(consent2)); - bridge()->RecordUserEvent(std::make_unique<UserEventSpecifics>(specifics2)); - - EXPECT_THAT( - GetAllData(), - UnorderedElementsAre( - Pair(GetStorageKey(consent1), MatchesUserEvent(consent1)), - Pair(GetStorageKey(consent2), MatchesUserEvent(consent2)), - Pair(GetStorageKey(specifics2), MatchesUserEvent(specifics2)))); -} - -TEST_F(UserEventSyncBridgeTest, - ShouldReportPreviouslyPersistedConsentsWhenSyncIsReenabled) { - WaitUntilModelReadyToSync("account_id"); - - UserEventSpecifics consent = CreateSpecifics(1u, 1u, 1u); - consent.mutable_user_consent()->set_account_id("account_id"); - - bridge()->RecordUserEvent(std::make_unique<UserEventSpecifics>(consent)); - - // User disables sync, however, the consent hasn't been submitted yet. It is - // preserved to be submitted when sync is re-enabled. - EXPECT_THAT( - bridge()->ApplyStopSyncChanges(WriteBatch::CreateMetadataChangeList()), - Eq(ModelTypeSyncBridge::StopSyncResponse::kModelStillReadyToSync)); - // The bridge may asynchronously query the store to choose what to delete. - base::RunLoop().RunUntilIdle(); - - ASSERT_THAT(GetAllData(), SizeIs(1)); - - // Reenable sync. - EXPECT_CALL(*processor(), Put(GetStorageKey(consent), _, _)); - ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true)); - ON_CALL(*processor(), TrackedAccountId()).WillByDefault(Return("account_id")); - bridge()->MergeSyncData(WriteBatch::CreateMetadataChangeList(), - EntityChangeList()); - - // The bridge may asynchronously query the store to choose what to resubmit. - base::RunLoop().RunUntilIdle(); -} - -TEST_F(UserEventSyncBridgeTest, - ShouldReportPersistedConsentsOnStartupWithSyncAlreadyEnabled) { - // Persist a consent while sync is enabled. - WaitUntilModelReadyToSync("account_id"); - UserEventSpecifics consent = CreateSpecifics(1u, 1u, 1u); - consent.mutable_user_consent()->set_account_id("account_id"); - bridge()->RecordUserEvent(std::make_unique<UserEventSpecifics>(consent)); - base::RunLoop().RunUntilIdle(); - ASSERT_THAT(GetAllData(), SizeIs(1)); - - // Restart the bridge, mimic-ing a browser restart. - EXPECT_CALL(*processor(), Put(GetStorageKey(consent), _, _)); - ResetBridge(); - - // The bridge may asynchronously query the store to choose what to resubmit. - base::RunLoop().RunUntilIdle(); -} - -TEST_F(UserEventSyncBridgeTest, ShouldReportPersistedConsentsOnSyncEnabled) { - // Persist a consent before sync is enabled. - WaitUntilModelReadyToSync(/*account=id=*/""); - UserEventSpecifics consent = CreateSpecifics(1u, 1u, 1u); - consent.mutable_user_consent()->set_account_id("account_id"); - bridge()->RecordUserEvent(std::make_unique<UserEventSpecifics>(consent)); - base::RunLoop().RunUntilIdle(); - ASSERT_THAT(GetAllData(), SizeIs(1)); - - // Restart the bridge, mimic-ing a browser restart. We expect no Put() - // until sync is enabled. - EXPECT_CALL(*processor(), Put(_, _, _)).Times(0); - ResetBridge(); - WaitUntilModelReadyToSync(/*account_id=*/""); - - // Enable sync. - EXPECT_CALL(*processor(), Put(GetStorageKey(consent), _, _)); - ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true)); - ON_CALL(*processor(), TrackedAccountId()).WillByDefault(Return("account_id")); - bridge()->MergeSyncData(WriteBatch::CreateMetadataChangeList(), - EntityChangeList()); - - // The bridge may asynchronously query the store to choose what to resubmit. - base::RunLoop().RunUntilIdle(); -} - -TEST_F(UserEventSyncBridgeTest, ShouldSubmitPersistedConsentOnlyIfSameAccount) { - WaitUntilModelReadyToSync("first_account"); - UserEventSpecifics user_event_specifics(CreateSpecifics(2u, 2u, 2u)); - auto* consent = user_event_specifics.mutable_user_consent(); - consent->set_account_id("first_account"); - bridge()->RecordUserEvent( - std::make_unique<UserEventSpecifics>(user_event_specifics)); - ASSERT_THAT(GetAllData(), SizeIs(1)); - - EXPECT_THAT( - bridge()->ApplyStopSyncChanges(WriteBatch::CreateMetadataChangeList()), - Eq(ModelTypeSyncBridge::StopSyncResponse::kModelStillReadyToSync)); - // The bridge may asynchronously query the store to choose what to delete. - base::RunLoop().RunUntilIdle(); - - ASSERT_THAT(GetAllData(), - ElementsAre(Pair(_, MatchesUserEvent(user_event_specifics)))); - - // A new user signs in and enables sync. - // The previous account consent should not be resubmited, because the new sync - // account is different. - EXPECT_CALL(*processor(), Put(_, _, _)).Times(0); - ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true)); - ON_CALL(*processor(), TrackedAccountId()) - .WillByDefault(Return("second_account")); - bridge()->MergeSyncData(WriteBatch::CreateMetadataChangeList(), - EntityChangeList()); - base::RunLoop().RunUntilIdle(); - - EXPECT_THAT( - bridge()->ApplyStopSyncChanges(WriteBatch::CreateMetadataChangeList()), - Eq(ModelTypeSyncBridge::StopSyncResponse::kModelStillReadyToSync)); - base::RunLoop().RunUntilIdle(); - - // The previous user signs in again and enables sync. - EXPECT_CALL(*processor(), Put(GetStorageKey(user_event_specifics), _, _)); - ON_CALL(*processor(), IsTrackingMetadata()).WillByDefault(Return(true)); - ON_CALL(*processor(), TrackedAccountId()) - .WillByDefault(Return("first_account")); - bridge()->MergeSyncData(WriteBatch::CreateMetadataChangeList(), - EntityChangeList()); - - // The bridge may asynchronously query the store to choose what to resubmit. - base::RunLoop().RunUntilIdle(); -} - } // namespace } // namespace syncer
diff --git a/components/viz/service/display_embedder/skia_output_surface_impl.cc b/components/viz/service/display_embedder/skia_output_surface_impl.cc index 8eeecd0..8dbfb843 100644 --- a/components/viz/service/display_embedder/skia_output_surface_impl.cc +++ b/components/viz/service/display_embedder/skia_output_surface_impl.cc
@@ -264,20 +264,20 @@ bool has_alpha, bool use_stencil) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + if (initialize_waitable_event_) { + initialize_waitable_event_->Wait(); + initialize_waitable_event_ = nullptr; + } - recorder_.reset(); SkSurfaceCharacterization* characterization = nullptr; - base::Optional<base::WaitableEvent> event; if (characterization_.isValid()) { characterization_ = characterization_.createResized(size.width(), size.height()); } else { characterization = &characterization_; - // TODO(penghuang): avoid blocking compositor thread. - // We don't have a valid surface characterization, so we have to wait - // until reshape is finished on Gpu thread. - event.emplace(base::WaitableEvent::ResetPolicy::MANUAL, - base::WaitableEvent::InitialState::NOT_SIGNALED); + initialize_waitable_event_ = std::make_unique<base::WaitableEvent>( + base::WaitableEvent::ResetPolicy::MANUAL, + base::WaitableEvent::InitialState::NOT_SIGNALED); } auto sequence_id = gpu_service_->skia_output_surface_sequence_id(); @@ -287,13 +287,9 @@ base::BindOnce(&SkiaOutputSurfaceImplOnGpu::Reshape, base::Unretained(impl_on_gpu_.get()), size, device_scale_factor, color_space, has_alpha, use_stencil, - characterization, base::OptionalOrNullptr(event)); + characterization, initialize_waitable_event_.get()); gpu_service_->scheduler()->ScheduleTask(gpu::Scheduler::Task( sequence_id, std::move(callback), std::vector<gpu::SyncToken>())); - - if (event) - event->Wait(); - RecreateRecorder(); } void SkiaOutputSurfaceImpl::SwapBuffers(OutputSurfaceFrame frame) { @@ -350,9 +346,17 @@ SkCanvas* SkiaOutputSurfaceImpl::BeginPaintCurrentFrame() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(recorder_); + // Make sure there is no unsubmitted PaintFrame or PaintRenderPass. + DCHECK(!recorder_); DCHECK_EQ(current_render_pass_id_, 0u); + if (initialize_waitable_event_) { + initialize_waitable_event_->Wait(); + initialize_waitable_event_ = nullptr; + } + + DCHECK(characterization_.isValid()); + recorder_.emplace(characterization_); return recorder_->getCanvas(); } @@ -370,7 +374,7 @@ *metadata.backend_format.getGLTarget()); } else { #if BUILDFLAG(ENABLE_VULKAN) - metadata.backend_format = GrBackendFormat::MakeVk( + metadata.driver_backend_format = GrBackendFormat::MakeVk( gfx::SkColorTypeToVkFormat(metadata.color_type)); #else NOTREACHED(); @@ -394,6 +398,7 @@ DCHECK(recorder_); DCHECK((has_alpha && (metadatas.size() == 3 || metadatas.size() == 4)) || (!has_alpha && (metadatas.size() == 2 || metadatas.size() == 3))); + return YUVAPromiseTextureHelper::MakeYUVAPromiseSkImage( this, &recorder_.value(), yuv_color_space, std::move(metadatas), has_alpha); @@ -402,7 +407,6 @@ void SkiaOutputSurfaceImpl::SkiaSwapBuffers(OutputSurfaceFrame frame) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(!recorder_); - RecreateRecorder(); auto sequence_id = gpu_service_->skia_output_surface_sequence_id(); // impl_on_gpu_ is released on the GPU thread by a posted task from // SkiaOutputSurfaceImpl::dtor. So it is safe to use base::Unretained. @@ -419,8 +423,9 @@ ResourceFormat format, bool mipmap) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(!current_render_pass_id_); - DCHECK(!offscreen_surface_recorder_); + // Make sure there is no unsubmitted PaintFrame or PaintRenderPass. + DCHECK(!recorder_); + DCHECK_EQ(current_render_pass_id_, 0u); DCHECK(resource_sync_tokens_.empty()); current_render_pass_id_ = id; @@ -458,27 +463,26 @@ kCacheMaxResourceBytes, image_info, backend_format, msaa_sample_count, kTopLeft_GrSurfaceOrigin, surface_props, mipmap); DCHECK(characterization.isValid()); - offscreen_surface_recorder_.emplace(characterization); - return offscreen_surface_recorder_->getCanvas(); + recorder_.emplace(characterization); + return recorder_->getCanvas(); } gpu::SyncToken SkiaOutputSurfaceImpl::SubmitPaint() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + DCHECK(recorder_); + // If current_render_pass_id_ is not 0, we are painting a render pass. // Otherwise we are painting a frame. bool painting_render_pass = current_render_pass_id_ != 0; - auto& current_recorder = - painting_render_pass ? offscreen_surface_recorder_ : recorder_; - DCHECK(current_recorder); gpu::SyncToken sync_token(gpu::CommandBufferNamespace::VIZ_OUTPUT_SURFACE, impl_on_gpu_->command_buffer_id(), ++sync_fence_release_); sync_token.SetVerifyFlush(); - auto ddl = current_recorder->detach(); + auto ddl = recorder_->detach(); DCHECK(ddl); - current_recorder.reset(); + recorder_.reset(); auto sequence_id = gpu_service_->skia_output_surface_sequence_id(); // impl_on_gpu_ is released on the GPU thread by a posted task from // SkiaOutputSurfaceImpl::dtor. So it is safe to use base::Unretained. @@ -588,15 +592,6 @@ capabilities_ = impl_on_gpu_->capabilities(); } -void SkiaOutputSurfaceImpl::RecreateRecorder() { - DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - DCHECK(characterization_.isValid()); - recorder_.emplace(characterization_); - // TODO(penghuang): remove the unnecessary getCanvas() call, when the - // recorder crash is fixed in skia. - recorder_->getCanvas(); -} - void SkiaOutputSurfaceImpl::DidSwapBuffersComplete( gpu::SwapBuffersCompleteParams params, const gfx::Size& pixel_size) {
diff --git a/components/viz/service/display_embedder/skia_output_surface_impl.h b/components/viz/service/display_embedder/skia_output_surface_impl.h index e645ce7..26a7d6b 100644 --- a/components/viz/service/display_embedder/skia_output_surface_impl.h +++ b/components/viz/service/display_embedder/skia_output_surface_impl.h
@@ -100,7 +100,6 @@ class PromiseTextureHelper; class YUVAPromiseTextureHelper; void InitializeOnGpuThread(base::WaitableEvent* event); - void RecreateRecorder(); void DidSwapBuffersComplete(gpu::SwapBuffersCompleteParams params, const gfx::Size& pixel_size); void BufferPresented(const gfx::PresentationFeedback& feedback); @@ -112,17 +111,13 @@ SyntheticBeginFrameSource* const synthetic_begin_frame_source_; OutputSurfaceClient* client_ = nullptr; + std::unique_ptr<base::WaitableEvent> initialize_waitable_event_; SkSurfaceCharacterization characterization_; base::Optional<SkDeferredDisplayListRecorder> recorder_; // The current render pass id set by BeginPaintRenderPass. RenderPassId current_render_pass_id_ = 0; - // The SkDDL recorder created by BeginPaintRenderPass, and - // FinishPaintRenderPass will turn it into a SkDDL and play the SkDDL back on - // the GPU thread. - base::Optional<SkDeferredDisplayListRecorder> offscreen_surface_recorder_; - // Sync tokens for resources which are used for the current frame. std::vector<gpu::SyncToken> resource_sync_tokens_;
diff --git a/content/renderer/media_recorder/media_recorder_handler.cc b/content/renderer/media_recorder/media_recorder_handler.cc index e7d1c721..b6b1fb0 100644 --- a/content/renderer/media_recorder/media_recorder_handler.cc +++ b/content/renderer/media_recorder/media_recorder_handler.cc
@@ -37,7 +37,7 @@ namespace content { -using blink::WebMediaCapabilitiesQueryCallbacks; +using blink::WebMediaCapabilitiesEncodingInfoCallbacks; namespace { @@ -113,7 +113,7 @@ } void OnEncodingInfoError( - std::unique_ptr<WebMediaCapabilitiesQueryCallbacks> callbacks) { + std::unique_ptr<WebMediaCapabilitiesEncodingInfoCallbacks> callbacks) { callbacks->OnError(); } @@ -347,7 +347,8 @@ void MediaRecorderHandler::EncodingInfo( const blink::WebMediaConfiguration& configuration, - std::unique_ptr<blink::WebMediaCapabilitiesQueryCallbacks> callbacks) { + std::unique_ptr<blink::WebMediaCapabilitiesEncodingInfoCallbacks> + callbacks) { DCHECK(main_render_thread_checker_.CalledOnValidThread()); DCHECK(configuration.video_configuration || configuration.audio_configuration);
diff --git a/content/renderer/media_recorder/media_recorder_handler.h b/content/renderer/media_recorder/media_recorder_handler.h index 59381c54..29377153 100644 --- a/content/renderer/media_recorder/media_recorder_handler.h +++ b/content/renderer/media_recorder/media_recorder_handler.h
@@ -66,7 +66,8 @@ void Resume() override; void EncodingInfo( const blink::WebMediaConfiguration& configuration, - std::unique_ptr<blink::WebMediaCapabilitiesQueryCallbacks> cb) override; + std::unique_ptr<blink::WebMediaCapabilitiesEncodingInfoCallbacks> cb) + override; blink::WebString ActualMimeType() override; private:
diff --git a/content/renderer/pepper/message_channel.cc b/content/renderer/pepper/message_channel.cc index 738d860..963e509 100644 --- a/content/renderer/pepper/message_channel.cc +++ b/content/renderer/pepper/message_channel.cc
@@ -80,11 +80,13 @@ v8::Persistent<v8::Object>* result) { MessageChannel* message_channel = new MessageChannel(instance); v8::HandleScope handle_scope(instance->GetIsolate()); - v8::Context::Scope context_scope(instance->GetMainWorldContext()); + v8::Local<v8::Context> context = instance->GetMainWorldContext(); + v8::Context::Scope context_scope(context); gin::Handle<MessageChannel> handle = gin::CreateHandle(instance->GetIsolate(), message_channel); + v8::MaybeLocal<v8::Object> object = handle.ToV8()->ToObject(context); result->Reset(instance->GetIsolate(), - handle.ToV8()->ToObject(instance->GetIsolate())); + object.FromMaybe(v8::Local<v8::Object>())); return message_channel; }
diff --git a/ios/chrome/browser/autofill/OWNERS b/ios/chrome/browser/autofill/OWNERS index adccd5d..bfcd0ca 100644 --- a/ios/chrome/browser/autofill/OWNERS +++ b/ios/chrome/browser/autofill/OWNERS
@@ -1,4 +1,5 @@ mahmadi@chromium.org +olivierrobin@chromium.org # TEAM: ios-directory-owners@chromium.org # OS: iOS
diff --git a/ios/chrome/browser/ui/autofill/OWNERS b/ios/chrome/browser/ui/autofill/OWNERS index adccd5d..bfcd0ca 100644 --- a/ios/chrome/browser/ui/autofill/OWNERS +++ b/ios/chrome/browser/ui/autofill/OWNERS
@@ -1,4 +1,5 @@ mahmadi@chromium.org +olivierrobin@chromium.org # TEAM: ios-directory-owners@chromium.org # OS: iOS
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/BUILD.gn b/ios/chrome/browser/ui/autofill/manual_fill/BUILD.gn index 1a9df35..3ae6acd5 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/BUILD.gn +++ b/ios/chrome/browser/ui/autofill/manual_fill/BUILD.gn
@@ -88,6 +88,8 @@ "manual_fill_address_cell.mm", "manual_fill_card_cell.h", "manual_fill_card_cell.mm", + "manual_fill_cell_button.h", + "manual_fill_cell_button.mm", "manual_fill_cell_utils.h", "manual_fill_cell_utils.mm", "manual_fill_content_delegate.h",
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address_cell.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address_cell.mm index a8cec29c..491fa20 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address_cell.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address_cell.mm
@@ -48,18 +48,12 @@ namespace { // Left and right margins of the cell content. -static const CGFloat sideMargins = 16; - -// Margin left and right of multiple buttons on same line. -static const CGFloat InnerMarginWidth = 16.0; +static const CGFloat SideMargins = 16; } // namespace @interface ManualFillAddressCell () -// The separator gray line. -@property(nonatomic, strong) UIView* grayLine; - // The label with the line1 -- line2. @property(nonatomic, strong) UILabel* addressLabel; @@ -158,6 +152,7 @@ self.delegate = delegate; NSMutableArray<UIView*>* verticalLeadViews = [[NSMutableArray alloc] init]; + UIView* guide = self.contentView; // Top label, summary of line 1 and 2. NSMutableAttributedString* attributedString = @@ -232,8 +227,8 @@ self.lastNameButton.hidden = YES; } - self.nameLineConstraints = HorizontalConstraintsForViewsOnGuideWithShift( - nameLineViews, self.grayLine, -InnerMarginWidth); + self.nameLineConstraints = + HorizontalConstraintsForViewsOnGuideWithShift(nameLineViews, guide, 0); if (nameLineViews.count) { [verticalLeadViews addObject:nameLineViews.firstObject]; @@ -283,8 +278,8 @@ self.cityButton.hidden = YES; } - self.zipCityLineConstraints = HorizontalConstraintsForViewsOnGuideWithShift( - zipCityLineViews, self.grayLine, -InnerMarginWidth); + self.zipCityLineConstraints = + HorizontalConstraintsForViewsOnGuideWithShift(zipCityLineViews, guide, 0); if (zipCityLineViews.count) { [verticalLeadViews addObject:zipCityLineViews.firstObject]; } @@ -317,8 +312,8 @@ } self.stateCountryLineConstraints = - HorizontalConstraintsForViewsOnGuideWithShift( - stateCountryLineViews, self.grayLine, -InnerMarginWidth); + HorizontalConstraintsForViewsOnGuideWithShift(stateCountryLineViews, + guide, 0); if (stateCountryLineViews.count) { [verticalLeadViews addObject:stateCountryLineViews.firstObject]; } @@ -333,21 +328,21 @@ - (void)createViewHierarchy { self.selectionStyle = UITableViewCellSelectionStyleNone; - self.grayLine = [[UIView alloc] init]; - self.grayLine.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1]; - self.grayLine.translatesAutoresizingMaskIntoConstraints = NO; - [self.contentView addSubview:self.grayLine]; + UIView* grayLine = [[UIView alloc] init]; + grayLine.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1]; + grayLine.translatesAutoresizingMaskIntoConstraints = NO; + [self.contentView addSubview:grayLine]; + + UIView* guide = self.contentView; self.addressLabel = CreateLabel(); [self.contentView addSubview:self.addressLabel]; - HorizontalConstraintsForViewsOnGuideWithShift(@[ self.addressLabel ], - self.grayLine, 0); + HorizontalConstraintsForViewsOnGuideWithShift(@[ self.addressLabel ], guide, + SideMargins); self.firstNameButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.firstNameButton]; - HorizontalConstraintsMarginForButtonWithWidth(self.firstNameButton, - InnerMarginWidth); self.middleNameSeparatorLabel = CreateLabel(); self.middleNameSeparatorLabel.text = @"·"; @@ -356,8 +351,6 @@ self.middleNameButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.middleNameButton]; - HorizontalConstraintsMarginForButtonWithWidth(self.middleNameButton, - InnerMarginWidth); self.lastNameSeparatorLabel = CreateLabel(); self.lastNameSeparatorLabel.text = @"·"; @@ -366,8 +359,6 @@ self.lastNameButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.lastNameButton]; - HorizontalConstraintsMarginForButtonWithWidth(self.lastNameButton, - InnerMarginWidth); SyncBaselinesForViewsOnView( @[ @@ -379,20 +370,18 @@ self.line1Button = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.line1Button]; - HorizontalConstraintsForViewsOnGuideWithShift(@[ self.line1Button ], - self.grayLine, 0); + HorizontalConstraintsForViewsOnGuideWithShift(@[ self.line1Button ], guide, + 0); self.line2Button = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.line2Button]; - HorizontalConstraintsForViewsOnGuideWithShift(@[ self.line2Button ], - self.grayLine, 0); + HorizontalConstraintsForViewsOnGuideWithShift(@[ self.line2Button ], guide, + 0); self.zipButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.zipButton]; - HorizontalConstraintsMarginForButtonWithWidth(self.zipButton, - InnerMarginWidth); self.citySeparatorLabel = CreateLabel(); self.citySeparatorLabel.text = @"·"; @@ -401,8 +390,6 @@ self.cityButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.cityButton]; - HorizontalConstraintsMarginForButtonWithWidth(self.cityButton, - InnerMarginWidth); SyncBaselinesForViewsOnView(@[ self.citySeparatorLabel, self.cityButton ], self.zipButton); @@ -410,8 +397,6 @@ self.stateButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.stateButton]; - HorizontalConstraintsMarginForButtonWithWidth(self.stateButton, - InnerMarginWidth); self.countrySeparatorLabel = CreateLabel(); self.countrySeparatorLabel.text = @"·"; @@ -420,8 +405,6 @@ self.countryButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapAddressInfo:), self); [self.contentView addSubview:self.countryButton]; - HorizontalConstraintsMarginForButtonWithWidth(self.countryButton, - InnerMarginWidth); SyncBaselinesForViewsOnView( @[ self.countrySeparatorLabel, self.countryButton ], self.stateButton); @@ -435,16 +418,15 @@ [NSLayoutConstraint activateConstraints:@[ // Common vertical constraints. - [self.grayLine.bottomAnchor + [grayLine.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor], - [self.grayLine.heightAnchor constraintEqualToConstant:1], + [grayLine.heightAnchor constraintEqualToConstant:1], // Horizontal constraints. - [self.grayLine.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor - constant:sideMargins], - [safeArea.trailingAnchor - constraintEqualToAnchor:self.grayLine.trailingAnchor - constant:sideMargins], + [grayLine.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor + constant:SideMargins], + [safeArea.trailingAnchor constraintEqualToAnchor:grayLine.trailingAnchor + constant:SideMargins], ]]; }
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm index ae83ee96..473dff3 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm
@@ -66,10 +66,7 @@ namespace { // Left and right margins of the cell content. -static const CGFloat sideMargins = 16; - -// Margin left and right of expiration buttons. -static const CGFloat ExpirationMarginWidth = 16.0; +static const CGFloat SideMargins = 16; } // namespace @@ -167,33 +164,31 @@ grayLine.translatesAutoresizingMaskIntoConstraints = NO; [self.contentView addSubview:grayLine]; + UIView* guide = self.contentView; + self.cardLabel = CreateLabel(); [self.contentView addSubview:self.cardLabel]; - HorizontalConstraintsForViewsOnGuideWithShift(@[ self.cardLabel ], grayLine, - 0); + HorizontalConstraintsForViewsOnGuideWithShift(@[ self.cardLabel ], guide, + SideMargins); self.cardNumberButton = CreateButtonWithSelectorAndTarget(@selector(userDidTapCardNumber:), self); [self.contentView addSubview:self.cardNumberButton]; HorizontalConstraintsForViewsOnGuideWithShift(@[ self.cardNumberButton ], - grayLine, 0); + guide, 0); self.cardholderButton = CreateButtonWithSelectorAndTarget(@selector(userDidTapCardInfo:), self); [self.contentView addSubview:self.cardholderButton]; HorizontalConstraintsForViewsOnGuideWithShift(@[ self.cardholderButton ], - grayLine, 0); + guide, 0); // Expiration line. self.expirationMonthButton = CreateButtonWithSelectorAndTarget(@selector(userDidTapCardInfo:), self); - HorizontalConstraintsMarginForButtonWithWidth(self.expirationMonthButton, - ExpirationMarginWidth); [self.contentView addSubview:self.expirationMonthButton]; self.expirationYearButton = CreateButtonWithSelectorAndTarget(@selector(userDidTapCardInfo:), self); - HorizontalConstraintsMarginForButtonWithWidth(self.expirationYearButton, - ExpirationMarginWidth); [self.contentView addSubview:self.expirationYearButton]; UILabel* expirationSeparatorLabel = CreateLabel(); expirationSeparatorLabel.text = @"/"; @@ -206,7 +201,7 @@ self.expirationMonthButton, expirationSeparatorLabel, self.expirationYearButton ], - grayLine, -ExpirationMarginWidth); + guide, 0); VerticalConstraintsSpacingForViewsInContainer( @[ @@ -225,9 +220,9 @@ // Horizontal constraints. [grayLine.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor - constant:sideMargins], + constant:SideMargins], [safeArea.trailingAnchor constraintEqualToAnchor:grayLine.trailingAnchor - constant:sideMargins], + constant:SideMargins], ]]; }
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.h b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.h new file mode 100644 index 0000000..05554d4 --- /dev/null +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.h
@@ -0,0 +1,14 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_UI_AUTOFILL_MANUAL_FILL_MANUAL_FILL_CELL_BUTTON_H_ +#define IOS_CHROME_BROWSER_UI_AUTOFILL_MANUAL_FILL_MANUAL_FILL_CELL_BUTTON_H_ + +#import <UIKit/UIKit.h> + +// Buttons with a darker background in highlighted state. +@interface ManualFillCellButton : UIButton +@end + +#endif // IOS_CHROME_BROWSER_UI_AUTOFILL_MANUAL_FILL_MANUAL_FILL_CELL_BUTTON_H_
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.mm new file mode 100644 index 0000000..29346d9 --- /dev/null +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.mm
@@ -0,0 +1,28 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.h" + +#import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +@implementation ManualFillCellButton + +- (void)setHighlighted:(BOOL)highlighted { + [super setHighlighted:highlighted]; + auto animations = ^{ + CGFloat alpha = highlighted ? 0.07 : 0; + self.backgroundColor = [UIColor colorWithWhite:0 alpha:alpha]; + }; + [UIView animateWithDuration:0.1 + delay:0 + options:UIViewAnimationOptionBeginFromCurrentState + animations:animations + completion:nil]; +} + +@end
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h index b015634..9cb64e2 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h
@@ -11,11 +11,6 @@ // |target|. UIButton* CreateButtonWithSelectorAndTarget(SEL action, id target); -// Creates horizontal constraints for given |button| based on given |width| on -// both sides. -void HorizontalConstraintsMarginForButtonWithWidth(UIButton* button, - CGFloat width); - // Sets vertical constraints on firstBaselineAnchor for the button or label rows // in |views| inside |container| starting at its topAnchor. Returns the applied // constrainst to allow caller to deactivate them later.
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm index 54edc47..5e984c8 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm
@@ -6,6 +6,7 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" +#import "ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_button.h" #import "ios/chrome/browser/ui/autofill/manual_fill/uicolor_manualfill.h" #import "ios/chrome/common/ui_util/constraints_ui_util.h" #include "ios/chrome/grit/ios_strings.h" @@ -26,34 +27,33 @@ // The multiplier for the base system spacing at the bottom margin. static const CGFloat BottomSystemSpacingMultiplier = 2.26; +// Top and bottom margins for buttons. +static const CGFloat ButtonVerticalMargin = 12; + +// Left and right margins of the cell content and buttons. +static const CGFloat ButtonHorizontalMargin = 16; + } // namespace UIButton* CreateButtonWithSelectorAndTarget(SEL action, id target) { - UIButton* button = [UIButton buttonWithType:UIButtonTypeSystem]; + UIButton* button = [ManualFillCellButton buttonWithType:UIButtonTypeCustom]; [button setTitleColor:UIColor.cr_manualFillTintColor forState:UIControlStateNormal]; button.translatesAutoresizingMaskIntoConstraints = NO; button.titleLabel.font = [UIFont preferredFontForTextStyle:UIFontTextStyleBody]; button.titleLabel.adjustsFontForContentSizeCategory = YES; + button.contentHorizontalAlignment = + UIControlContentHorizontalAlignmentLeading; [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; + button.contentEdgeInsets = + UIEdgeInsetsMake(ButtonVerticalMargin, ButtonHorizontalMargin, + ButtonVerticalMargin, ButtonHorizontalMargin); return button; } -void HorizontalConstraintsMarginForButtonWithWidth(UIButton* button, - CGFloat width) { - [NSLayoutConstraint activateConstraints:@[ - [button.leadingAnchor - constraintEqualToAnchor:button.titleLabel.leadingAnchor - constant:-width], - [button.trailingAnchor - constraintEqualToAnchor:button.titleLabel.trailingAnchor - constant:width], - ]]; -} - NSArray<NSLayoutConstraint*>* VerticalConstraintsSpacingForViewsInContainer( NSArray<UIView*>* views, UIView* container) { @@ -91,14 +91,27 @@ [horizontalConstraints addObject:[view.leadingAnchor constraintEqualToAnchor:previousAnchor constant:shift]]; + [view setContentCompressionResistancePriority:UILayoutPriorityDefaultLow + forAxis: + UILayoutConstraintAxisHorizontal]; + [view setContentHuggingPriority:UILayoutPriorityDefaultHigh + forAxis:UILayoutConstraintAxisHorizontal]; previousAnchor = view.trailingAnchor; shift = 0; } if (views.count > 0) { [horizontalConstraints addObject:[views.lastObject.trailingAnchor - constraintLessThanOrEqualToAnchor:guide.trailingAnchor - constant:shift]]; + constraintEqualToAnchor:guide.trailingAnchor + constant:shift]]; + // Give all remaining space to the last button, as per UX. + [views.lastObject + setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh + forAxis: + UILayoutConstraintAxisHorizontal]; + [views.lastObject + setContentHuggingPriority:UILayoutPriorityDefaultLow + forAxis:UILayoutConstraintAxisHorizontal]; } [NSLayoutConstraint activateConstraints:horizontalConstraints]; return horizontalConstraints;
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_cell.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_cell.mm index b0be573..3a4ad09 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_cell.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_password_cell.mm
@@ -50,7 +50,7 @@ namespace { // Left and right margins of the cell content. -static const CGFloat sideMargins = 16; +static const CGFloat SideMargins = 16; } // namespace @interface ManualFillPasswordCell () @@ -142,24 +142,26 @@ grayLine.translatesAutoresizingMaskIntoConstraints = NO; [self.contentView addSubview:grayLine]; + UIView* guide = self.contentView; + self.siteNameLabel = CreateLabel(); self.siteNameLabel.translatesAutoresizingMaskIntoConstraints = NO; self.siteNameLabel.adjustsFontForContentSizeCategory = YES; [self.contentView addSubview:self.siteNameLabel]; - HorizontalConstraintsForViewsOnGuideWithShift(@[ self.siteNameLabel ], - grayLine, 0); + HorizontalConstraintsForViewsOnGuideWithShift(@[ self.siteNameLabel ], guide, + SideMargins); self.usernameButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapUsernameButton:), self); [self.contentView addSubview:self.usernameButton]; - HorizontalConstraintsForViewsOnGuideWithShift(@[ self.usernameButton ], - grayLine, 0); + HorizontalConstraintsForViewsOnGuideWithShift(@[ self.usernameButton ], guide, + 0); self.passwordButton = CreateButtonWithSelectorAndTarget( @selector(userDidTapPasswordButton:), self); [self.contentView addSubview:self.passwordButton]; - HorizontalConstraintsForViewsOnGuideWithShift(@[ self.passwordButton ], - grayLine, 0); + HorizontalConstraintsForViewsOnGuideWithShift(@[ self.passwordButton ], guide, + 0); VerticalConstraintsSpacingForViewsInContainer( @[ self.siteNameLabel, self.usernameButton, self.passwordButton ], @@ -175,9 +177,9 @@ // Horizontal constraints. [grayLine.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor - constant:sideMargins], + constant:SideMargins], [safeArea.trailingAnchor constraintEqualToAnchor:grayLine.trailingAnchor - constant:sideMargins], + constant:SideMargins], ]]; }
diff --git a/media/audio/win/audio_low_latency_input_win.cc b/media/audio/win/audio_low_latency_input_win.cc index 82304fe..3079281 100644 --- a/media/audio/win/audio_low_latency_input_win.cc +++ b/media/audio/win/audio_low_latency_input_win.cc
@@ -105,7 +105,7 @@ // Set the input (capture) format to the desired output format. In most cases, // it will be used unchanged. input_format_ = output_format_; - DVLOG(1) << CoreAudioUtil::WaveFormatExToString(&input_format_); + DVLOG(1) << CoreAudioUtil::WaveFormatToString(&input_format_); // Size in bytes of each audio frame. frame_size_bytes_ = format->nBlockAlign; @@ -659,37 +659,11 @@ HRESULT WASAPIAudioInputStream::GetAudioEngineStreamFormat() { HRESULT hr = S_OK; #ifndef NDEBUG - // The GetMixFormat() method retrieves the stream format that the - // audio engine uses for its internal processing of shared-mode streams. base::win::ScopedCoMem<WAVEFORMATEX> format; hr = audio_client_->GetMixFormat(&format); if (FAILED(hr)) return hr; - - DVLOG(2) << "WAVEFORMATEX:"; - DVLOG(2) << " wFormatTags : 0x" << std::hex << format->wFormatTag; - DVLOG(2) << " nChannels : " << format->nChannels; - DVLOG(2) << " nSamplesPerSec : " << format->nSamplesPerSec; - DVLOG(2) << " nAvgBytesPerSec: " << format->nAvgBytesPerSec; - DVLOG(2) << " nBlockAlign : " << format->nBlockAlign; - DVLOG(2) << " wBitsPerSample : " << format->wBitsPerSample; - DVLOG(2) << " cbSize : " << format->cbSize; - - if (format->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { - WAVEFORMATEXTENSIBLE* format_ex = - reinterpret_cast<WAVEFORMATEXTENSIBLE*>(format.get()); - DVLOG(2) << "WAVEFORMATEXTENSIBLE:"; - DVLOG(2) << " wValidBitsPerSample: " - << format_ex->Samples.wValidBitsPerSample; - DVLOG(2) << " dwChannelMask : 0x" << std::hex - << format_ex->dwChannelMask; - if (format_ex->SubFormat == KSDATAFORMAT_SUBTYPE_PCM) - DVLOG(2) << " SubFormat : KSDATAFORMAT_SUBTYPE_PCM"; - else if (format_ex->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT) - DVLOG(2) << " SubFormat : KSDATAFORMAT_SUBTYPE_IEEE_FLOAT"; - else if (format_ex->SubFormat == KSDATAFORMAT_SUBTYPE_WAVEFORMATEX) - DVLOG(2) << " SubFormat : KSDATAFORMAT_SUBTYPE_WAVEFORMATEX"; - } + DVLOG(2) << CoreAudioUtil::WaveFormatToString(format.get()); #endif return hr; } @@ -725,18 +699,9 @@ // Otherwise, we keep the bits sample as is since we still request fixed // point PCM. In that case the closest match is typically in float format // (KSDATAFORMAT_SUBTYPE_IEEE_FLOAT). - auto format_is_pcm = [](const WAVEFORMATEX* format) { - if (format->wFormatTag == WAVE_FORMAT_PCM) - return true; - if (format->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { - const WAVEFORMATEXTENSIBLE* format_ex = - reinterpret_cast<const WAVEFORMATEXTENSIBLE*>(format); - return format_ex->SubFormat == KSDATAFORMAT_SUBTYPE_PCM; - } - return false; - }; - if (format_is_pcm(closest_match)) + if (CoreAudioUtil::WaveFormatWrapper(closest_match.get()).IsPcm()) { input_format->wBitsPerSample = closest_match->wBitsPerSample; + } input_format->nBlockAlign = (input_format->wBitsPerSample / 8) * input_format->nChannels; @@ -745,9 +710,8 @@ if (IsSupportedFormatForConversion(&input_format_)) { DVLOG(1) << "Will convert captured audio: \n" - << CoreAudioUtil::WaveFormatExToString(&input_format_) - << " ==> \n" - << CoreAudioUtil::WaveFormatExToString(&output_format_); + << CoreAudioUtil::WaveFormatToString(&input_format_) << " ==> \n" + << CoreAudioUtil::WaveFormatToString(&output_format_); SetupConverterAndStoreFormatInfo();
diff --git a/media/audio/win/core_audio_util_win.cc b/media/audio/win/core_audio_util_win.cc index 8b7030b..f09321d 100644 --- a/media/audio/win/core_audio_util_win.cc +++ b/media/audio/win/core_audio_util_win.cc
@@ -8,6 +8,7 @@ #include <functiondiscoverykeys_devpkey.h> #include <objbase.h> #include <stddef.h> +#include <bitset> #include "base/bind.h" #include "base/callback.h" @@ -184,6 +185,120 @@ } } +// Converts the most common format tags defined in mmreg.h into string +// equivalents. Mainly intended for log messages. +const char* WaveFormatTagToString(WORD format_tag) { + switch (format_tag) { + case WAVE_FORMAT_UNKNOWN: + return "WAVE_FORMAT_UNKNOWN"; + case WAVE_FORMAT_PCM: + return "WAVE_FORMAT_PCM"; + case WAVE_FORMAT_IEEE_FLOAT: + return "WAVE_FORMAT_IEEE_FLOAT"; + case WAVE_FORMAT_EXTENSIBLE: + return "WAVE_FORMAT_EXTENSIBLE"; + default: + return "UNKNOWN"; + } +} + +// Converts from channel mask to list of included channels. +// Each audio data format contains channels for one or more of the positions +// listed below. The number of channels simply equals the number of nonzero +// flag bits in the |channel_mask|. The relative positions of the channels +// within each block of audio data always follow the same relative ordering +// as the flag bits in the table below. For example, if |channel_mask| contains +// the value 0x00000033, the format defines four audio channels that are +// assigned for playback to the front-left, front-right, back-left, +// and back-right speakers, respectively. The channel data should be interleaved +// in that order within each block. +std::string ChannelMaskToString(DWORD channel_mask) { + std::string ss; + if (channel_mask & SPEAKER_FRONT_LEFT) + ss += "FRONT_LEFT | "; + if (channel_mask & SPEAKER_FRONT_RIGHT) + ss += "FRONT_RIGHT | "; + if (channel_mask & SPEAKER_FRONT_CENTER) + ss += "FRONT_CENTER | "; + if (channel_mask & SPEAKER_LOW_FREQUENCY) + ss += "LOW_FREQUENCY | "; + if (channel_mask & SPEAKER_BACK_LEFT) + ss += "BACK_LEFT | "; + if (channel_mask & SPEAKER_BACK_RIGHT) + ss += "BACK_RIGHT | "; + if (channel_mask & SPEAKER_FRONT_LEFT_OF_CENTER) + ss += "FRONT_LEFT_OF_CENTER | "; + if (channel_mask & SPEAKER_FRONT_RIGHT_OF_CENTER) + ss += "RIGHT_OF_CENTER | "; + if (channel_mask & SPEAKER_BACK_CENTER) + ss += "BACK_CENTER | "; + if (channel_mask & SPEAKER_SIDE_LEFT) + ss += "SIDE_LEFT | "; + if (channel_mask & SPEAKER_SIDE_RIGHT) + ss += "SIDE_RIGHT | "; + if (channel_mask & SPEAKER_TOP_CENTER) + ss += "TOP_CENTER | "; + if (channel_mask & SPEAKER_TOP_FRONT_LEFT) + ss += "TOP_FRONT_LEFT | "; + if (channel_mask & SPEAKER_TOP_FRONT_CENTER) + ss += "TOP_FRONT_CENTER | "; + if (channel_mask & SPEAKER_TOP_FRONT_RIGHT) + ss += "TOP_FRONT_RIGHT | "; + if (channel_mask & SPEAKER_TOP_BACK_LEFT) + ss += "TOP_BACK_LEFT | "; + if (channel_mask & SPEAKER_TOP_BACK_CENTER) + ss += "TOP_BACK_CENTER | "; + if (channel_mask & SPEAKER_TOP_BACK_RIGHT) + ss += "TOP_BACK_RIGHT | "; + + if (!ss.empty()) { + // Delete last appended " | " substring. + ss.erase(ss.end() - 3, ss.end()); + } + + std::bitset<8 * sizeof(DWORD)> mask(channel_mask); + ss += " ("; + ss += std::to_string(mask.count()); + ss += ")"; + return ss; +} + +// Converts a channel count into a channel configuration. +ChannelConfig GuessChannelConfig(WORD channels) { + switch (channels) { + case 0: + DVLOG(2) << "KSAUDIO_SPEAKER_DIRECTOUT"; + return KSAUDIO_SPEAKER_DIRECTOUT; + case 1: + DVLOG(2) << "KSAUDIO_SPEAKER_MONO"; + return KSAUDIO_SPEAKER_MONO; + case 2: + DVLOG(2) << "KSAUDIO_SPEAKER_STEREO"; + return KSAUDIO_SPEAKER_STEREO; + case 3: + DVLOG(2) << "KSAUDIO_SPEAKER_2POINT1"; + return KSAUDIO_SPEAKER_2POINT1; + case 4: + DVLOG(2) << "KSAUDIO_SPEAKER_QUAD"; + return KSAUDIO_SPEAKER_QUAD; + case 5: + DVLOG(2) << "KSAUDIO_SPEAKER_5POINT0"; + return KSAUDIO_SPEAKER_5POINT0; + case 6: + DVLOG(2) << "KSAUDIO_SPEAKER_5POINT1"; + return KSAUDIO_SPEAKER_5POINT1; + case 7: + DVLOG(2) << "KSAUDIO_SPEAKER_7POINT0"; + return KSAUDIO_SPEAKER_7POINT0; + case 8: + DVLOG(2) << "KSAUDIO_SPEAKER_7POINT1"; + return KSAUDIO_SPEAKER_7POINT1; + default: + DVLOG(1) << "Unsupported channel count: " << channels; + } + return KSAUDIO_SPEAKER_STEREO; +} + bool IAudioClient3IsSupported() { return CoreAudioUtil::GetIAudioClientVersion() >= 3; } @@ -249,7 +364,15 @@ return device_enumerator; } -ChannelLayout GetChannelLayout(const WAVEFORMATPCMEX& mix_format) { +ChannelLayout GetChannelLayout( + const CoreAudioUtil::WaveFormatWrapper mix_format) { + if (!mix_format.IsExtensible()) { + DVLOG(1) << "Format does not contain any channel mask." + << " Guessing layout by channel count: " << std::dec + << mix_format->nChannels; + return GuessChannelLayout(mix_format->nChannels); + } + // Get the integer mask which corresponds to the channel layout the // audio engine uses for its internal processing/mixing of shared-mode // streams. This mask indicates which channels are present in the multi- @@ -259,7 +382,7 @@ // See // http://msdn.microsoft.com/en-us/library/windows/hardware/ff537083.aspx // for more details. - ChannelConfig channel_config = mix_format.dwChannelMask; + ChannelConfig channel_config = mix_format.GetExtensible()->dwChannelMask; // Convert Microsoft's channel configuration to generic ChannelLayout. ChannelLayout channel_layout = ChannelConfigToChannelLayout(channel_config); @@ -269,8 +392,8 @@ if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { DVLOG(1) << "Unsupported channel config: " << std::hex << channel_config << ". Guessing layout by channel count: " << std::dec - << mix_format.Format.nChannels; - channel_layout = GuessChannelLayout(mix_format.Format.nChannels); + << mix_format->nChannels; + channel_layout = GuessChannelLayout(mix_format->nChannels); } DVLOG(1) << "channel layout: " << ChannelLayoutToString(channel_layout); @@ -391,14 +514,12 @@ bool is_output_device, AudioParameters* params, const UMALogCallback& uma_log_cb) { - WAVEFORMATPCMEX mix_format; + WAVEFORMATEXTENSIBLE mix_format; HRESULT hr = CoreAudioUtil::GetSharedModeMixFormat(client, &mix_format); uma_log_cb.Run(UmaLogStep::GET_MIX_FORMAT, hr); if (FAILED(hr)) return hr; - - // Preferred sample rate. - const int sample_rate = mix_format.Format.nSamplesPerSec; + CoreAudioUtil::WaveFormatWrapper format(&mix_format); int min_frames_per_buffer = 0; int max_frames_per_buffer = 0; @@ -418,8 +539,8 @@ UINT32 min_period_frames = 0; UINT32 max_period_frames = 0; hr = audio_client_3->GetSharedModeEnginePeriod( - &(mix_format.Format), &default_period_frames, - &fundamental_period_frames, &min_period_frames, &max_period_frames); + format.get(), &default_period_frames, &fundamental_period_frames, + &min_period_frames, &max_period_frames); uma_log_cb.Run(UmaLogStep::GET_SHARED_MODE_ENGINE_PERIOD, hr); if (SUCCEEDED(hr)) { @@ -432,6 +553,9 @@ } } + // Preferred sample rate. + const int sample_rate = format->nSamplesPerSec; + // If we don't have access to IAudioClient3 or if the call to // GetSharedModeEnginePeriod() fails we fall back to GetDevicePeriod(). if (!supports_iac3 || FAILED(hr)) { @@ -452,7 +576,7 @@ DVLOG(1) << "IAudioClient => frames_per_buffer: " << frames_per_buffer; } - ChannelLayout channel_layout = GetChannelLayout(mix_format); + ChannelLayout channel_layout = GetChannelLayout(format); AudioParameters audio_params( AudioParameters::AUDIO_PCM_LOW_LATENCY, channel_layout, sample_rate, frames_per_buffer, @@ -479,27 +603,57 @@ } // namespace +// CoreAudioUtil::WaveFormatWrapper implementation. +WAVEFORMATEXTENSIBLE* CoreAudioUtil::WaveFormatWrapper::GetExtensible() const { + CHECK(IsExtensible()); + return reinterpret_cast<WAVEFORMATEXTENSIBLE*>(ptr_); +} + +bool CoreAudioUtil::WaveFormatWrapper::IsExtensible() const { + return ptr_->wFormatTag == WAVE_FORMAT_EXTENSIBLE && ptr_->cbSize >= 22; +} + +bool CoreAudioUtil::WaveFormatWrapper::IsPcm() const { + return IsExtensible() ? GetExtensible()->SubFormat == KSDATAFORMAT_SUBTYPE_PCM + : ptr_->wFormatTag == WAVE_FORMAT_PCM; +} + +bool CoreAudioUtil::WaveFormatWrapper::IsFloat() const { + return IsExtensible() + ? GetExtensible()->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT + : ptr_->wFormatTag == WAVE_FORMAT_IEEE_FLOAT; +} + +size_t CoreAudioUtil::WaveFormatWrapper::size() const { + return sizeof(*ptr_) + ptr_->cbSize; +} + bool CoreAudioUtil::IsSupported() { static bool g_is_supported = IsSupportedInternal(); return g_is_supported; } -std::string CoreAudioUtil::WaveFormatExToString( - const WAVEFORMATEXTENSIBLE* format) { - DCHECK_EQ(format->Format.wFormatTag, WAVE_FORMAT_EXTENSIBLE); - DCHECK_GE(format->Format.cbSize, 22); +// CoreAudioUtil implementation. +std::string CoreAudioUtil::WaveFormatToString(const WaveFormatWrapper format) { + // Start with the WAVEFORMATEX part. std::string wave_format = base::StringPrintf( - "wFormatTag: WAVE_FORMAT_EXTENSIBLE, nChannels: %d, nSamplesPerSec: %lu" - ", nAvgBytesPerSec: %lu, nBlockAlign: %d, wBitsPerSample: %d, cbSize: %d" - ", wValidBitsPerSample: %d, dwChannelMask: 0x%lX", - format->Format.nChannels, format->Format.nSamplesPerSec, - format->Format.nAvgBytesPerSec, format->Format.nBlockAlign, - format->Format.wBitsPerSample, format->Format.cbSize, - format->Samples.wValidBitsPerSample, format->dwChannelMask); - if (format->SubFormat == KSDATAFORMAT_SUBTYPE_PCM) { + "wFormatTag: %s (0x%X), nChannels: %d, nSamplesPerSec: %lu" + ", nAvgBytesPerSec: %lu, nBlockAlign: %d, wBitsPerSample: %d, cbSize: %d", + WaveFormatTagToString(format->wFormatTag), format->wFormatTag, + format->nChannels, format->nSamplesPerSec, format->nAvgBytesPerSec, + format->nBlockAlign, format->wBitsPerSample, format->cbSize); + if (!format.IsExtensible()) + return wave_format; + + // Append the WAVEFORMATEXTENSIBLE part (which we know exists). + base::StringAppendF( + &wave_format, " [+] wValidBitsPerSample: %d, dwChannelMask: %s", + format.GetExtensible()->Samples.wValidBitsPerSample, + ChannelMaskToString(format.GetExtensible()->dwChannelMask).c_str()); + if (format.IsPcm()) { base::StringAppendF(&wave_format, "%s", ", SubFormat: KSDATAFORMAT_SUBTYPE_PCM"); - } else if (format->SubFormat == KSDATAFORMAT_SUBTYPE_IEEE_FLOAT) { + } else if (format.IsFloat()) { base::StringAppendF(&wave_format, "%s", ", SubFormat: KSDATAFORMAT_SUBTYPE_IEEE_FLOAT"); } else { @@ -756,39 +910,67 @@ base::BindRepeating(&LogUMAEmptyCb)); } -HRESULT CoreAudioUtil::GetSharedModeMixFormat( - IAudioClient* client, WAVEFORMATPCMEX* format) { - ScopedCoMem<WAVEFORMATPCMEX> format_pcmex; - HRESULT hr = client->GetMixFormat( - reinterpret_cast<WAVEFORMATEX**>(&format_pcmex)); +HRESULT CoreAudioUtil::GetSharedModeMixFormat(IAudioClient* client, + WAVEFORMATEXTENSIBLE* format) { + // The GetMixFormat method retrieves the stream format that the audio engine + // uses for its internal processing of shared-mode streams. The method + // allocates the storage for the structure and this memory will be released + // when |mix_format| goes out of scope. The GetMixFormat method retrieves a + // format descriptor that is in the form of a WAVEFORMATEXTENSIBLE structure + // instead of a standalone WAVEFORMATEX structure. The method outputs a + // pointer to the WAVEFORMATEX structure that is embedded at the start of + // this WAVEFORMATEXTENSIBLE structure. + // Note that, crbug/803056 indicates that some devices can return a format + // where only the WAVEFORMATEX parts is initialized and we must be able to + // account for that. + ScopedCoMem<WAVEFORMATEXTENSIBLE> mix_format; + HRESULT hr = + client->GetMixFormat(reinterpret_cast<WAVEFORMATEX**>(&mix_format)); if (FAILED(hr)) return hr; - size_t bytes = sizeof(WAVEFORMATEX) + format_pcmex->Format.cbSize; - DCHECK_EQ(bytes, sizeof(WAVEFORMATPCMEX)) - << "Format tag: 0x" << std::hex << format_pcmex->Format.wFormatTag; + // Use a wave format wrapper to make things simpler. + WaveFormatWrapper wrapped_format(mix_format.get()); - memcpy(format, format_pcmex, bytes); - DVLOG(2) << CoreAudioUtil::WaveFormatExToString(format); + // Verify that the reported format can be mixed by the audio engine in + // shared mode. + if (!wrapped_format.IsPcm() && !wrapped_format.IsFloat()) { + DLOG(ERROR) + << "Only pure PCM or float audio streams can be mixed in shared mode"; + return AUDCLNT_E_UNSUPPORTED_FORMAT; + } + // Log a warning for the rare case where |mix_format| only contains a + // stand-alone WAVEFORMATEX structure but don't return. + if (!wrapped_format.IsExtensible()) { + DLOG(WARNING) << "The returned format contains no extended information. " + "The size is " + << wrapped_format.size() << " bytes."; + } + + // Copy the correct number of bytes into |*format| taking into account if + // the returned structure is correctly extended or not. + CHECK_LE(wrapped_format.size(), sizeof(WAVEFORMATEXTENSIBLE)) + << "Format tag: 0x" << std::hex << wrapped_format->wFormatTag; + memcpy(format, wrapped_format.get(), wrapped_format.size()); + DVLOG(2) << CoreAudioUtil::WaveFormatToString(format); return hr; } bool CoreAudioUtil::IsFormatSupported(IAudioClient* client, AUDCLNT_SHAREMODE share_mode, - const WAVEFORMATPCMEX* format) { - ScopedCoMem<WAVEFORMATEXTENSIBLE> closest_match; - HRESULT hr = client->IsFormatSupported( - share_mode, reinterpret_cast<const WAVEFORMATEX*>(format), - reinterpret_cast<WAVEFORMATEX**>(&closest_match)); + const WaveFormatWrapper format) { + ScopedCoMem<WAVEFORMATEX> closest_match; + HRESULT hr = client->IsFormatSupported(share_mode, format, &closest_match); // This log can only be triggered for shared mode. DLOG_IF(ERROR, hr == S_FALSE) << "Format is not supported " << "but a closest match exists."; // This log can be triggered both for shared and exclusive modes. DLOG_IF(ERROR, hr == AUDCLNT_E_UNSUPPORTED_FORMAT) << "Unsupported format."; + DVLOG(2) << CoreAudioUtil::WaveFormatToString(format); if (hr == S_FALSE) { - DVLOG(2) << CoreAudioUtil::WaveFormatExToString(closest_match); + DVLOG(2) << CoreAudioUtil::WaveFormatToString(closest_match.get()); } return (hr == S_OK); @@ -803,31 +985,34 @@ if (!client.Get()) return false; - WAVEFORMATPCMEX format; - HRESULT hr = GetSharedModeMixFormat(client.Get(), &format); + WAVEFORMATEXTENSIBLE mix_format; + HRESULT hr = GetSharedModeMixFormat(client.Get(), &mix_format); if (FAILED(hr)) return false; // Next, check if it is possible to use an alternative format where the // channel layout (and possibly number of channels) is modified. - // Convert generic channel layout into Windows-specific channel configuration. - ChannelConfig new_config = ChannelLayoutToChannelConfig(channel_layout); - if (new_config == KSAUDIO_SPEAKER_UNSUPPORTED) { - return false; + // Convert generic channel layout into Windows-specific channel configuration + // but only if the wave format is extended (can contain a channel mask). + WaveFormatWrapper format(&mix_format); + if (format.IsExtensible()) { + ChannelConfig new_config = ChannelLayoutToChannelConfig(channel_layout); + if (new_config == KSAUDIO_SPEAKER_UNSUPPORTED) { + return false; + } + format.GetExtensible()->dwChannelMask = new_config; } - format.dwChannelMask = new_config; // Modify the format if the new channel layout has changed the number of // utilized channels. const int channels = ChannelLayoutToChannelCount(channel_layout); - if (channels != format.Format.nChannels) { - format.Format.nChannels = channels; - format.Format.nBlockAlign = (format.Format.wBitsPerSample / 8) * channels; - format.Format.nAvgBytesPerSec = format.Format.nSamplesPerSec * - format.Format.nBlockAlign; + if (channels != format->nChannels) { + format->nChannels = channels; + format->nBlockAlign = (format->wBitsPerSample / 8) * channels; + format->nAvgBytesPerSec = format->nSamplesPerSec * format->nBlockAlign; } - DVLOG(2) << CoreAudioUtil::WaveFormatExToString(&format); + DVLOG(2) << CoreAudioUtil::WaveFormatToString(format); // Some devices can initialize a shared-mode stream with a format that is // not identical to the mix format obtained from the GetMixFormat() method. @@ -838,7 +1023,7 @@ // for the audio device includes a local effects (LFX) audio processing // object (APO) that can handle format conversions. return CoreAudioUtil::IsFormatSupported(client.Get(), - AUDCLNT_SHAREMODE_SHARED, &format); + AUDCLNT_SHAREMODE_SHARED, format); } HRESULT CoreAudioUtil::GetDevicePeriod(IAudioClient* client, @@ -851,8 +1036,8 @@ if (FAILED(hr)) return hr; - *device_period = (share_mode == AUDCLNT_SHAREMODE_SHARED) ? default_period : - minimum_period; + *device_period = (share_mode == AUDCLNT_SHAREMODE_SHARED) ? default_period + : minimum_period; DVLOG(2) << "device_period: " << ReferenceTimeToTimeDelta(*device_period).InMillisecondsF() << " [ms]"; @@ -900,15 +1085,25 @@ EDataFlow data_flow) { ComPtr<IAudioClient> client(CreateClient(device_id, data_flow, eConsole)); - WAVEFORMATPCMEX format = {}; - if (!client.Get() || FAILED(GetSharedModeMixFormat(client.Get(), &format))) + WAVEFORMATEXTENSIBLE mix_format; + if (!client.Get() || + FAILED(GetSharedModeMixFormat(client.Get(), &mix_format))) return 0; + WaveFormatWrapper format(&mix_format); + if (!format.IsExtensible()) { + // A format descriptor from WAVEFORMATEX only supports mono and stereo. + DCHECK_LE(format->nChannels, 2); + DVLOG(1) << "Format does not contain any channel mask." + << " Guessing layout by channel count: " << std::dec + << format->nChannels; + return GuessChannelConfig(format->nChannels); + } - return static_cast<ChannelConfig>(format.dwChannelMask); + return static_cast<ChannelConfig>(format.GetExtensible()->dwChannelMask); } HRESULT CoreAudioUtil::SharedModeInitialize(IAudioClient* client, - const WAVEFORMATPCMEX* format, + const WaveFormatWrapper format, HANDLE event_handle, uint32_t requested_buffer_size, uint32_t* endpoint_buffer_size, @@ -923,9 +1118,10 @@ // After the stream starts, the audio engine will signal the event handle // to notify the client each time a buffer becomes ready to process. // Event-driven buffering is supported for both rendering and capturing. - // Both shared-mode and exclusive-mode streams can use event-driven buffering. - bool use_event = (event_handle != NULL && - event_handle != INVALID_HANDLE_VALUE); + // Both shared-mode and exclusive-mode streams can use event-driven + // buffering. + bool use_event = + (event_handle != NULL && event_handle != INVALID_HANDLE_VALUE); if (use_event) stream_flags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK; DVLOG(2) << "stream_flags: 0x" << std::hex << stream_flags; @@ -946,7 +1142,7 @@ } // Initialize a low-latency client using IAudioClient3. hr = audio_client_3->InitializeSharedAudioStream( - stream_flags, requested_buffer_size, &(format->Format), session_guid); + stream_flags, requested_buffer_size, format, session_guid); if (FAILED(hr)) { DVLOG(1) << "IAudioClient3::InitializeSharedAudioStream: " << std::hex << hr; @@ -955,7 +1151,7 @@ } else { // Initialize the shared mode client for minimal delay. hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED, stream_flags, 0, 0, - &(format->Format), session_guid); + format, session_guid); if (FAILED(hr)) { DVLOG(1) << "IAudioClient::Initialize: " << std::hex << hr; return hr; @@ -981,7 +1177,7 @@ DVLOG(2) << "endpoint buffer size: " << buffer_size_in_frames; // TODO(henrika): utilize when delay measurements are added. - REFERENCE_TIME latency = 0; + REFERENCE_TIME latency = 0; hr = client->GetStreamLatency(&latency); DVLOG(2) << "stream latency: " << ReferenceTimeToTimeDelta(latency).InMillisecondsF() << " [ms]";
diff --git a/media/audio/win/core_audio_util_win.h b/media/audio/win/core_audio_util_win.h index 06ea22c..61ed472 100644 --- a/media/audio/win/core_audio_util_win.h +++ b/media/audio/win/core_audio_util_win.h
@@ -33,6 +33,32 @@ class MEDIA_EXPORT CoreAudioUtil { public: + // Helper class which automates casting between WAVEFORMATEX and + // WAVEFORMATEXTENSIBLE raw pointers using implicit constructors and + // operator overloading. Note that, no memory is allocated by this utility + // structure. It only serves as a handle (or a wrapper) of the structure + // provided to it at construction. + class MEDIA_EXPORT WaveFormatWrapper { + public: + WaveFormatWrapper(WAVEFORMATEXTENSIBLE* p) + : ptr_(reinterpret_cast<WAVEFORMATEX*>(p)) {} + WaveFormatWrapper(WAVEFORMATEX* p) : ptr_(p) {} + ~WaveFormatWrapper() = default; + + operator WAVEFORMATEX*() const { return ptr_; } + WAVEFORMATEX* operator->() const { return ptr_; } + WAVEFORMATEX* get() const { return ptr_; } + WAVEFORMATEXTENSIBLE* GetExtensible() const; + + bool IsExtensible() const; + bool IsPcm() const; + bool IsFloat() const; + size_t size() const; + + private: + WAVEFORMATEX* ptr_; + }; + // Returns true if Windows Core Audio is supported. // Always verify that this method returns true before using any of the // methods in this class. @@ -40,7 +66,9 @@ // it is safe to call from other threads. static bool IsSupported(); - static std::string WaveFormatExToString(const WAVEFORMATEXTENSIBLE* format); + // Prints/logs all fields of the format structure in |format|. + // Also supports extended versions (WAVEFORMATEXTENSIBLE). + static std::string WaveFormatToString(WaveFormatWrapper format); // Converts between reference time to base::TimeDelta. // One reference-time unit is 100 nanoseconds. @@ -126,16 +154,20 @@ // Get the mix format that the audio engine uses internally for processing // of shared-mode streams. This format is not necessarily a format that the - // audio endpoint device supports. Thus, the caller might not succeed in - // creating an exclusive-mode stream with a format obtained by this method. + // audio endpoint device supports. The WAVEFORMATEXTENSIBLE structure can + // specify both the mapping of channels to speakers and the number of bits of + // precision in each sample. The first member of the WAVEFORMATEXTENSIBLE + // structure is a WAVEFORMATEX structure and its wFormatTag will be set to + // WAVE_FORMAT_EXTENSIBLE if the output structure is extended. + // FormatIsExtensible() can be used to determine if that is the case or not. static HRESULT GetSharedModeMixFormat(IAudioClient* client, - WAVEFORMATPCMEX* format); + WAVEFORMATEXTENSIBLE* format); // Returns true if the specified |client| supports the format in |format| // for the given |share_mode| (shared or exclusive). static bool IsFormatSupported(IAudioClient* client, AUDCLNT_SHAREMODE share_mode, - const WAVEFORMATPCMEX* format); + WaveFormatWrapper format); // Returns true if the specified |channel_layout| is supported for the // default IMMDevice where flow direction and role is define by |data_flow| @@ -190,7 +222,7 @@ // audio session if NULL is passed for |session_guid|, otherwise the client // will be associated with the specified session. static HRESULT SharedModeInitialize(IAudioClient* client, - const WAVEFORMATPCMEX* format, + WaveFormatWrapper format, HANDLE event_handle, uint32_t requested_buffer_size, uint32_t* endpoint_buffer_size,
diff --git a/media/audio/win/core_audio_util_win_unittest.cc b/media/audio/win/core_audio_util_win_unittest.cc index 37614a3..dffdc64 100644 --- a/media/audio/win/core_audio_util_win_unittest.cc +++ b/media/audio/win/core_audio_util_win_unittest.cc
@@ -44,6 +44,68 @@ ScopedCOMInitializer com_init_; }; +TEST_F(CoreAudioUtilWinTest, WaveFormatWrapper) { + // Use default constructor for WAVEFORMATEX and verify its size. + WAVEFORMATEX format = {}; + CoreAudioUtil::WaveFormatWrapper wave_format(&format); + EXPECT_FALSE(wave_format.IsExtensible()); + EXPECT_EQ(wave_format.size(), sizeof(WAVEFORMATEX)); + EXPECT_EQ(wave_format->cbSize, 0); + + // Ensure that the stand-alone WAVEFORMATEX structure has a valid format tag + // and that all accessors work. + format.wFormatTag = WAVE_FORMAT_PCM; + EXPECT_FALSE(wave_format.IsExtensible()); + EXPECT_EQ(wave_format.size(), sizeof(WAVEFORMATEX)); + EXPECT_EQ(wave_format.get()->wFormatTag, WAVE_FORMAT_PCM); + EXPECT_EQ(wave_format->wFormatTag, WAVE_FORMAT_PCM); + + // Next, ensure that the size is valid. Stand-alone is not extended. + EXPECT_EQ(wave_format.size(), sizeof(WAVEFORMATEX)); + + // Verify format types for the stand-alone version. + EXPECT_TRUE(wave_format.IsPcm()); + EXPECT_FALSE(wave_format.IsFloat()); + format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; + EXPECT_TRUE(wave_format.IsFloat()); +} + +TEST_F(CoreAudioUtilWinTest, WaveFormatWrapperExtended) { + // Use default constructor for WAVEFORMATEXTENSIBLE and verify that it + // results in same size as for WAVEFORMATEX even if the size of |format_ex| + // equals the size of WAVEFORMATEXTENSIBLE. + WAVEFORMATEXTENSIBLE format_ex = {}; + CoreAudioUtil::WaveFormatWrapper wave_format_ex(&format_ex); + EXPECT_FALSE(wave_format_ex.IsExtensible()); + EXPECT_EQ(wave_format_ex.size(), sizeof(WAVEFORMATEX)); + EXPECT_EQ(wave_format_ex->cbSize, 0); + + // Ensure that the extended structure has a valid format tag and that all + // accessors work. + format_ex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + EXPECT_FALSE(wave_format_ex.IsExtensible()); + EXPECT_EQ(wave_format_ex.size(), sizeof(WAVEFORMATEX)); + EXPECT_EQ(wave_format_ex->wFormatTag, WAVE_FORMAT_EXTENSIBLE); + EXPECT_EQ(wave_format_ex.get()->wFormatTag, WAVE_FORMAT_EXTENSIBLE); + + // Next, ensure that the size is valid (sum of stand-alone and extended). + // Now the structure qualifies as extended. + format_ex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); + EXPECT_TRUE(wave_format_ex.IsExtensible()); + EXPECT_EQ(wave_format_ex.size(), sizeof(WAVEFORMATEXTENSIBLE)); + EXPECT_TRUE(wave_format_ex.GetExtensible()); + EXPECT_EQ(wave_format_ex.GetExtensible()->Format.wFormatTag, + WAVE_FORMAT_EXTENSIBLE); + + // Verify format types for the extended version. + EXPECT_FALSE(wave_format_ex.IsPcm()); + format_ex.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + EXPECT_TRUE(wave_format_ex.IsPcm()); + EXPECT_FALSE(wave_format_ex.IsFloat()); + format_ex.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + EXPECT_TRUE(wave_format_ex.IsFloat()); +} + TEST_F(CoreAudioUtilWinTest, GetIAudioClientVersion) { uint32_t client_version = CoreAudioUtil::GetIAudioClientVersion(); EXPECT_GE(client_version, 1u); @@ -245,15 +307,21 @@ AudioDeviceDescription::kDefaultDeviceId, eRender, eConsole); EXPECT_TRUE(client.Get()); - // Perform a simple sanity test of the aquired format structure. - WAVEFORMATPCMEX format; + // Perform a simple sanity test of the acquired format structure. + WAVEFORMATEXTENSIBLE format; EXPECT_TRUE( SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format))); - EXPECT_GE(format.Format.nChannels, 1); - EXPECT_GE(format.Format.nSamplesPerSec, 8000u); - EXPECT_GE(format.Format.wBitsPerSample, 16); - EXPECT_GE(format.Samples.wValidBitsPerSample, 16); - EXPECT_EQ(format.Format.wFormatTag, WAVE_FORMAT_EXTENSIBLE); + CoreAudioUtil::WaveFormatWrapper wformat(&format); + EXPECT_GE(wformat->nChannels, 1); + EXPECT_GE(wformat->nSamplesPerSec, 8000u); + EXPECT_GE(wformat->wBitsPerSample, 16); + if (wformat.IsExtensible()) { + EXPECT_EQ(wformat->wFormatTag, WAVE_FORMAT_EXTENSIBLE); + EXPECT_GE(wformat->cbSize, 22); + EXPECT_GE(wformat.GetExtensible()->Samples.wValidBitsPerSample, 16); + } else { + EXPECT_EQ(wformat->cbSize, 0); + } } TEST_F(CoreAudioUtilWinTest, IsChannelLayoutSupported) { @@ -271,7 +339,7 @@ std::string(), eRender, eConsole, mix_params.channel_layout())); // Check if it is possible to modify the channel layout to stereo for a - // device which reports that it prefers to be openen up in an other + // device which reports that it prefers to be opened up in an other // channel configuration. if (mix_params.channel_layout() != CHANNEL_LAYOUT_STEREO) { ChannelLayout channel_layout = CHANNEL_LAYOUT_STEREO; @@ -322,6 +390,19 @@ } } +TEST_F(CoreAudioUtilWinTest, GetChannelConfig) { + ABORT_AUDIO_TEST_IF_NOT(DevicesAvailable()); + + EDataFlow data_flows[] = {eRender, eCapture}; + + for (auto data_flow : data_flows) { + ChannelConfig config = + CoreAudioUtil::GetChannelConfig(std::string(), data_flow); + EXPECT_NE(config, CHANNEL_LAYOUT_NONE); + EXPECT_NE(config, CHANNEL_LAYOUT_UNSUPPORTED); + } +} + TEST_F(CoreAudioUtilWinTest, SharedModeInitialize) { ABORT_AUDIO_TEST_IF_NOT(DevicesAvailable()); @@ -330,7 +411,7 @@ eRender, eConsole); EXPECT_TRUE(client.Get()); - WAVEFORMATPCMEX format; + WAVEFORMATEXTENSIBLE format; EXPECT_TRUE( SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format))); @@ -394,7 +475,7 @@ EDataFlow data[] = {eRender, eCapture}; - WAVEFORMATPCMEX format; + WAVEFORMATEXTENSIBLE format; uint32_t endpoint_buffer_size = 0; for (size_t i = 0; i < base::size(data); ++i) { @@ -443,7 +524,7 @@ AudioDeviceDescription::kDefaultDeviceId, eRender, eConsole)); EXPECT_TRUE(client.Get()); - WAVEFORMATPCMEX format; + WAVEFORMATEXTENSIBLE format; uint32_t endpoint_buffer_size = 0; EXPECT_TRUE( SUCCEEDED(CoreAudioUtil::GetSharedModeMixFormat(client.Get(), &format))); @@ -603,7 +684,7 @@ AudioDeviceDescription::kDefaultDeviceId, eRender, eConsole); EXPECT_TRUE(default_client.Get()); - WAVEFORMATPCMEX format; + WAVEFORMATEXTENSIBLE format; EXPECT_TRUE(SUCCEEDED( CoreAudioUtil::GetSharedModeMixFormat(default_client.Get(), &format)));
diff --git a/media/base/audio_parameters.cc b/media/base/audio_parameters.cc index 95b975f..f05f18cb 100644 --- a/media/base/audio_parameters.cc +++ b/media/base/audio_parameters.cc
@@ -122,6 +122,12 @@ << " frames_per_buffer: " << frames_per_buffer() << " effects: " << effects() << " mic_positions: " << PointsToString(mic_positions_); + if (hardware_capabilities_) { + s << ", hw_cap.min_frames_per_buffer: " + << hardware_capabilities_->min_frames_per_buffer + << ", hw_cap.max_frames_per_buffer: " + << hardware_capabilities_->max_frames_per_buffer; + } return s.str(); }
diff --git a/media/blink/webmediacapabilitiesclient_impl.cc b/media/blink/webmediacapabilitiesclient_impl.cc index 55b19af..97a4011 100644 --- a/media/blink/webmediacapabilitiesclient_impl.cc +++ b/media/blink/webmediacapabilitiesclient_impl.cc
@@ -143,7 +143,7 @@ namespace { void VideoPerfInfoCallback( - blink::ScopedWebCallbacks<blink::WebMediaCapabilitiesQueryCallbacks> + blink::ScopedWebCallbacks<blink::WebMediaCapabilitiesDecodingInfoCallbacks> scoped_callbacks, std::unique_ptr<blink::WebMediaCapabilitiesInfo> info, bool is_smooth, @@ -155,14 +155,16 @@ } void OnGetPerfInfoError( - std::unique_ptr<blink::WebMediaCapabilitiesQueryCallbacks> callbacks) { + std::unique_ptr<blink::WebMediaCapabilitiesDecodingInfoCallbacks> + callbacks) { callbacks->OnError(); } } // namespace void WebMediaCapabilitiesClientImpl::DecodingInfo( const blink::WebMediaConfiguration& configuration, - std::unique_ptr<blink::WebMediaCapabilitiesQueryCallbacks> callbacks) { + std::unique_ptr<blink::WebMediaCapabilitiesDecodingInfoCallbacks> + callbacks) { std::unique_ptr<blink::WebMediaCapabilitiesInfo> info( new blink::WebMediaCapabilitiesInfo());
diff --git a/media/blink/webmediacapabilitiesclient_impl.h b/media/blink/webmediacapabilitiesclient_impl.h index 779b9998..7535552 100644 --- a/media/blink/webmediacapabilitiesclient_impl.h +++ b/media/blink/webmediacapabilitiesclient_impl.h
@@ -22,7 +22,8 @@ // Implementation of blink::WebMediaCapabilitiesClient. void DecodingInfo( const blink::WebMediaConfiguration&, - std::unique_ptr<blink::WebMediaCapabilitiesQueryCallbacks>) override; + std::unique_ptr<blink::WebMediaCapabilitiesDecodingInfoCallbacks>) + override; void BindVideoDecodePerfHistoryForTests( mojom::VideoDecodePerfHistoryPtr decode_history_ptr);
diff --git a/media/blink/webmediacapabilitiesclient_impl_unittest.cc b/media/blink/webmediacapabilitiesclient_impl_unittest.cc index 1f830b5..ca75c57 100644 --- a/media/blink/webmediacapabilitiesclient_impl_unittest.cc +++ b/media/blink/webmediacapabilitiesclient_impl_unittest.cc
@@ -11,7 +11,7 @@ #include "mojo/public/cpp/bindings/binding.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h" +#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h" #include "third_party/blink/public/platform/modules/media_capabilities/web_media_configuration.h" using ::testing::_; @@ -34,7 +34,7 @@ }; class MockWebMediaCapabilitiesQueryCallbacks - : public blink::WebMediaCapabilitiesQueryCallbacks { + : public blink::WebMediaCapabilitiesDecodingInfoCallbacks { public: ~MockWebMediaCapabilitiesQueryCallbacks() override = default;
diff --git a/services/network/chunked_data_pipe_upload_data_stream.cc b/services/network/chunked_data_pipe_upload_data_stream.cc index 73f7131..4f59ea5 100644 --- a/services/network/chunked_data_pipe_upload_data_stream.cc +++ b/services/network/chunked_data_pipe_upload_data_stream.cc
@@ -48,11 +48,6 @@ mojo::DataPipe data_pipe; chunked_data_pipe_getter_->StartReading(std::move(data_pipe.producer_handle)); data_pipe_ = std::move(data_pipe.consumer_handle); - handle_watcher_.Watch( - data_pipe_.get(), - MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED, - base::BindRepeating(&ChunkedDataPipeUploadDataStream::OnHandleReadable, - base::Unretained(this))); return net::OK; } @@ -77,6 +72,16 @@ return net::OK; } + // Only start watching once a read starts. This is because OnHandleReadable() + // uses |buf_| implicitly assuming that this method has already been called. + if (!handle_watcher_.IsWatching()) { + handle_watcher_.Watch( + data_pipe_.get(), + MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED, + base::BindRepeating(&ChunkedDataPipeUploadDataStream::OnHandleReadable, + base::Unretained(this))); + } + uint32_t num_bytes = buf_len; if (size_ && num_bytes > *size_ - bytes_read_) num_bytes = *size_ - bytes_read_;
diff --git a/sql/sqlite_features_unittest.cc b/sql/sqlite_features_unittest.cc index 560dbd0..1f784d0 100644 --- a/sql/sqlite_features_unittest.cc +++ b/sql/sqlite_features_unittest.cc
@@ -180,7 +180,7 @@ EXPECT_TRUE(!s.ColumnBool(3)) << " default FALSE added by altering the table"; } -#if defined(OS_FUCHSIA) || defined(OS_WIN) +#if defined(OS_FUCHSIA) // If the platform cannot support SQLite mmap'ed I/O, make sure SQLite isn't // offering to support it. TEST_F(SQLiteFeaturesTest, NoMmap) { @@ -195,9 +195,9 @@ sql::Statement s(db().GetUniqueStatement("PRAGMA mmap_size")); ASSERT_TRUE(!s.Step() || !s.ColumnInt64(0)); } -#endif // defined(OS_FUCHSIA) || defined(OS_WIN) +#endif // defined(OS_FUCHSIA) -#if !defined(OS_FUCHSIA) && !defined(OS_WIN) +#if !defined(OS_FUCHSIA) // Verify that OS file writes are reflected in the memory mapping of a // memory-mapped file. Normally SQLite writes to memory-mapped files using // memcpy(), which should stay consistent. Our SQLite is slightly patched to @@ -269,7 +269,7 @@ ASSERT_EQ('4', m.data()[kOffset]); } } -#endif // !defined(OS_FUCHSIA) && !defined(OS_WIN) +#endif // !defined(OS_FUCHSIA) // Verify that http://crbug.com/248608 is fixed. In this bug, the // compiled regular expression is effectively cached with the prepared
diff --git a/testing/buildbot/filters/mojo.fyi.network_webview_instrumentation_test_apk.filter b/testing/buildbot/filters/mojo.fyi.network_webview_instrumentation_test_apk.filter index db0a646..0fe112054 100644 --- a/testing/buildbot/filters/mojo.fyi.network_webview_instrumentation_test_apk.filter +++ b/testing/buildbot/filters/mojo.fyi.network_webview_instrumentation_test_apk.filter
@@ -33,25 +33,12 @@ # https://crbug.com/893566 -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testBaseUrlOfLoadDataSentInRefererHeader -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForExistingFiles --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForIframe --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForImage --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForNonexistentAsset --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForNonexistentContentUrl --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForNonexistentFiles --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForNonexistentResource -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledForUnsupportedSchemes --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledWithCorrectHasUserGestureParam --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledWithCorrectHeadersParam --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledWithCorrectIsMainFrameParam --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledWithCorrectMethodParam -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledWithCorrectRefererHeader --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCalledWithCorrectUrlParam -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testCanInterceptMainFrame -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testContentIdIframe -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testContentIdImage --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testDeadlock -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testDoesNotCrashOnEmptyStream --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testDoesNotCrashOnInvalidData -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testDoesNotCrashOnSlowStream -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testDoesNotCrashOnThrowingStream -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testHttpResponseClientViaHeader @@ -65,7 +52,9 @@ -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testNotCalledForExistingResource -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testNotCalledForHttpRedirect -org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testNullInputStreamCausesErrorForMainFrame --org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testOnLoadResourceCalledWithCorrectUrl +-org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testNullHttpResponseHeaders +-org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testDoesNotChangeReportedUrl +-org.chromium.android_webview.test.AwContentsClientShouldInterceptRequestTest.testNoOnReceivedErrorCallback # https://crbug.com/893568 -org.chromium.android_webview.test.AwContentsTest.testCanInjectHeaders
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index c85038b..37293d3 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -62,6 +62,7 @@ # The following tests need to remove the assumption that user activation is # available in child/sibling frames. This assumption doesn't hold with User # Activation v2 (UAv2). +crbug.com/906791 external/wpt/fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html [ Timeout ] crbug.com/860713 bluetooth/characteristic/notifications/notification-after-disconnection.html [ Failure ] crbug.com/860713 external/wpt/bluetooth/requestDevice/cross-origin-iframe.sub.https.html [ Failure ] crbug.com/860713 external/wpt/bluetooth/requestDevice/request-from-iframe.https.html [ Failure ] @@ -77,6 +78,9 @@ crbug.com/860713 external/wpt/bluetooth/service/getCharacteristics/gen-reconnect-during-with-uuid.https.html [ Failure ] crbug.com/860713 external/wpt/bluetooth/service/getCharacteristics/gen-reconnect-during.https.html [ Failure ] +# The following tests passes only with User Activation v2 (UAv2) enabled. +crbug.com/906791 external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.tentative.html [ Failure ] + # The following fail only on Mac. crbug.com/891427 [ Mac ] virtual/threaded/synthetic_gestures/synthetic-pinch-zoom-gesture-touchscreen-desktop.html [ Pass Failure Timeout Crash ] crbug.com/891427 [ Mac ] fast/events/touch/gesture/touch-gesture-scroll-listbox.html [ Pass Failure Timeout Crash ] @@ -1470,6 +1474,7 @@ crbug.com/591099 virtual/layout_ng_experimental/printing/thead-under-multicol.html [ Failure ] crbug.com/829804 virtual/layout_ng_experimental/printing/webgl-oversized-printing.html [ Skip ] crbug.com/824918 virtual/layout_ng_experimental/printing/width-overflow.html [ Failure ] +Bug(none) virtual/layout_ng_experimental/fragmentation/scrolling-contents-scroll.html [ Crash Failure ] # Flexbox in NG # @@ -2640,8 +2645,6 @@ crbug.com/491764 http/tests/devtools/service-workers/user-agent-override.js [ Pass Timeout ] # Fails with leak detector. -crbug.com/733494 [ Linux ] media/autoplay/document-user-activation.html [ Skip ] -crbug.com/733494 [ Linux ] virtual/video-surface-layer/media/autoplay/document-user-activation.html [ Skip ] crbug.com/769885 [ Linux ] virtual/android/fullscreen/full-screen-frameset.html [ Skip ] @@ -5344,7 +5347,6 @@ crbug.com/874162 [ Mac ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-drag.html [ Skip ] crbug.com/874162 [ Mac ] virtual/user-activation-v2/fast/events/middleClickAutoscroll-drag.html [ Skip ] crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-event-fired.html [ Skip ] -crbug.com/874162 [ Mac ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-event-fired.html [ Skip ] crbug.com/874162 [ Mac ] virtual/user-activation-v2/fast/events/middleClickAutoscroll-event-fired.html [ Skip ] crbug.com/874162 [ Mac ] fast/events/middleClickAutoscroll-in-iframe.html [ Skip ] crbug.com/874162 [ Mac ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-in-iframe.html [ Skip ] @@ -5448,8 +5450,6 @@ # Sheriff 2018-10-12 crbug.com/891155 [ Linux ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-drag.html [ Failure Pass ] crbug.com/891155 [ Win ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-drag.html [ Failure Pass ] -crbug.com/891155 [ Linux ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-event-fired.html [ Failure Pass ] -crbug.com/891155 [ Win ] virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-event-fired.html [ Failure Pass ] crbug.com/891155 [ Linux ] virtual/user-activation-v2/fast/events/middleClickAutoscroll-drag.html [ Failure Pass ] crbug.com/891155 [ Win ] virtual/user-activation-v2/fast/events/middleClickAutoscroll-drag.html [ Failure Pass ] crbug.com/891155 [ Linux ] virtual/user-activation-v2/fast/events/middleClickAutoscroll-event-fired.html [ Failure Pass ] @@ -5560,3 +5560,8 @@ #Sheriff 2018-11-22 crbug.com/907736 http/tests/devtools/elements/elements-save-to-temp-var.js [ Timeout Pass ] crbug.com/907862 [ Mac10.13 ] virtual/user-activation-v2/gamepad/multiple-event-listeners.html [ Pass Failure ] + +# Sheriff 2018-11-23 +crbug.com/874162 virtual/mouseevent_fractional/fast/events/middleClickAutoscroll-event-fired.html [ Skip ] +crbug.com/906320 [ Mac10.13 ] virtual/not-site-per-process/http/tests/devtools/isolated-code-cache/same-origin-test.js [ Failure Pass ] +crbug.com/906320 [ Mac10.13 ] virtual/site-isolated-code-cache/http/tests/devtools/isolated-code-cache/same-origin-test.js [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json index 5f7ff98d2..6b5de7c 100644 --- a/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json +++ b/third_party/WebKit/LayoutTests/external/WPT_BASE_MANIFEST_5.json
@@ -3949,6 +3949,12 @@ {} ] ], + "fullscreen/api/element-ready-check-containing-iframe-manual.tentative.html": [ + [ + "/fullscreen/api/element-ready-check-containing-iframe-manual.tentative.html", + {} + ] + ], "fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html": [ [ "/fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html", @@ -151471,11 +151477,41 @@ {} ] ], + "custom-elements/adopted-callback-expected.txt": [ + [ + {} + ] + ], + "custom-elements/attribute-changed-callback-expected.txt": [ + [ + {} + ] + ], + "custom-elements/connected-callbacks-expected.txt": [ + [ + {} + ] + ], + "custom-elements/connected-callbacks-html-fragment-parsing-expected.txt": [ + [ + {} + ] + ], + "custom-elements/custom-element-reaction-queue-expected.txt": [ + [ + {} + ] + ], "custom-elements/custom-element-registry/per-global-expected.txt": [ [ {} ] ], + "custom-elements/disconnected-callbacks-expected.txt": [ + [ + {} + ] + ], "custom-elements/historical-expected.txt": [ [ {} @@ -151486,6 +151522,11 @@ {} ] ], + "custom-elements/parser/parser-sets-attributes-and-children-expected.txt": [ + [ + {} + ] + ], "custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt": [ [ {} @@ -151496,12 +151537,132 @@ {} ] ], + "custom-elements/reactions/Attr-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/CSSStyleDeclaration-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/ChildNode-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/DOMStringMap-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/DOMTokenList-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/Document-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/Element-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/ElementContentEditable-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLAnchorElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLOptionElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLOptionsCollection-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLOutputElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLSelectElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLTableElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLTableRowElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLTableSectionElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/HTMLTitleElement-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/NamedNodeMap-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/Node-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/ParentNode-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/Range-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/Selection-expected.txt": [ + [ + {} + ] + ], + "custom-elements/reactions/ShadowRoot-expected.txt": [ + [ + {} + ] + ], "custom-elements/reactions/resources/reactions.js": [ [ {} ] ], - "custom-elements/resources/custom-elements-helpers.js": [ + "custom-elements/reactions/with-exceptions-expected.txt": [ [ {} ] @@ -151516,6 +151677,21 @@ {} ] ], + "custom-elements/resources/navigation-destination.html": [ + [ + {} + ] + ], + "custom-elements/upgrading-expected.txt": [ + [ + {} + ] + ], + "custom-elements/upgrading/Document-importNode-expected.txt": [ + [ + {} + ] + ], "device-memory/META.yml": [ [ {} @@ -176296,6 +176472,11 @@ {} ] ], + "resources/custom-elements-helpers.js": [ + [ + {} + ] + ], "resources/idlharness.js": [ [ {} @@ -214483,6 +214664,18 @@ {} ] ], + "custom-elements/throw-on-dynamic-markup-insertion-counter-construct.html": [ + [ + "/custom-elements/throw-on-dynamic-markup-insertion-counter-construct.html", + {} + ] + ], + "custom-elements/throw-on-dynamic-markup-insertion-counter-reactions.html": [ + [ + "/custom-elements/throw-on-dynamic-markup-insertion-counter-reactions.html", + {} + ] + ], "custom-elements/upgrading.html": [ [ "/custom-elements/upgrading.html", @@ -378156,10 +378349,18 @@ "e1d5315930d173980cff522fdedcc81e8b48fcb7", "support" ], + "custom-elements/adopted-callback-expected.txt": [ + "45341e7b05674efebcbdef26c424319f011b657f", + "support" + ], "custom-elements/adopted-callback.html": [ "5c08a04a4210d7f8bc3d752fa3e4db220aa26118", "testharness" ], + "custom-elements/attribute-changed-callback-expected.txt": [ + "6d5a37c503afd4bc0333e4ed9c8b128761d602ba", + "support" + ], "custom-elements/attribute-changed-callback.html": [ "5090bfbfbfecdfbfbfb7c52579824cd333c93cdc", "testharness" @@ -378168,6 +378369,14 @@ "e3001a2c4855e9c10afaf46cdd2fe60fcd2a1cd3", "testharness" ], + "custom-elements/connected-callbacks-expected.txt": [ + "c2a78e67c99588a247df8d89a8cd37a82d903ccb", + "support" + ], + "custom-elements/connected-callbacks-html-fragment-parsing-expected.txt": [ + "1ea67d2d951d5a4df31db494caecd685e489a47e", + "support" + ], "custom-elements/connected-callbacks-html-fragment-parsing.html": [ "f24cc209c893ff0e6f69fd19651e0bad66419cd1", "testharness" @@ -378176,6 +378385,10 @@ "d6e68262a850a9a952877264fdf64594e8025375", "testharness" ], + "custom-elements/custom-element-reaction-queue-expected.txt": [ + "e1d0f496b5d6cf0f128f4425197f58885d176d9c", + "support" + ], "custom-elements/custom-element-reaction-queue.html": [ "737dab117d3bd8d296ca6235d04e7664e35740c0", "testharness" @@ -378196,6 +378409,10 @@ "e020d95a576852b8a95c1f72a6061571efb6a4af", "testharness" ], + "custom-elements/disconnected-callbacks-expected.txt": [ + "bd7b81c7b41e2ed6995a316bc33d6104803ff56e", + "support" + ], "custom-elements/disconnected-callbacks.html": [ "7f5a4d0f8e76d495acfdedfe172ef5acfdac75b4", "testharness" @@ -378209,7 +378426,7 @@ "testharness" ], "custom-elements/htmlconstructor/newtarget-expected.txt": [ - "46c1cf2b39b28fdcaa93518c225142276651d423", + "dca4aab2592fd53d08f9de3cec1e6641cca44f56", "support" ], "custom-elements/htmlconstructor/newtarget.html": [ @@ -378244,6 +378461,10 @@ "82e970f1ae810f54a3d37c5c5b142143422bda11", "testharness" ], + "custom-elements/parser/parser-sets-attributes-and-children-expected.txt": [ + "af50412f1e8909461e393cedbd8f1e099547dd5d", + "support" + ], "custom-elements/parser/parser-sets-attributes-and-children.html": [ "987bf8525fb4a950f41ffa73d3952a1c78db5cdf", "testharness" @@ -378257,7 +378478,7 @@ "testharness" ], "custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt": [ - "35cb638573fad9e71ff37c427f5a38a54853a88c", + "0b792e639777adc2ab33eb1758160c30fd00ef0d", "support" ], "custom-elements/parser/parser-uses-registry-of-owner-document.html": [ @@ -378284,42 +378505,82 @@ "9e5bafbedfec42d28eb94c95ed84396941bc61ac", "testharness" ], + "custom-elements/reactions/Attr-expected.txt": [ + "601e1a251433b8dcb81851cfa5dcb090c81e22c2", + "support" + ], "custom-elements/reactions/Attr.html": [ "c9fa37f961159fffc19e8fdbe72df8b5686681a2", "testharness" ], + "custom-elements/reactions/CSSStyleDeclaration-expected.txt": [ + "53b676c79e467c76146139c6e45ace9f92e89ce2", + "support" + ], "custom-elements/reactions/CSSStyleDeclaration.html": [ "95274d8c75749e8c3b215407dccc81270d02f67b", "testharness" ], + "custom-elements/reactions/ChildNode-expected.txt": [ + "0e78d755d494fb46faaa21f419f7cfe59f7cef55", + "support" + ], "custom-elements/reactions/ChildNode.html": [ "f808b67a80a93703951424a6c08beeab1f4b5dfc", "testharness" ], + "custom-elements/reactions/DOMStringMap-expected.txt": [ + "d2c4180eced092e297fe0fe6ab45d7b353537769", + "support" + ], "custom-elements/reactions/DOMStringMap.html": [ "5e34dfe2ba11c73275e0659f8671e02f88f9c2dd", "testharness" ], + "custom-elements/reactions/DOMTokenList-expected.txt": [ + "3f7106805a58b718987cf8dcb44388dc5bcde43f", + "support" + ], "custom-elements/reactions/DOMTokenList.html": [ "14a643c4a87455866e752873319cd43a4bc419cd", "testharness" ], + "custom-elements/reactions/Document-expected.txt": [ + "000c261e84e3c714afa3b4671d809be4f7860931", + "support" + ], "custom-elements/reactions/Document.html": [ "721ad1f4ced84b8c81291fe92fa402e7b6384358", "testharness" ], + "custom-elements/reactions/Element-expected.txt": [ + "5e3a72016d92caccdabc4cfea6aa89bce1203ca7", + "support" + ], "custom-elements/reactions/Element.html": [ "8370724061ad193e71574596efa68c916e55535c", "testharness" ], + "custom-elements/reactions/ElementContentEditable-expected.txt": [ + "33e03d9e4119aca2522ebe4ccb43d48453cf6d4b", + "support" + ], "custom-elements/reactions/ElementContentEditable.html": [ "bdb10761cb8dd900f430c0d618cb914b3805a550", "testharness" ], + "custom-elements/reactions/HTMLAnchorElement-expected.txt": [ + "715e2b1e03ca53ffe51279e46d8c485b31cc70a3", + "support" + ], "custom-elements/reactions/HTMLAnchorElement.html": [ "c6eeb1dce90b2a3ffe099cba80e64d71f2741f81", "testharness" ], + "custom-elements/reactions/HTMLElement-expected.txt": [ + "3445b7d68c1963c0e1d0c6e4fc938090f5ea7fe3", + "support" + ], "custom-elements/reactions/HTMLElement.html": [ "5fe422cdfc1df56d58e4eeac1be4669ba8fee967", "testharness" @@ -378328,58 +378589,114 @@ "dc4b22a22eea3ea841b1380e7db3e75e7f4eb256", "testharness" ], + "custom-elements/reactions/HTMLOptionElement-expected.txt": [ + "a554192d302a25f6b374b629a1415f515281544c", + "support" + ], "custom-elements/reactions/HTMLOptionElement.html": [ "418ef282b32fd5e7c29f21a0a9eb17b6c4796167", "testharness" ], + "custom-elements/reactions/HTMLOptionsCollection-expected.txt": [ + "ab1725734e76dbda2961afd5e733961c139796dc", + "support" + ], "custom-elements/reactions/HTMLOptionsCollection.html": [ "0d64259d063182d4bb52ca6b4073d443af9ca1cf", "testharness" ], + "custom-elements/reactions/HTMLOutputElement-expected.txt": [ + "a6cf394dcf716e6dc965cec3f53993dc04e686f5", + "support" + ], "custom-elements/reactions/HTMLOutputElement.html": [ "02e669bc7a75558686dd56b4ab8fc5918892de2e", "testharness" ], + "custom-elements/reactions/HTMLSelectElement-expected.txt": [ + "2e24913f9d9d011d2e3a003b643a1f38699ad6c6", + "support" + ], "custom-elements/reactions/HTMLSelectElement.html": [ "7c79634f668b294e5c32224e15e96e2397883777", "testharness" ], + "custom-elements/reactions/HTMLTableElement-expected.txt": [ + "9d06692ecbdf6ad4f84f19375aa3c23882820950", + "support" + ], "custom-elements/reactions/HTMLTableElement.html": [ "6adf2623d6bc208e4eaa41e1683b754f9cccf061", "testharness" ], + "custom-elements/reactions/HTMLTableRowElement-expected.txt": [ + "208b20d0c4c3260414cbf9420e1974a7fb8fd885", + "support" + ], "custom-elements/reactions/HTMLTableRowElement.html": [ "a9a00a5da330b15614419940956f6579f6e13bb1", "testharness" ], + "custom-elements/reactions/HTMLTableSectionElement-expected.txt": [ + "fa807159b4e2e843fd1214cddb5924bd288e71fc", + "support" + ], "custom-elements/reactions/HTMLTableSectionElement.html": [ "cbb0a146e8012ac8e44934604443fb300fbcfbb8", "testharness" ], + "custom-elements/reactions/HTMLTitleElement-expected.txt": [ + "a62831e61e1205100af49904e58aabef03a926e3", + "support" + ], "custom-elements/reactions/HTMLTitleElement.html": [ "6678944c919d45c42ca68f2585575d398287b15e", "testharness" ], + "custom-elements/reactions/NamedNodeMap-expected.txt": [ + "13044816a91056dc521e3fcdfc4650c34f1700b5", + "support" + ], "custom-elements/reactions/NamedNodeMap.html": [ "fa21b3ada9ab2bd79370947d81ae6d5fb1984f45", "testharness" ], + "custom-elements/reactions/Node-expected.txt": [ + "11e3580fa500b124fcf2b3ef117e29097fd077fa", + "support" + ], "custom-elements/reactions/Node.html": [ "94da3d020e2f6df524abe4b314b3be30fa20fa9f", "testharness" ], + "custom-elements/reactions/ParentNode-expected.txt": [ + "213bc158e8d4e435b8275f8bb0bdeabc755dc4d7", + "support" + ], "custom-elements/reactions/ParentNode.html": [ "b143b5a982b5b44f6f953d1071c82ef22659b0a0", "testharness" ], + "custom-elements/reactions/Range-expected.txt": [ + "56db8c71208e659efaf69e50436803ce1a02bfa3", + "support" + ], "custom-elements/reactions/Range.html": [ "c4a8252ff620757778a01e43676d3f9c9999d7cb", "testharness" ], + "custom-elements/reactions/Selection-expected.txt": [ + "3c6fcd53b8f929bbb3afc5c662c4b24beb5e31d6", + "support" + ], "custom-elements/reactions/Selection.html": [ "84214201aaaf32481e17d45a8b889cc8c5d01a10", "testharness" ], + "custom-elements/reactions/ShadowRoot-expected.txt": [ + "0af7b628f5a311d52bf87e246675b4368b85341b", + "support" + ], "custom-elements/reactions/ShadowRoot.html": [ "9997d9c8362b5e4838572f403e2eb0fb0f418121", "testharness" @@ -378388,14 +378705,14 @@ "43ce4fd7ad83ec4066abffa28b3581f1685d1f93", "support" ], + "custom-elements/reactions/with-exceptions-expected.txt": [ + "cfa873d937a1b8cb1fdeb2f5c01226d46dcb1dc9", + "support" + ], "custom-elements/reactions/with-exceptions.html": [ "82e0f59c93022fcd6321c6b8ad1f8d7014b74382", "testharness" ], - "custom-elements/resources/custom-elements-helpers.js": [ - "015a698c63e5d28de0e34946552fc15d322645bd", - "support" - ], "custom-elements/resources/empty-html-document.html": [ "eaca3f49fd15840a3688a10a91b56524566893c5", "support" @@ -378404,10 +378721,30 @@ "b9bfdf90a2d9ae6f2731451b45554ecb70f366d6", "support" ], + "custom-elements/resources/navigation-destination.html": [ + "50e28f0ed87fc12ef0f659433df97be9c14b9e71", + "support" + ], + "custom-elements/throw-on-dynamic-markup-insertion-counter-construct.html": [ + "b8f00aaa161d1dee32783b69b06cd1b65968b6f1", + "testharness" + ], + "custom-elements/throw-on-dynamic-markup-insertion-counter-reactions.html": [ + "addcdf3cec582fb0f2d2714668c41dbb0296a113", + "testharness" + ], + "custom-elements/upgrading-expected.txt": [ + "0255ad2d7ff5681d5a94545e136f90bb65aafab7", + "support" + ], "custom-elements/upgrading.html": [ "aaea0cb4a021169631c2b50d0f597cb727a0b614", "testharness" ], + "custom-elements/upgrading/Document-importNode-expected.txt": [ + "a8801106f29dbab20fc76646ab7e26d7b81e2d74", + "support" + ], "custom-elements/upgrading/Document-importNode.html": [ "b80f90648d110a358bef090d3d9830077264cf70", "testharness" @@ -386429,13 +386766,17 @@ "testharness" ], "fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html": [ - "92d499bc691b868e30af9ecfab6135d4f6d810ce", + "b3e43c780699db03647c3258e92805c592a1f468", "manual" ], "fullscreen/api/element-ready-check-containing-iframe-manual.html": [ "0649549265682b7eb8c0f851603d816e89e1cf47", "manual" ], + "fullscreen/api/element-ready-check-containing-iframe-manual.tentative.html": [ + "66d9c4316137115a9e29644985c835cb029c8fd9", + "manual" + ], "fullscreen/api/element-ready-check-fullscreen-element-sibling-manual.html": [ "f800093ec8ec8d6818a107dfc19a053c10583b36", "manual" @@ -386541,7 +386882,7 @@ "manual" ], "fullscreen/api/element-request-fullscreen-two-iframes-manual.html": [ - "94b38c0302a5fa32f72dd63c505cf0b73d7e6a73", + "df5ee2a91b744ec05a385bd1246c568f9b9d6a65", "manual" ], "fullscreen/api/element-request-fullscreen.html": [ @@ -406357,11 +406698,11 @@ "testharness" ], "infrastructure/metadata/infrastructure/assumptions/allowed-to-play.html.ini": [ - "ef6b2edc6089bfc985fd06c6257774909bb7fc43", + "c9fbabede6d695cd3795e4390b35da0454ffcc34", "support" ], "infrastructure/metadata/infrastructure/assumptions/html-elements.html.ini": [ - "7751a227dfc592d20585d4e562b552de6149de1d", + "b7303c645fce287ae4e2bb34dbb1999e6e27e147", "support" ], "infrastructure/metadata/infrastructure/expected-fail/failing-test.html.ini": [ @@ -406397,39 +406738,39 @@ "support" ], "infrastructure/metadata/infrastructure/server/context.any.js.ini": [ - "30d04b39cf25ac2b054bd77bf70ee834a2ae89c0", + "f985548b2f0987992331415d1661a2fdfb48ed99", "support" ], "infrastructure/metadata/infrastructure/server/order-of-metas.any.js.ini": [ - "39bc08956f4cd27fe16537608024936872f04c1a", + "b29646288b23b7e1603bcae7927e61c9d9adc241", "support" ], "infrastructure/metadata/infrastructure/server/secure-context.https.any.js.ini": [ - "f2737bf3f67804a2bbf1efaef7349ee6af274d76", + "272935af1ecad7ea785a716948aec8f0a4139330", "support" ], "infrastructure/metadata/infrastructure/server/title.any.js.ini": [ - "f2e268dcf509f8c3385f1249efea10e6c9bfeba2", + "6852b8033d8ebf2b15786af1286a1ced98c793fb", "support" ], "infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini": [ - "6644d52d1ff5f9faa1101c539afd35e6e94be182", + "f751532cee7e7a558c85011986aa72a65b79ce7c", "support" ], "infrastructure/metadata/infrastructure/testdriver/actions/elementTiming.html.ini": [ - "85dbe11a7afd299aa51fa3da49f4e2e3c8037533", + "a1e9ea86844e78c00282a32a5a64c6365c04ffa2", "support" ], "infrastructure/metadata/infrastructure/testdriver/actions/eventOrder.html.ini": [ - "bfb5c0ae4bd5350c6a540fa48a5d2896d5be9503", + "64f3f2f8c48a778782ba114ab7b42b43d55b1d29", "support" ], "infrastructure/metadata/infrastructure/testdriver/actions/multiDevice.html.ini": [ - "642d0cd21dbb3ab918ab829529cb2fe04c7e7618", + "b9fb2596b952ad81b97d7e04b5eb941d37b3b5da", "support" ], "infrastructure/metadata/infrastructure/testdriver/actions/pause.html.ini": [ - "594f22d2ea2d54f67dcdbdc03baa307213ca00bd", + "3b0d6fa50def6ad5a79d08da6920761ebc360175", "support" ], "infrastructure/reftest-wait-ref.html": [ @@ -406969,7 +407310,7 @@ "support" ], "interfaces/media-capabilities.idl": [ - "816949cb26d87cd608201cadcc860df9712febc8", + "8721b1c73fa4218dadfa7149f0dcd7ac2ec9194e", "support" ], "interfaces/media-source.idl": [ @@ -407677,7 +408018,7 @@ "support" ], "media-capabilities/decodingInfo.html": [ - "982bc1746685871bfa424c88b6eab8d1d00478de", + "cb14e2b516f89d8e9083345be1d242bdeb436e6c", "testharness" ], "media-capabilities/encodingInfo-expected.txt": [ @@ -407685,23 +408026,23 @@ "support" ], "media-capabilities/encodingInfo.html": [ - "5c0e3189082eda87fe44a77262f3b4156783fa39", + "751146c389148cd7b10ee41cf7446b3bed3c4ff1", "testharness" ], "media-capabilities/idlharness-expected.txt": [ - "680d20fbffd2f277abce3e421ce296ca1d99df52", + "f22e0fe00c1c757ef0121919f999174286276706", "support" ], "media-capabilities/idlharness.any-expected.txt": [ - "b7140a91e2259655025b3293af0efeabcfd56a4b", + "55528510878a994cb7e6a2dc7c70a629797e2f1c", "support" ], "media-capabilities/idlharness.any.js": [ - "bd20d5b4b487639d937f9ea6d42bc878de8d93db", + "6da5c7d2848c2dc8a669dfcf621233c40a227c03", "testharness" ], "media-capabilities/idlharness.any.worker-expected.txt": [ - "5aeee8b2529a8a5bb106d05ce46407028b394bd4", + "800cf7e76c2816cb15957ffc02e36aaa088a373a", "support" ], "media-source/META.yml": [ @@ -430168,6 +430509,10 @@ "6805c323df5a975231648b830e33ce183c3cbbd3", "support" ], + "resources/custom-elements-helpers.js": [ + "6f73fe20d0fbf25eed2fbfec530fb516e83cc214", + "support" + ], "resources/idlharness.js": [ "926a615e59c9cd6f602c6e700494d1600ac6d0a5", "support" @@ -441533,15 +441878,15 @@ "testharness" ], "webrtc/RTCPeerConnection-connectionState-expected.txt": [ - "8c44cc42674d68b4172dd6ca3be5ac57203e4d97", + "8b1b80863817b1beb2f0a160313ea5ea56e0a587", "support" ], "webrtc/RTCPeerConnection-connectionState.html": [ - "7ef7e4a3bf2f30a221d1de2c09e5388f206afdc5", + "a461bf16997b6bee497decec65148506e88b773b", "testharness" ], "webrtc/RTCPeerConnection-constructor-expected.txt": [ - "3ad5c15da5ecd7cd91e0848480e4ead769752d04", + "79341f72fe7aa0ddf1d37389df19ec776d0b0eb1", "support" ], "webrtc/RTCPeerConnection-constructor.html": [ @@ -442005,7 +442350,7 @@ "testharness" ], "webrtc/idlharness.https.window-expected.txt": [ - "ab3b196f04f7e306b9f2a5ff342a33836f9fa69e", + "bea78a57c295e1ba0654f0e0eaac41031f85f9db", "support" ], "webrtc/idlharness.https.window.js": [
diff --git a/third_party/WebKit/LayoutTests/external/wpt/css/selectors/invalidation/first-child-last-child.html b/third_party/WebKit/LayoutTests/external/wpt/css/selectors/invalidation/first-child-last-child.html new file mode 100644 index 0000000..4a2ed45 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/css/selectors/invalidation/first-child-last-child.html
@@ -0,0 +1,57 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Selectors Invalidation: :first-child :last-child</title> + <link rel="help" href="https://drafts.csswg.org/selectors-4/#the-first-child-pseudo"> + <meta name="assert" content="This tests that the :first-child and :last-child selectors are effective"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <style> + div { + color: black; + } + span:first-child { + color: blue; + } + span:last-child { + color: red; + } + </style> + </head> + <body> + <div id="target"><span>first-initially</span><span>last-initially</span></div> + <script> + +'use strict'; +const black = 'rgb(0, 0, 0)'; +const blue = 'rgb(0, 0, 255)'; +const red = 'rgb(255, 0, 0)'; + +test(() => { + const target = document.querySelector('#target'); + const first = target.firstChild; + assert_equals(getComputedStyle(first).color, blue); + target.insertAdjacentHTML('afterbegin', '\n<span>foo</span><span>bar</span>'); + assert_equals(getComputedStyle(target.firstElementChild).color, blue); + assert_equals(getComputedStyle(first).color, black); + while (target.firstElementChild !== first) + target.removeChild(target.firstElementChild); + assert_equals(getComputedStyle(first).color, blue); +}, 'Adding multiple nodes at once should invalidate :first-child correctly.'); + +test(() => { + const target = document.querySelector('#target'); + const last = target.lastChild; + assert_equals(getComputedStyle(last).color, red); + target.insertAdjacentHTML('beforeend', '\n<span>foo</span><span>bar</span>'); + assert_equals(getComputedStyle(target.lastChild).color, red); + assert_equals(getComputedStyle(last).color, black); + while (target.lastChild !== last) + target.removeChild(target.lastChild); + assert_equals(getComputedStyle(last).color, red); +}, 'Adding multiple nodes at once should invalidate :last-child correctly.'); + + </script> + </body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/adopted-callback-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/adopted-callback-expected.txt new file mode 100644 index 0000000..45341e7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/adopted-callback-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = Uncaught ReferenceError: document_types is not defined +PASS Inserting a custom element into the owner document must not enqueue and invoke adoptedCallback +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/attribute-changed-callback-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/attribute-changed-callback-expected.txt new file mode 100644 index 0000000..6d5a37c5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/attribute-changed-callback-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: attributeChangedCallback Uncaught ReferenceError: define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/connected-callbacks-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/connected-callbacks-expected.txt new file mode 100644 index 0000000..c2a78e67 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/connected-callbacks-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: connectedCallback Uncaught ReferenceError: document_types is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/connected-callbacks-html-fragment-parsing-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/connected-callbacks-html-fragment-parsing-expected.txt new file mode 100644 index 0000000..1ea67d2d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/connected-callbacks-html-fragment-parsing-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: the HTML fragment parsing algorithm must not create a custom element synchronously Uncaught ReferenceError: document_types is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/custom-element-reaction-queue-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/custom-element-reaction-queue-expected.txt new file mode 100644 index 0000000..e1d0f49 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/custom-element-reaction-queue-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: Each element must have its own custom element reaction queue Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/disconnected-callbacks-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/disconnected-callbacks-expected.txt new file mode 100644 index 0000000..bd7b81c7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/disconnected-callbacks-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: disconnectedCallback Uncaught ReferenceError: document_types is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/htmlconstructor/newtarget-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/htmlconstructor/newtarget-expected.txt index 46c1cf2..dca4aab2 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/htmlconstructor/newtarget-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/htmlconstructor/newtarget-expected.txt
@@ -1,15 +1,4 @@ This is a testharness.js-based test. -PASS Use NewTarget's prototype, not the one stored at definition time -PASS Rethrow any exceptions thrown while getting the prototype -PASS If prototype is not object (null), derives the fallback from NewTarget's realm (autonomous custom elements) -PASS If prototype is not object (undefined), derives the fallback from NewTarget's realm (autonomous custom elements) -PASS If prototype is not object (5), derives the fallback from NewTarget's realm (autonomous custom elements) -PASS If prototype is not object (string), derives the fallback from NewTarget's realm (autonomous custom elements) -PASS If prototype is not object (null), derives the fallback from NewTarget's realm (customized built-in elements) -PASS If prototype is not object (undefined), derives the fallback from NewTarget's realm (customized built-in elements) -PASS If prototype is not object (5), derives the fallback from NewTarget's realm (customized built-in elements) -PASS If prototype is not object (string), derives the fallback from NewTarget's realm (customized built-in elements) -FAIL HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling proxy constructor directly assert_equals: Should never have gotten .prototype expected 0 but got 1 -FAIL HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling via Reflect assert_equals: Should never have gotten .prototype expected 0 but got 1 +FAIL Custom Elements: [HTMLConstructor] derives prototype from NewTarget Uncaught ReferenceError: test_with_window is not defined Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-sets-attributes-and-children-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-sets-attributes-and-children-expected.txt new file mode 100644 index 0000000..af50412f --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-sets-attributes-and-children-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: Changes to the HTML parser Uncaught ReferenceError: create_attribute_changed_callback_log is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt index 35cb638..0b792e6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt
@@ -1,4 +1,5 @@ This is a testharness.js-based test. +Harness Error. harness_status.status = 1 , harness_status.message = Uncaught ReferenceError: test_with_window is not defined PASS HTML parser must not instantiate custom elements inside template elements PASS HTML parser must not use the registry of the owner element's document inside an iframe PASS HTML parser must use the registry of the content document inside an iframe @@ -7,7 +8,5 @@ PASS HTML parser must use the registry of window.document in a document created by document.implementation.createXHTMLDocument() PASS HTML parser must use the registry of window.document in a document created by new Document PASS HTML parser must use the registry of window.document in a document created by XMLHttpRequest -FAIL document.write() must not instantiate a custom element without a defined insertion point assert_false: expected false got true -FAIL document.writeln() must not instantiate a custom element without a defined insertion point assert_false: expected false got true Harness: the test ran to completion.
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Attr-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Attr-expected.txt new file mode 100644 index 0000000..601e1a2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Attr-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL value on Attr must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL value on Attr must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/CSSStyleDeclaration-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/CSSStyleDeclaration-expected.txt new file mode 100644 index 0000000..53b676c7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/CSSStyleDeclaration-expected.txt
@@ -0,0 +1,33 @@ +This is a testharness.js-based test. +FAIL cssText on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute define_new_custom_element is not defined +FAIL cssText on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL cssText on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute define_new_custom_element is not defined +FAIL cssText on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute define_new_custom_element is not defined +FAIL setProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute define_new_custom_element is not defined +FAIL setProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed define_new_custom_element is not defined +FAIL setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed define_new_custom_element is not defined +FAIL removeProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it removes a property from the observed style attribute define_new_custom_element is not defined +FAIL removeProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it removes a property from the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL cssFloat on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute define_new_custom_element is not defined +FAIL cssFloat on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A camel case attribute (borderWidth) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute define_new_custom_element is not defined +FAIL A camel case attribute (borderWidth) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A camel case attribute (borderWidth) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute define_new_custom_element is not defined +FAIL A camel case attribute (borderWidth) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A dashed property (border-width) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute define_new_custom_element is not defined +FAIL A dashed property (border-width) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A dashed property (border-width) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute define_new_custom_element is not defined +FAIL A dashed property (border-width) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute define_new_custom_element is not defined +FAIL A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute define_new_custom_element is not defined +FAIL A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute define_new_custom_element is not defined +FAIL A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed define_new_custom_element is not defined +FAIL A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute define_new_custom_element is not defined +FAIL A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ChildNode-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ChildNode-expected.txt new file mode 100644 index 0000000..0e78d75 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ChildNode-expected.txt
@@ -0,0 +1,10 @@ +This is a testharness.js-based test. +FAIL before on ChildNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL before on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL after on ChildNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL after on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL replaceWith on ChildNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL replaceWith on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL remove on ChildNode must enqueue a disconnected reaction define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/DOMStringMap-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/DOMStringMap-expected.txt new file mode 100644 index 0000000..d2c4180e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/DOMStringMap-expected.txt
@@ -0,0 +1,11 @@ +This is a testharness.js-based test. +FAIL setter on DOMStringMap must enqueue an attributeChanged reaction when adding an observed data attribute define_new_custom_element is not defined +FAIL setter on DOMStringMap must not enqueue an attributeChanged reaction when adding an unobserved data attribute define_new_custom_element is not defined +FAIL setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute define_new_custom_element is not defined +FAIL setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute to the same value define_new_custom_element is not defined +FAIL setter on DOMStringMap must not enqueue an attributeChanged reaction when mutating the value of an unobserved data attribute define_new_custom_element is not defined +FAIL deleter on DOMStringMap must enqueue an attributeChanged reaction when removing an observed data attribute define_new_custom_element is not defined +FAIL deleter on DOMStringMap must not enqueue an attributeChanged reaction when removing an unobserved data attribute define_new_custom_element is not defined +FAIL deleter on DOMStringMap must not enqueue an attributeChanged reaction when it does not remove a data attribute define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/DOMTokenList-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/DOMTokenList-expected.txt new file mode 100644 index 0000000..3f7106805 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/DOMTokenList-expected.txt
@@ -0,0 +1,22 @@ +This is a testharness.js-based test. +FAIL add on DOMTokenList must enqueue an attributeChanged reaction when adding an attribute define_new_custom_element is not defined +FAIL add on DOMTokenList must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL add on DOMTokenList must enqueue an attributeChanged reaction when adding a value to an existing attribute define_new_custom_element is not defined +FAIL add on DOMTokenList must not enqueue an attributeChanged reaction when adding a value to an unobserved attribute define_new_custom_element is not defined +FAIL add on DOMTokenList must enqueue exactly one attributeChanged reaction when adding multiple values to an attribute define_new_custom_element is not defined +FAIL remove on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute define_new_custom_element is not defined +FAIL remove on DOMTokenList must enqueue exactly one attributeChanged reaction when removing multiple values to an attribute define_new_custom_element is not defined +FAIL remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute define_new_custom_element is not defined +FAIL remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a value from an unobserved attribute define_new_custom_element is not defined +FAIL toggle on DOMTokenList must enqueue an attributeChanged reaction when adding a value to an attribute define_new_custom_element is not defined +FAIL toggle on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute define_new_custom_element is not defined +FAIL replace on DOMTokenList must enqueue an attributeChanged reaction when replacing a value in an attribute define_new_custom_element is not defined +FAIL replace on DOMTokenList must not enqueue an attributeChanged reaction when the token to replace does not exist in the attribute define_new_custom_element is not defined +FAIL replace on DOMTokenList must not enqueue an attributeChanged reaction when replacing a value in an unobserved attribute define_new_custom_element is not defined +FAIL the stringifier of DOMTokenList must enqueue an attributeChanged reaction when adding an observed attribute define_new_custom_element is not defined +FAIL the stringifier of DOMTokenList must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL the stringifier of DOMTokenList must enqueue an attributeChanged reaction when mutating the value of an observed attribute define_new_custom_element is not defined +FAIL the stringifier of DOMTokenList must not enqueue an attributeChanged reaction when mutating the value of an unobserved attribute define_new_custom_element is not defined +FAIL the stringifier of DOMTokenList must enqueue an attributeChanged reaction when the setter is called with the original value of the attribute define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Document-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Document-expected.txt new file mode 100644 index 0000000..000c261 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Document-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on Document interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Element-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Element-expected.txt new file mode 100644 index 0000000..5e3a720 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Element-expected.txt
@@ -0,0 +1,44 @@ +This is a testharness.js-based test. +FAIL id on Element must enqueue an attributeChanged reaction when adding id content attribute define_new_custom_element is not defined +FAIL id on Element must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL className on Element must enqueue an attributeChanged reaction when adding class content attribute define_new_custom_element is not defined +FAIL className on Element must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL slot on Element must enqueue an attributeChanged reaction when adding slot content attribute define_new_custom_element is not defined +FAIL slot on Element must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL setAttribute on Element must enqueue an attributeChanged reaction when adding an attribute define_new_custom_element is not defined +FAIL setAttribute on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL setAttribute on Element must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL setAttribute on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL setAttributeNS on Element must enqueue an attributeChanged reaction when adding an attribute define_new_custom_element is not defined +FAIL setAttributeNS on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL setAttributeNS on Element must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL setAttributeNS on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL removeAttribute on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute define_new_custom_element is not defined +FAIL removeAttribute on Element must enqueue an attributeChanged reaction when removing an existing attribute define_new_custom_element is not defined +FAIL removeAttribute on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute define_new_custom_element is not defined +FAIL removeAttributeNS on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute define_new_custom_element is not defined +FAIL removeAttributeNS on Element must enqueue an attributeChanged reaction when removing an existing attribute define_new_custom_element is not defined +FAIL removeAttributeNS on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute define_new_custom_element is not defined +FAIL setAttributeNode on Element must enqueue an attributeChanged reaction when adding an attribute define_new_custom_element is not defined +FAIL setAttributeNode on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL setAttributeNode on Element must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL setAttributeNode on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL setAttributeNodeNS on Element must enqueue an attributeChanged reaction when adding an attribute define_new_custom_element is not defined +FAIL setAttributeNodeNS on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL setAttributeNodeNS on Element must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL setAttributeNodeNS on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL removeAttributeNode on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute define_new_custom_element is not defined +FAIL removeAttributeNode on Element must enqueue an attributeChanged reaction when removing an existing attribute define_new_custom_element is not defined +FAIL removeAttributeNode on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute define_new_custom_element is not defined +FAIL insertAdjacentElement on Element must enqueue a connected reaction define_new_custom_element is not defined +FAIL insertAdjacentElement on Element must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL innerHTML on Element must enqueue a connected reaction for a newly constructed custom element define_new_custom_element is not defined +FAIL innerHTML on Element must enqueue a attributeChanged reaction for a newly constructed custom element define_new_custom_element is not defined +FAIL innerHTML on Element must enqueue a disconnected reaction define_new_custom_element is not defined +FAIL outerHTML on Element must enqueue a connected reaction for a newly constructed custom element define_new_custom_element is not defined +FAIL outerHTML on Element must enqueue a attributeChanged reaction for a newly constructed custom element define_new_custom_element is not defined +FAIL outerHTML on Element must enqueue a disconnected reaction define_new_custom_element is not defined +FAIL insertAdjacentHTML on Element must enqueue a connected reaction for a newly constructed custom element define_new_custom_element is not defined +FAIL insertAdjacentHTML on Element must enqueue a attributeChanged reaction for a newly constructed custom element define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ElementContentEditable-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ElementContentEditable-expected.txt new file mode 100644 index 0000000..33e03d9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ElementContentEditable-expected.txt
@@ -0,0 +1,5 @@ +This is a testharness.js-based test. +FAIL contentEditable on ElementContentEditable must enqueue an attributeChanged reaction when adding contenteditable content attribute define_new_custom_element is not defined +FAIL contentEditable on ElementContentEditable must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLAnchorElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLAnchorElement-expected.txt new file mode 100644 index 0000000..715e2b1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLAnchorElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLAnchorElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLElement-expected.txt new file mode 100644 index 0000000..3445b7d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLElement-expected.txt
@@ -0,0 +1,23 @@ +This is a testharness.js-based test. +FAIL title on HTMLElement must enqueue an attributeChanged reaction when adding title content attribute define_new_custom_element is not defined +FAIL title on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL lang on HTMLElement must enqueue an attributeChanged reaction when adding lang content attribute define_new_custom_element is not defined +FAIL lang on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL translate on HTMLElement must enqueue an attributeChanged reaction when adding translate content attribute define_new_custom_element is not defined +FAIL translate on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL dir on HTMLElement must enqueue an attributeChanged reaction when adding dir content attribute define_new_custom_element is not defined +FAIL dir on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL hidden on HTMLElement must enqueue an attributeChanged reaction when adding hidden content attribute define_new_custom_element is not defined +FAIL hidden on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL tabIndex on HTMLElement must enqueue an attributeChanged reaction when adding tabindex content attribute define_new_custom_element is not defined +FAIL tabIndex on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL accessKey on HTMLElement must enqueue an attributeChanged reaction when adding accesskey content attribute define_new_custom_element is not defined +FAIL accessKey on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL draggable on HTMLElement must enqueue an attributeChanged reaction when adding draggable content attribute define_new_custom_element is not defined +FAIL draggable on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL spellcheck on HTMLElement must enqueue an attributeChanged reaction when adding spellcheck content attribute define_new_custom_element is not defined +FAIL spellcheck on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL innerText on HTMLElement must enqueue a disconnected reaction define_new_custom_element is not defined +FAIL outerText on HTMLElement must enqueue a disconnected reaction define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOptionElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOptionElement-expected.txt new file mode 100644 index 0000000..a554192 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOptionElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLOptionElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOptionsCollection-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOptionsCollection-expected.txt new file mode 100644 index 0000000..ab172573 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOptionsCollection-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLOptionsCollection interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOutputElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOutputElement-expected.txt new file mode 100644 index 0000000..a6cf394 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLOutputElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLOutputElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLSelectElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLSelectElement-expected.txt new file mode 100644 index 0000000..2e24913 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLSelectElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLSelectElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableElement-expected.txt new file mode 100644 index 0000000..9d06692 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLTableElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableRowElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableRowElement-expected.txt new file mode 100644 index 0000000..208b20d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableRowElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLTableRowElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableSectionElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableSectionElement-expected.txt new file mode 100644 index 0000000..fa80715 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTableSectionElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLTableSectionElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTitleElement-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTitleElement-expected.txt new file mode 100644 index 0000000..a62831e --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/HTMLTitleElement-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on HTMLTitleElement interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/NamedNodeMap-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/NamedNodeMap-expected.txt new file mode 100644 index 0000000..13044816 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/NamedNodeMap-expected.txt
@@ -0,0 +1,17 @@ +This is a testharness.js-based test. +FAIL setNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when adding an attribute define_new_custom_element is not defined +FAIL setNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL setNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL setNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when adding an attribute define_new_custom_element is not defined +FAIL setNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when adding an unobserved attribute define_new_custom_element is not defined +FAIL setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL removeNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when removing an unobserved attribute define_new_custom_element is not defined +FAIL removeNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when removing an existing attribute define_new_custom_element is not defined +FAIL removeNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when removing an existing unobserved attribute define_new_custom_element is not defined +FAIL removeNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when removing an unobserved attribute define_new_custom_element is not defined +FAIL removeNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when removing an existing attribute define_new_custom_element is not defined +FAIL removeNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when removing an existing unobserved attribute define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Node-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Node-expected.txt new file mode 100644 index 0000000..11e3580 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Node-expected.txt
@@ -0,0 +1,17 @@ +This is a testharness.js-based test. +FAIL nodeValue on Node must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL nodeValue on Node must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL textContent on Node must enqueue an attributeChanged reaction when replacing an existing attribute define_new_custom_element is not defined +FAIL textContent on Node must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute define_new_custom_element is not defined +FAIL cloneNode on Node must enqueue an attributeChanged reaction when cloning an element with an observed attribute define_new_custom_element is not defined +FAIL cloneNode on Node must not enqueue an attributeChanged reaction when cloning an element with an unobserved attribute define_new_custom_element is not defined +FAIL cloneNode on Node must enqueue an attributeChanged reaction when cloning an element only for observed attributes define_new_custom_element is not defined +FAIL insertBefore on ChildNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL insertBefore on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL appendChild on ChildNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL appendChild on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL replaceChild on ChildNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL replaceChild on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL removeChild on ChildNode must enqueue a disconnected reaction define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ParentNode-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ParentNode-expected.txt new file mode 100644 index 0000000..213bc15 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ParentNode-expected.txt
@@ -0,0 +1,7 @@ +This is a testharness.js-based test. +FAIL prepend on ParentNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL prepend on ParentNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL append on ParentNode must enqueue a connected reaction define_new_custom_element is not defined +FAIL append on ParentNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Range-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Range-expected.txt new file mode 100644 index 0000000..56db8c7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Range-expected.txt
@@ -0,0 +1,13 @@ +This is a testharness.js-based test. +FAIL deleteContents on Range must enqueue a disconnected reaction define_new_custom_element is not defined +FAIL extractContents on Range must enqueue a disconnected reaction define_new_custom_element is not defined +FAIL cloneContents on Range must enqueue an attributeChanged reaction when cloning an element with an observed attribute define_new_custom_element is not defined +FAIL cloneContents on Range must not enqueue an attributeChanged reaction when cloning an element with an unobserved attribute define_new_custom_element is not defined +FAIL cloneContents on Range must enqueue an attributeChanged reaction when cloning an element only for observed attributes define_new_custom_element is not defined +FAIL insertNode on Range must enqueue a connected reaction define_new_custom_element is not defined +FAIL insertNode on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL surroundContents on Range must enqueue a connected reaction define_new_custom_element is not defined +FAIL surroundContents on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document define_new_custom_element is not defined +FAIL createContextualFragment on Range must construct a custom element define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Selection-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Selection-expected.txt new file mode 100644 index 0000000..3c6fcd5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/Selection-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL deleteFromDocument on Selection must enqueue a disconnected reaction define_new_custom_element is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ShadowRoot-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ShadowRoot-expected.txt new file mode 100644 index 0000000..0af7b628 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/ShadowRoot-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions on ShadowRoot interface Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/with-exceptions-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/with-exceptions-expected.txt new file mode 100644 index 0000000..cfa873d9 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/reactions/with-exceptions-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: CEReactions interaction with exceptions Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/resources/navigation-destination.html b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/resources/navigation-destination.html new file mode 100644 index 0000000..50e28f0 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/resources/navigation-destination.html
@@ -0,0 +1,9 @@ +<!DOCTYPE html> + <html> + <body> + <p>Navigated!</p> + <script> + parent.postMessage('didNavigate', '*'); + </script> + </body> + </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/throw-on-dynamic-markup-insertion-counter-construct.html b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/throw-on-dynamic-markup-insertion-counter-construct.html new file mode 100644 index 0000000..b8f00aa --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/throw-on-dynamic-markup-insertion-counter-construct.html
@@ -0,0 +1,117 @@ +<!DOCTYPE html> + <html> + <head> + <title>Custom Elements: create an element for a token must increment and decrement document's throw-on-dynamic-markup-insertion counter</title> + <meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> + <meta name="assert" content="Invoking document.open, document.write, document.writeln, and document.write must throw an exception when the HTML parser is creating a custom element for a token"> + <meta name="help" content="https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token"> + <meta name="help" content="https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#throw-on-dynamic-markup-insertion-counter"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="/resources/custom-elements-helpers.js"></script> + </head> + <body> + <div id="log"></div> + <script> + + async function construct_custom_element_in_parser(test, call_function) + { + const window = await create_window_in_test(test); + const document = window.document; + + document.open(); + + let executed = false; + let exception = null; + class CustomElement extends window.HTMLElement { + constructor() { + super(); + try { + call_function(document, window); + } catch (error) { + exception = error; + } + executed = true; + } + } + window.customElements.define('some-element', CustomElement); + + document.write('<!DOCTYPE html><html><body><some-element></some-element></body></html>'); + document.close(); + + assert_true(executed, 'Must synchronously instantiate a custom element'); + return {window, document, exception}; + } + + promise_test(async function () { + const result = await construct_custom_element_in_parser(this, (document) => document.open()); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); + }, 'document.open() must throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const result = await construct_custom_element_in_parser(this, (document) => document.open('text/html')); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); + }, 'document.open("text/html") must throw an InvalidStateError when synchronously constructing a custom element'); + + // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-open-window + promise_test(async function () { + let load_promise = new Promise((resolve) => window.onmessage = (event) => resolve(event.data)); + const result = await construct_custom_element_in_parser(this, (document, window) => document.open('resources/navigation-destination.html', '_self', '')); + assert_equals(result.exception, null); + assert_equals(await load_promise, 'didNavigate'); + }, 'document.open(URL) must NOT throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const result = await construct_custom_element_in_parser(this, (document) => document.close()); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); + }, 'document.close() must throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const result = await construct_custom_element_in_parser(this, (document) => document.write('<b>some text</b>')); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); + assert_equals(result.document.querySelector('b'), null, 'Must not insert new content'); + assert_false(result.document.documentElement.innerHTML.includes('some text'), 'Must not insert new content'); + }, 'document.write must throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const result = await construct_custom_element_in_parser(this, (document) => document.writeln('<b>some text</b>')); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); + assert_equals(result.document.querySelector('b'), null, 'Must not insert new content'); + assert_false(result.document.documentElement.innerHTML.includes('some text'), 'Must not insert new content'); + }, 'document.writeln must throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await construct_custom_element_in_parser(this, (document) => another_window.document.open()); + assert_equals(result.exception, null); + }, 'document.open() of another document must not throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await construct_custom_element_in_parser(this, (document) => another_window.document.open('text/html')); + assert_equals(result.exception, null); + }, 'document.open("text/html") of another document must not throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await construct_custom_element_in_parser(this, (document) => another_window.document.close()); + assert_equals(result.exception, null); + }, 'document.close() of another document must not throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await construct_custom_element_in_parser(this, (document) => another_window.document.write('<b>some text</b>')); + assert_equals(result.exception, null); + assert_equals(another_window.document.querySelector('b').outerHTML, '<b>some text</b>'); + }, 'document.write of another document must not throw an InvalidStateError when synchronously constructing a custom element'); + + promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await construct_custom_element_in_parser(this, (document) => another_window.document.writeln('<b>some text</b>')); + assert_equals(result.exception, null); + assert_equals(another_window.document.querySelector('b').outerHTML, '<b>some text</b>'); + }, 'document.writeln of another document must not throw an InvalidStateError when synchronously constructing a custom element'); + + </script> + </body> + </html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/throw-on-dynamic-markup-insertion-counter-reactions.html b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/throw-on-dynamic-markup-insertion-counter-reactions.html new file mode 100644 index 0000000..addcdf3c --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/throw-on-dynamic-markup-insertion-counter-reactions.html
@@ -0,0 +1,117 @@ +<!DOCTYPE html> +<html> +<head> +<title>Custom Elements: create an element for a token must increment and decrement document's throw-on-dynamic-markup-insertion counter</title> +<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org"> +<meta name="assert" content="Invoking document.open, document.write, document.writeln, and document.write must throw an exception when the HTML parser is creating a custom element for a token"> + <meta name="help" content="https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token"> +<meta name="help" content="https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#throw-on-dynamic-markup-insertion-counter"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/custom-elements-helpers.js"></script> +</head> +<body> +<div id="log"></div> +<script> + +async function custom_element_reactions_in_parser(test, call_function) +{ + const window = await create_window_in_test(test); + const document = window.document; + + document.open(); + + let executed = false; + let exception = null; + class CustomElement extends window.HTMLElement { + attributeChangedCallback(name, oldValue, newValue) { + try { + call_function(document, window); + } catch (error) { + exception = error; + } + executed = true; + } + } + CustomElement.observedAttributes = ['title']; + window.customElements.define('some-element', CustomElement); + + document.write('<!DOCTYPE html><html><body><some-element title="some title"></some-element></body></html>'); + document.close(); + + assert_true(executed, 'Must immediately process custom element reactions for setting attributes'); + return {frameElement, window, document, exception}; +} + +promise_test(async function () { + const result = await custom_element_reactions_in_parser(this, (document) => document.open()); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); +}, 'document.open() must throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const result = await custom_element_reactions_in_parser(this, (document) => document.open('text/html')); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); +}, 'document.open("text/html") must throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +// https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-document-open-window +promise_test(async function () { + let load_promise = new Promise((resolve) => window.onmessage = (event) => resolve(event.data)); + const result = await custom_element_reactions_in_parser(this, (document, window) => document.open('resources/navigation-destination.html', '_self', '')); + assert_equals(result.exception, null); + assert_equals(await load_promise, 'didNavigate'); +}, 'document.open(URL) must NOT throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const result = await custom_element_reactions_in_parser(this, (document) => document.close()); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); +}, 'document.close() must throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const result = await custom_element_reactions_in_parser(this, (document) => document.write('<b>some text</b>')); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); + assert_equals(result.document.querySelector('b'), null, 'Must not insert new content'); + assert_false(result.document.documentElement.innerHTML.includes('some text'), 'Must not insert new content'); +}, 'document.write must throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const result = await custom_element_reactions_in_parser(this, (document) => document.writeln('<b>some text</b>')); + assert_throws('InvalidStateError', () => { throw result.exception; }, 'Must throw an InvalidStateError'); + assert_equals(result.document.querySelector('b'), null, 'Must not insert new content'); + assert_false(result.document.documentElement.innerHTML.includes('some text'), 'Must not insert new content'); +}, 'document.writeln must throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await custom_element_reactions_in_parser(this, (document) => another_window.document.open()); + assert_equals(result.exception, null); +}, 'document.open() of another document must not throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await custom_element_reactions_in_parser(this, (document) => another_window.document.open('text/html')); + assert_equals(result.exception, null); +}, 'document.open("text/html") of another document must not throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await custom_element_reactions_in_parser(this, (document) => another_window.document.close()); + assert_equals(result.exception, null); +}, 'document.close() of another document must not throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await custom_element_reactions_in_parser(this, (document) => another_window.document.write('<b>some text</b>')); + assert_equals(result.exception, null); + assert_equals(another_window.document.querySelector('b').outerHTML, '<b>some text</b>'); +}, 'document.write of another document must not throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +promise_test(async function () { + const another_window = await create_window_in_test(this); + const result = await custom_element_reactions_in_parser(this, (document) => another_window.document.writeln('<b>some text</b>')); + assert_equals(result.exception, null); + assert_equals(another_window.document.querySelector('b').outerHTML, '<b>some text</b>'); +}, 'document.writeln of another document must not throw an InvalidStateError when processing custom element reactions for a synchronous constructed custom element'); + +</script> +</body> +</html>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/upgrading-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/upgrading-expected.txt new file mode 100644 index 0000000..0255ad2d --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/upgrading-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Custom Elements: Enqueue a custom element upgrade reaction Uncaught ReferenceError: document_types is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/upgrading/Document-importNode-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/upgrading/Document-importNode-expected.txt new file mode 100644 index 0000000..a8801106 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/upgrading/Document-importNode-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL Document-importNode Uncaught ReferenceError: test_with_window is not defined +Harness: the test ran to completion. +
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html index 92d499b..b3e43c7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html
@@ -26,7 +26,9 @@ elem.addEventListener('load', () => { trusted_click(t, () => { elem.contentWindow.postMessage({"action": "report"}, "*"); - }, document.body); + }, elem.contentDocument.body); + // TODO(mustaq): The click above should activate the subframe. But + // elem.contentDocument is inaccessible (null) from a cross origin parent! }); }); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.tentative.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.tentative.html new file mode 100644 index 0000000..66d9c431 --- /dev/null +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-ready-check-containing-iframe-manual.tentative.html
@@ -0,0 +1,29 @@ +<!DOCTYPE html> +<!-- + Tentative, due to: + https://github.com/whatwg/html/issues/1903 + Once the issue is resolved, this test would replace the corresponding + non-tentative test (element-ready-check-containing-iframe-manual.html) +--> +<title>Element ready check for containing iframe</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../trusted-click.js"></script> +<div id="log"></div> +<iframe allowfullscreen></iframe> +<iframe allowfullscreen></iframe> +<script> +// wait for load event to avoid https://bugzil.la/1493878 +window.onload = function() { + async_test(function(t) { + var iframes = document.getElementsByTagName("iframe"); + trusted_request(t, iframes[0].contentDocument.body, iframes[0].contentDocument.body); + iframes[0].contentDocument.onfullscreenchange = t.step_func(function() { + assert_equals(document.fullscreenElement, iframes[0]); + trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body); + iframes[1].contentDocument.onfullscreenchange = t.unreached_func("fullscreenchange event"); + iframes[1].contentDocument.onfullscreenerror = t.step_func_done(); + }); + }); +}; +</script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-two-iframes-manual.html b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-two-iframes-manual.html index 94b38c0..df5ee2a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-two-iframes-manual.html +++ b/third_party/WebKit/LayoutTests/external/wpt/fullscreen/api/element-request-fullscreen-two-iframes-manual.html
@@ -21,19 +21,27 @@ assert_in_array(document.fullscreenElement, [a, b]); order.push(document.fullscreenElement.id); if (order.length == 2) { - // Since fullscreenchange event occurs at animation frame timing we might - // have not seen the transition from null -> 'b' but just see the - // resulting 'a' transition twice. + // When the second event arrived, the fullscreen element may still be the + // old one. + // + // TODO(mustaq): We need a better explanation here to cover the tree-order + // idea of the spec. assert_true(order[0] == 'a' || order[0] == 'b', 'first id seen is a or b'); - assert_true(order[1] == 'a', 'second id seen is b'); + assert_true(order[1] == 'a', 'second id seen is a'); t.done(); } }); document.onfullscreenerror = t.unreached_func('fullscreenerror event'); + // Make a trusted click on frame 'b' to activate it. trusted_click(t, () => { - b.contentDocument.body.requestFullscreen(); - a.contentDocument.body.requestFullscreen(); - }, document.body); + // Now queue a trusted click on frame 'a' to make back-to-back calls. + setTimeout(() => { + trusted_click(t, () => { + b.contentDocument.body.requestFullscreen(); + a.contentDocument.body.requestFullscreen(); + }, a.contentDocument.body); + }, 0); + }, b.contentDocument.body); }); </script>
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/allowed-to-play.html.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/allowed-to-play.html.ini index ef6b2edc..c9fbabede 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/allowed-to-play.html.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/allowed-to-play.html.ini
@@ -1,8 +1,8 @@ [allowed-to-play.html] expected: - if product == "safari" or product == "safari_webdriver": ERROR # https://bugs.webkit.org/show_bug.cgi?id=190775 + if product == "safari": ERROR # https://bugs.webkit.org/show_bug.cgi?id=190775 [<audio> autoplay] expected: - if product == "safari" or product == "safari_webdriver": FAIL # https://bugs.webkit.org/show_bug.cgi?id=190775 + if product == "safari": FAIL # https://bugs.webkit.org/show_bug.cgi?id=190775
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/html-elements.html.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/html-elements.html.ini index 7751a227..b7303c6 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/html-elements.html.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/assumptions/html-elements.html.ini
@@ -1,9 +1,9 @@ [html-elements.html] [Compare CSS span definitions (only valid if pre-reqs pass)] expected: - if product == "safari" or product == "safari_webdriver": FAIL # https://webkit.org/show_bug.cgi?id=187052 + if product == "safari": FAIL # https://webkit.org/show_bug.cgi?id=187052 [Compare CSS div definitions (only valid if pre-reqs pass)] expected: - if product == "safari" or product == "safari_webdriver": FAIL # https://webkit.org/show_bug.cgi?id=187052 + if product == "safari": FAIL # https://webkit.org/show_bug.cgi?id=187052
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/context.any.js.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/context.any.js.ini index 30d04b3..f985548 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/context.any.js.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/context.any.js.ini
@@ -1,4 +1,4 @@ [context.any.sharedworker.html] [context] expected: - if product == "safari" or product == "safari_webdriver": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850 + if product == "safari": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/order-of-metas.any.js.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/order-of-metas.any.js.ini index 39bc089..b296462 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/order-of-metas.any.js.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/order-of-metas.any.js.ini
@@ -1,4 +1,4 @@ [order-of-metas.any.sharedworker.html] [foo] expected: - if product == "safari" or product == "safari_webdriver": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850 + if product == "safari": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/secure-context.https.any.js.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/secure-context.https.any.js.ini index f2737bf..272935a 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/secure-context.https.any.js.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/secure-context.https.any.js.ini
@@ -1,4 +1,4 @@ [secure-context.https.any.sharedworker.html] [secure-context] expected: - if product == "safari" or product == "safari_webdriver": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850 + if product == "safari": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/title.any.js.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/title.any.js.ini index f2e268d..6852b8033 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/title.any.js.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/server/title.any.js.ini
@@ -1,4 +1,4 @@ [title.any.sharedworker.html] [foobar] expected: - if product == "safari" or product == "safari_webdriver": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850 + if product == "safari": FAIL # https://bugs.webkit.org/show_bug.cgi?id=149850
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini index 6644d52d..f751532 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementPosition.html.ini
@@ -1,3 +1,3 @@ [elementPosition.html] expected: - if product == "chrome" or product == "safari" or product == "safari_webdriver": ERROR + if product == "chrome" or product == "safari": ERROR
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementTiming.html.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementTiming.html.ini index 85dbe11..a1e9ea8 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementTiming.html.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/elementTiming.html.ini
@@ -1,3 +1,3 @@ [elementTiming.html] expected: - if product == "chrome" or product == "safari" or product == "safari_webdriver": ERROR + if product == "chrome" or product == "safari": ERROR
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/eventOrder.html.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/eventOrder.html.ini index bfb5c0a..64f3f2f8 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/eventOrder.html.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/eventOrder.html.ini
@@ -1,3 +1,3 @@ [eventOrder.html] expected: - if product == "chrome" or product == "safari" or product == "safari_webdriver": ERROR + if product == "chrome" or product == "safari": ERROR
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/multiDevice.html.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/multiDevice.html.ini index 642d0cd..b9fb259 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/multiDevice.html.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/multiDevice.html.ini
@@ -1,3 +1,3 @@ [multiDevice.html] expected: - if product == "chrome" or product == "safari" or product == "safari_webdriver": ERROR + if product == "chrome" or product == "safari": ERROR
diff --git a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/pause.html.ini b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/pause.html.ini index 594f22d2..3b0d6fa 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/pause.html.ini +++ b/third_party/WebKit/LayoutTests/external/wpt/infrastructure/metadata/infrastructure/testdriver/actions/pause.html.ini
@@ -1,3 +1,3 @@ [pause.html] expected: - if product == "chrome" or product == "safari" or product == "safari_webdriver": ERROR + if product == "chrome" or product == "safari": ERROR
diff --git a/third_party/WebKit/LayoutTests/external/wpt/interfaces/media-capabilities.idl b/third_party/WebKit/LayoutTests/external/wpt/interfaces/media-capabilities.idl index 816949c..8721b1c7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/interfaces/media-capabilities.idl +++ b/third_party/WebKit/LayoutTests/external/wpt/interfaces/media-capabilities.idl
@@ -10,6 +10,7 @@ dictionary MediaDecodingConfiguration : MediaConfiguration { required MediaDecodingType type; + MediaCapabilitiesKeySystemConfiguration keySystemConfiguration; }; dictionary MediaEncodingConfiguration : MediaConfiguration { @@ -41,11 +42,25 @@ unsigned long samplerate; }; -[Exposed=(Window, Worker)] -interface MediaCapabilitiesInfo { - readonly attribute boolean supported; - readonly attribute boolean smooth; - readonly attribute boolean powerEfficient; +dictionary MediaCapabilitiesKeySystemConfiguration { + required DOMString keySystem; + DOMString initDataType = ""; + DOMString audioRobustness = ""; + DOMString videoRobustness = ""; + MediaKeysRequirement distinctiveIdentifier = "optional"; + MediaKeysRequirement persistentState = "optional"; + sequence<DOMString> sessionTypes; + }; + +dictionary MediaCapabilitiesInfo { + required boolean supported; + required boolean smooth; + required boolean powerEfficient; + +}; + +dictionary MediaCapabilitiesDecodingInfo : MediaCapabilitiesInfo { + required MediaKeySystemAccess keySystemAccess; }; [Exposed=Window] @@ -60,7 +75,7 @@ [Exposed=(Window, Worker)] interface MediaCapabilities { - [NewObject] Promise<MediaCapabilitiesInfo> decodingInfo(MediaDecodingConfiguration configuration); + [NewObject] Promise<MediaCapabilitiesDecodingInfo> decodingInfo(MediaDecodingConfiguration configuration); [NewObject] Promise<MediaCapabilitiesInfo> encodingInfo(MediaEncodingConfiguration configuration); };
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html index 982bc1746..cb14e2b 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/decodingInfo.html
@@ -283,9 +283,9 @@ video: minimalVideoConfiguration, audio: minimalAudioConfiguration, }).then(ability => { - assert_idl_attribute(ability, 'supported'); - assert_idl_attribute(ability, 'smooth'); - assert_idl_attribute(ability, 'powerEfficient'); + assert_equals(typeof ability.supported, "boolean"); + assert_equals(typeof ability.smooth, "boolean"); + assert_equals(typeof ability.powerEfficient, "boolean"); }); }, "Test that decodingInfo returns a valid MediaCapabilitiesInfo objects");
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo.html b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo.html index 5c0e318..751146c 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo.html +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/encodingInfo.html
@@ -1,5 +1,5 @@ <!DOCTYPE html> -<title>MediaCapabilities.decodingInfo()</title> +<title>MediaCapabilities.encodingInfo()</title> <script src=/resources/testharness.js></script> <script src="/resources/testharnessreport.js"></script> <script> @@ -283,9 +283,9 @@ video: minimalVideoConfiguration, audio: minimalAudioConfiguration, }).then(ability => { - assert_idl_attribute(ability, 'supported'); - assert_idl_attribute(ability, 'smooth'); - assert_idl_attribute(ability, 'powerEfficient'); + assert_equals(typeof ability.supported, "boolean"); + assert_equals(typeof ability.smooth, "boolean"); + assert_equals(typeof ability.powerEfficient, "boolean"); }); }, "Test that encodingInfo returns a valid MediaCapabilitiesInfo objects");
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness-expected.txt index 680d20f..f22e0fe 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness-expected.txt
@@ -16,18 +16,6 @@ PASS Unscopable handled correctly for luminance property on Screen FAIL Screen interface: attribute onchange assert_true: The prototype object must have a property "onchange" expected true got false PASS Unscopable handled correctly for onchange property on Screen -PASS MediaCapabilitiesInfo interface: existence and properties of interface object -PASS MediaCapabilitiesInfo interface object length -PASS MediaCapabilitiesInfo interface object name -PASS MediaCapabilitiesInfo interface: existence and properties of interface prototype object -PASS MediaCapabilitiesInfo interface: existence and properties of interface prototype object's "constructor" property -PASS MediaCapabilitiesInfo interface: existence and properties of interface prototype object's @@unscopables property -PASS MediaCapabilitiesInfo interface: attribute supported -PASS Unscopable handled correctly for supported property on MediaCapabilitiesInfo -PASS MediaCapabilitiesInfo interface: attribute smooth -PASS Unscopable handled correctly for smooth property on MediaCapabilitiesInfo -PASS MediaCapabilitiesInfo interface: attribute powerEfficient -PASS Unscopable handled correctly for powerEfficient property on MediaCapabilitiesInfo PASS MediaCapabilities interface: existence and properties of interface object PASS MediaCapabilities interface object length PASS MediaCapabilities interface object name
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any-expected.txt index b7140a9..55528510 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any-expected.txt
@@ -1,5 +1,4 @@ This is a testharness.js-based test. -Found 63 tests; 43 PASS, 20 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idlharness PASS idl_test setup PASS Partial interface Navigator: original interface defined @@ -7,25 +6,6 @@ PASS Partial interface WorkerNavigator: original interface defined PASS Partial interface WorkerNavigator: valid exposure set PASS Partial interface Screen: original interface defined -PASS MediaCapabilitiesInfo interface: existence and properties of interface object -PASS MediaCapabilitiesInfo interface object length -PASS MediaCapabilitiesInfo interface object name -PASS MediaCapabilitiesInfo interface: existence and properties of interface prototype object -PASS MediaCapabilitiesInfo interface: existence and properties of interface prototype object's "constructor" property -PASS MediaCapabilitiesInfo interface: existence and properties of interface prototype object's @@unscopables property -PASS MediaCapabilitiesInfo interface: attribute supported -PASS MediaCapabilitiesInfo interface: attribute smooth -PASS MediaCapabilitiesInfo interface: attribute powerEfficient -PASS MediaCapabilitiesInfo must be primary interface of decodingInfo -PASS Stringification of decodingInfo -PASS MediaCapabilitiesInfo interface: decodingInfo must inherit property "supported" with the proper type -PASS MediaCapabilitiesInfo interface: decodingInfo must inherit property "smooth" with the proper type -PASS MediaCapabilitiesInfo interface: decodingInfo must inherit property "powerEfficient" with the proper type -PASS MediaCapabilitiesInfo must be primary interface of encodingInfo -PASS Stringification of encodingInfo -PASS MediaCapabilitiesInfo interface: encodingInfo must inherit property "supported" with the proper type -PASS MediaCapabilitiesInfo interface: encodingInfo must inherit property "smooth" with the proper type -PASS MediaCapabilitiesInfo interface: encodingInfo must inherit property "powerEfficient" with the proper type PASS MediaCapabilities interface: existence and properties of interface object PASS MediaCapabilities interface object length PASS MediaCapabilities interface object name
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.js b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.js index bd20d5b4..6da5c7d 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.js +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.js
@@ -6,26 +6,6 @@ 'use strict'; promise_test(async () => { - try { - const video = { - contentType: 'video/webm; codecs="vp09.00.10.08"', - width: 800, - height: 600, - bitrate: 3000, - framerate: 24, - }; - self.decodingInfo = await navigator.mediaCapabilities.decodingInfo({ - type: 'file', - video: video, - }); - self.encodingInfo = await navigator.mediaCapabilities.encodingInfo({ - type: 'record', - video: video - }); - } catch (e) { - // Will be surfaced when encodingInfo/decodingInfo is undefined below. - } - idl_test( ['media-capabilities'], ['html', 'cssom-view'], @@ -37,7 +17,6 @@ } idl_array.add_objects({ MediaCapabilities: ['navigator.mediaCapabilities'], - MediaCapabilitiesInfo: ['decodingInfo', 'encodingInfo'], Screen: ['screen'], ScreenLuminance: ['screen.luminance'], });
diff --git a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.worker-expected.txt b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.worker-expected.txt index 5aeee8b..800cf7e7 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.worker-expected.txt +++ b/third_party/WebKit/LayoutTests/external/wpt/media-capabilities/idlharness.any.worker-expected.txt
@@ -1,5 +1,4 @@ This is a testharness.js-based test. -Found 53 tests; 10 PASS, 43 FAIL, 0 TIMEOUT, 0 NOTRUN. PASS idlharness PASS idl_test setup PASS Partial interface Navigator: original interface defined @@ -7,25 +6,6 @@ PASS Partial interface WorkerNavigator: original interface defined PASS Partial interface WorkerNavigator: valid exposure set PASS Partial interface Screen: original interface defined -FAIL MediaCapabilitiesInfo interface: existence and properties of interface object assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface object length assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface object name assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface: existence and properties of interface prototype object assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface: attribute supported assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface: attribute smooth assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo interface: attribute powerEfficient assert_own_property: self does not have own property "MediaCapabilitiesInfo" expected property "MediaCapabilitiesInfo" missing -FAIL MediaCapabilitiesInfo must be primary interface of decodingInfo assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: decodingInfo is not defined" -FAIL Stringification of decodingInfo assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: decodingInfo is not defined" -FAIL MediaCapabilitiesInfo interface: decodingInfo must inherit property "supported" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: decodingInfo is not defined" -FAIL MediaCapabilitiesInfo interface: decodingInfo must inherit property "smooth" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: decodingInfo is not defined" -FAIL MediaCapabilitiesInfo interface: decodingInfo must inherit property "powerEfficient" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: decodingInfo is not defined" -FAIL MediaCapabilitiesInfo must be primary interface of encodingInfo assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: encodingInfo is not defined" -FAIL Stringification of encodingInfo assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: encodingInfo is not defined" -FAIL MediaCapabilitiesInfo interface: encodingInfo must inherit property "supported" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: encodingInfo is not defined" -FAIL MediaCapabilitiesInfo interface: encodingInfo must inherit property "smooth" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: encodingInfo is not defined" -FAIL MediaCapabilitiesInfo interface: encodingInfo must inherit property "powerEfficient" with the proper type assert_equals: Unexpected exception when evaluating object expected null but got object "ReferenceError: encodingInfo is not defined" FAIL MediaCapabilities interface: existence and properties of interface object assert_own_property: self does not have own property "MediaCapabilities" expected property "MediaCapabilities" missing FAIL MediaCapabilities interface object length assert_own_property: self does not have own property "MediaCapabilities" expected property "MediaCapabilities" missing FAIL MediaCapabilities interface object name assert_own_property: self does not have own property "MediaCapabilities" expected property "MediaCapabilities" missing
diff --git a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/resources/custom-elements-helpers.js b/third_party/WebKit/LayoutTests/external/wpt/resources/custom-elements-helpers.js similarity index 99% rename from third_party/WebKit/LayoutTests/external/wpt/custom-elements/resources/custom-elements-helpers.js rename to third_party/WebKit/LayoutTests/external/wpt/resources/custom-elements-helpers.js index 015a698..6f73fe2 100644 --- a/third_party/WebKit/LayoutTests/external/wpt/custom-elements/resources/custom-elements-helpers.js +++ b/third_party/WebKit/LayoutTests/external/wpt/resources/custom-elements-helpers.js
@@ -4,7 +4,7 @@ f.srcdoc = srcdoc ? srcdoc : ''; f.onload = (event) => { let w = f.contentWindow; - t.add_cleanup(() => f.parentNode && f.remove()); + t.add_cleanup(() => f.remove()); resolve(w); }; document.body.appendChild(f);
diff --git a/third_party/WebKit/LayoutTests/fast/css/invalidation/firstchild-lastchild-for-multiple-node-insertion.html b/third_party/WebKit/LayoutTests/fast/css/invalidation/firstchild-lastchild-for-multiple-node-insertion.html deleted file mode 100644 index 6a5a1aa..0000000 --- a/third_party/WebKit/LayoutTests/fast/css/invalidation/firstchild-lastchild-for-multiple-node-insertion.html +++ /dev/null
@@ -1,34 +0,0 @@ -<!DOCTYPE html> -<script src="../../../resources/testharness.js"></script> -<script src="../../../resources/testharnessreport.js"></script> -<style> -div { - color: black; -} -span:first-child { - color: blue; -} -span:last-child { - color: red; -} -</style> -<div id="target"><span>first-initially</span><span>last-initially</span></div> -<script> -test(() => { - let target = document.querySelector('#target'); - let first = target.firstChild; - assert_equals(getComputedStyle(first).color, 'rgb(0, 0, 255)'); - target.insertAdjacentHTML('afterbegin', '\n<span>foo</span><span>bar</span>'); - assert_equals(getComputedStyle(target.firstElementChild).color, 'rgb(0, 0, 255)'); - assert_equals(getComputedStyle(first).color, 'rgb(0, 0, 0)'); -}, 'Adding multiple nodes at once should invalidate :first-child correctly.'); - -test(() => { - let target = document.querySelector('#target'); - let last = target.lastChild; - assert_equals(getComputedStyle(last).color, 'rgb(255, 0, 0)'); - target.insertAdjacentHTML('beforeend', '\n<span>foo</span><span>bar</span>'); - assert_equals(getComputedStyle(target.lastChild).color, 'rgb(255, 0, 0)'); - assert_equals(getComputedStyle(last).color, 'rgb(0, 0, 0)'); -}, 'Adding multiple nodes at once should invalidate :last-child correctly.'); -</script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Range/range-expand.html b/third_party/WebKit/LayoutTests/fast/dom/Range/range-expand.html index cbae6e7..2eb62da 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/Range/range-expand.html +++ b/third_party/WebKit/LayoutTests/fast/dom/Range/range-expand.html
@@ -85,6 +85,14 @@ assert_equals(actual, 'multiple lines.'); }, 'sentence11'); + // Sentence end expansion should not cross block boundaries. + test(() => { + const id = 'begin'; + const length = document.getElementById(id).firstChild.length; + const actual = expandRangeString(id, length, id, length, 'sentence', true); + assert_equals(actual, 'Each sentence begins with capital\nletter and ends with a punctuation.'); + }, 'sentence12'); + // Expand word. // Same range start and end, both at the begin of word. test(() => { @@ -218,7 +226,7 @@ } </script> <body> -<p>This is the begin of a block. A block is a collection of sentences. Each sentence begins with capital +<p id="begin">This is the begin of a block. A block is a collection of sentences. Each sentence begins with capital letter and ends with a punctuation. </p> <pre id="multilineSentence">Now, a sentence
diff --git a/third_party/WebKit/LayoutTests/fragmentation/scrolling-contents-scroll-expected.html b/third_party/WebKit/LayoutTests/fragmentation/scrolling-contents-scroll-expected.html new file mode 100644 index 0000000..ee472e7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fragmentation/scrolling-contents-scroll-expected.html
@@ -0,0 +1,13 @@ +<!doctype HTML> +<style> +::-webkit-scrollbar { + display: none; +} +</style> +<div style="column-count: 2; width: 800px; height: 300px;"> + First column. Green should show on scroll. + <div id="scroller" style="width: 400px; height: 250px; overflow-y: auto;"> + <div style="width: 300px; height: 300px; background: green"></div> + </div> + Second column. +</div>
diff --git a/third_party/WebKit/LayoutTests/fragmentation/scrolling-contents-scroll.html b/third_party/WebKit/LayoutTests/fragmentation/scrolling-contents-scroll.html new file mode 100644 index 0000000..7e2dc93 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fragmentation/scrolling-contents-scroll.html
@@ -0,0 +1,24 @@ +<!doctype HTML> +<script src="../resources/run-after-layout-and-paint.js"></script> +<style> +::-webkit-scrollbar { + display: none; +} +</style> +<div style="column-count: 2; width: 800px; height: 300px;"> + First column. Green should show on scroll. + <div id="scroller" style="width: 400px; height: 250px; overflow-y: auto;"> + <div style="width: 300px; height: 300px; background: red"></div> + <div style="width: 300px; height: 300px; background: green"></div> + </div> + Second column. +</div> +<script> + if (window.testRunner) + window.testRunner.waitUntilDone(); + runAfterLayoutAndPaint(() => { + scroller.scrollBy(0, 300); + if (window.testRunner) + window.testRunner.notifyDone(); + }); +</script>
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt deleted file mode 100644 index 798c042..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 13, 54, 19) - -
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt deleted file mode 100644 index 798c042..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/virtual/paint-touchaction-rects/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 13, 54, 19) - -
diff --git a/third_party/WebKit/LayoutTests/virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt b/third_party/WebKit/LayoutTests/virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt deleted file mode 100644 index a179388..0000000 --- a/third_party/WebKit/LayoutTests/virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 14, 54, 18) - -
diff --git a/third_party/WebKit/LayoutTests/virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt b/third_party/WebKit/LayoutTests/virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt deleted file mode 100644 index a179388..0000000 --- a/third_party/WebKit/LayoutTests/virtual/mouseevent_fractional/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 14, 54, 18) - -
diff --git a/third_party/WebKit/LayoutTests/virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt b/third_party/WebKit/LayoutTests/virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt deleted file mode 100644 index a179388..0000000 --- a/third_party/WebKit/LayoutTests/virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 14, 54, 18) - -
diff --git a/third_party/WebKit/LayoutTests/virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt b/third_party/WebKit/LayoutTests/virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt deleted file mode 100644 index a179388..0000000 --- a/third_party/WebKit/LayoutTests/virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 14, 54, 18) - -
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt index 6f2eaa7b..e74f79b 100644 --- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3722,12 +3722,6 @@ attribute @@toStringTag method constructor method decodingInfo -interface MediaCapabilitiesInfo - attribute @@toStringTag - getter powerEfficient - getter smooth - getter supported - method constructor interface MediaDeviceInfo attribute @@toStringTag getter deviceId
diff --git a/third_party/WebKit/LayoutTests/virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt b/third_party/WebKit/LayoutTests/virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt deleted file mode 100644 index a179388..0000000 --- a/third_party/WebKit/LayoutTests/virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-svg-container-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 14, 54, 18) - -
diff --git a/third_party/WebKit/LayoutTests/virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt b/third_party/WebKit/LayoutTests/virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt deleted file mode 100644 index a179388..0000000 --- a/third_party/WebKit/LayoutTests/virtual/user-activation-v2/fast/events/touch/compositor-touch-hit-rects-svg-text-expected.txt +++ /dev/null
@@ -1,3 +0,0 @@ -: #document scrolling (8, 14, 54, 18) - -
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index 8cfa741..4dc7945 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -4283,12 +4283,6 @@ method constructor method decodingInfo method encodingInfo -interface MediaCapabilitiesInfo - attribute @@toStringTag - getter powerEfficient - getter smooth - getter supported - method constructor interface MediaDeviceInfo attribute @@toStringTag getter deviceId
diff --git a/third_party/blink/public/BUILD.gn b/third_party/blink/public/BUILD.gn index 0fe6607..91496a9 100644 --- a/third_party/blink/public/BUILD.gn +++ b/third_party/blink/public/BUILD.gn
@@ -143,7 +143,9 @@ "platform/modules/installedapp/web_related_application.h", "platform/modules/installedapp/web_related_apps_fetcher.h", "platform/modules/media_capabilities/web_audio_configuration.h", + "platform/modules/media_capabilities/web_media_capabilities_callbacks.h", "platform/modules/media_capabilities/web_media_capabilities_client.h", + "platform/modules/media_capabilities/web_media_capabilities_info.h", "platform/modules/media_capabilities/web_media_configuration.h", "platform/modules/media_capabilities/web_video_configuration.h", "platform/modules/notifications/web_notification_action.h",
diff --git a/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h b/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h new file mode 100644 index 0000000..d3ea6e8b --- /dev/null +++ b/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h
@@ -0,0 +1,23 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIA_CAPABILITIES_WEB_MEDIA_CAPABILITIES_CALLBACKS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIA_CAPABILITIES_WEB_MEDIA_CAPABILITIES_CALLBACKS_H_ + +#include <memory> + +#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h" +#include "third_party/blink/public/platform/web_callbacks.h" + +namespace blink { + +using WebMediaCapabilitiesDecodingInfoCallbacks = + WebCallbacks<std::unique_ptr<WebMediaCapabilitiesInfo>, void>; + +using WebMediaCapabilitiesEncodingInfoCallbacks = + WebCallbacks<std::unique_ptr<WebMediaCapabilitiesInfo>, void>; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIA_CAPABILITIES_WEB_MEDIA_CAPABILITIES_CALLBACKS_H_
diff --git a/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h b/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h index 165392c..e0e8a13 100644 --- a/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h +++ b/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_client.h
@@ -7,7 +7,7 @@ #include <memory> -#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h" +#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h" namespace blink { @@ -20,7 +20,7 @@ virtual void DecodingInfo( const WebMediaConfiguration&, - std::unique_ptr<WebMediaCapabilitiesQueryCallbacks>) = 0; + std::unique_ptr<WebMediaCapabilitiesDecodingInfoCallbacks>) = 0; }; } // namespace blink
diff --git a/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h b/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h index cc31358de..7a15df2a 100644 --- a/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h +++ b/third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h
@@ -5,8 +5,6 @@ #ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIA_CAPABILITIES_WEB_MEDIA_CAPABILITIES_INFO_H_ #define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIA_CAPABILITIES_WEB_MEDIA_CAPABILITIES_INFO_H_ -#include "third_party/blink/public/platform/web_callbacks.h" - namespace blink { // Represents a MediaCapabilitiesInfo dictionary to be used outside of Blink. @@ -17,9 +15,6 @@ bool power_efficient = false; }; -using WebMediaCapabilitiesQueryCallbacks = - WebCallbacks<std::unique_ptr<WebMediaCapabilitiesInfo>, void>; - } // namespace blink #endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_MODULES_MEDIA_CAPABILITIES_WEB_MEDIA_CAPABILITIES_INFO_H_
diff --git a/third_party/blink/public/platform/web_media_recorder_handler.h b/third_party/blink/public/platform/web_media_recorder_handler.h index 3577b26..a918cc3 100644 --- a/third_party/blink/public/platform/web_media_recorder_handler.h +++ b/third_party/blink/public/platform/web_media_recorder_handler.h
@@ -9,7 +9,7 @@ #include "third_party/blink/public/platform/web_common.h" -#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h" +#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h" #include "third_party/blink/public/platform/web_string.h" namespace blink { @@ -54,7 +54,7 @@ // https://wicg.github.io/media-capabilities/#media-capabilities-interface virtual void EncodingInfo( const WebMediaConfiguration&, - std::unique_ptr<blink::WebMediaCapabilitiesQueryCallbacks>) {} + std::unique_ptr<blink::WebMediaCapabilitiesEncodingInfoCallbacks>) {} }; } // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/to_v8_test.cc b/third_party/blink/renderer/bindings/core/v8/to_v8_test.cc index 022abeb..1c3037b 100644 --- a/third_party/blink/renderer/bindings/core/v8/to_v8_test.cc +++ b/third_party/blink/renderer/bindings/core/v8/to_v8_test.cc
@@ -67,7 +67,7 @@ TEST(ToV8Test, garbageCollectedScriptWrappable) { V8TestingScope scope; GarbageCollectedScriptWrappable* object = - new GarbageCollectedScriptWrappable("world"); + MakeGarbageCollected<GarbageCollectedScriptWrappable>("world"); GarbageCollectedHolderForToV8Test holder(object); OffHeapGarbageCollectedHolder off_heap_holder(object); @@ -231,10 +231,10 @@ V8TestingScope scope; HeapVector<std::pair<String, Member<GarbageCollectedScriptWrappable>>> pair_heap_vector; - pair_heap_vector.push_back( - std::make_pair("one", new GarbageCollectedScriptWrappable("foo"))); - pair_heap_vector.push_back( - std::make_pair("two", new GarbageCollectedScriptWrappable("bar"))); + pair_heap_vector.push_back(std::make_pair( + "one", MakeGarbageCollected<GarbageCollectedScriptWrappable>("foo"))); + pair_heap_vector.push_back(std::make_pair( + "two", MakeGarbageCollected<GarbageCollectedScriptWrappable>("bar"))); TEST_TOV8("[object Object]", pair_heap_vector); v8::Local<v8::Context> context = scope.GetScriptState()->GetContext(); v8::Local<v8::Object> result = @@ -287,8 +287,8 @@ TEST(ToV8Test, heapVector) { V8TestingScope scope; HeapVector<Member<GarbageCollectedScriptWrappable>> v; - v.push_back(new GarbageCollectedScriptWrappable("hoge")); - v.push_back(new GarbageCollectedScriptWrappable("fuga")); + v.push_back(MakeGarbageCollected<GarbageCollectedScriptWrappable>("hoge")); + v.push_back(MakeGarbageCollected<GarbageCollectedScriptWrappable>("fuga")); v.push_back(nullptr); TEST_TOV8("hoge,fuga,", v);
diff --git a/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h b/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h index d99a786..8b1231c90 100644 --- a/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h +++ b/third_party/blink/renderer/bindings/core/v8/window_proxy_manager.h
@@ -91,9 +91,14 @@ : public WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy> { public: static LocalWindowProxyManager* Create(LocalFrame& frame) { - return new LocalWindowProxyManager(frame); + return MakeGarbageCollected<LocalWindowProxyManager>(frame); } + explicit LocalWindowProxyManager(LocalFrame& frame) + : WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy>( + frame, + FrameType::kLocal) {} + // TODO(yukishiino): Remove this method. LocalWindowProxy* MainWorldProxyMaybeUninitialized() { return static_cast<LocalWindowProxy*>(window_proxy_.Get()); @@ -102,12 +107,6 @@ // Sets the given security origin to the main world's context. Also updates // the security origin of the context for each isolated world. void UpdateSecurityOrigin(const SecurityOrigin*); - - private: - explicit LocalWindowProxyManager(LocalFrame& frame) - : WindowProxyManagerImplHelper<LocalFrame, LocalWindowProxy>( - frame, - FrameType::kLocal) {} }; class RemoteWindowProxyManager
diff --git a/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc b/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc index 8ac7192..c1d68eb9 100644 --- a/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc +++ b/third_party/blink/renderer/controller/dev_tools_frontend_impl.cc
@@ -47,8 +47,8 @@ mojom::blink::DevToolsFrontendAssociatedRequest request) { if (!local_frame) return; - local_frame->ProvideSupplement( - new DevToolsFrontendImpl(*local_frame, std::move(request))); + local_frame->ProvideSupplement(MakeGarbageCollected<DevToolsFrontendImpl>( + *local_frame, std::move(request))); } // static
diff --git a/third_party/blink/renderer/controller/dev_tools_frontend_impl.h b/third_party/blink/renderer/controller/dev_tools_frontend_impl.h index a2db8e68..b5777f2 100644 --- a/third_party/blink/renderer/controller/dev_tools_frontend_impl.h +++ b/third_party/blink/renderer/controller/dev_tools_frontend_impl.h
@@ -61,13 +61,13 @@ mojom::blink::DevToolsFrontendAssociatedRequest); static DevToolsFrontendImpl* From(LocalFrame*); + DevToolsFrontendImpl(LocalFrame&, + mojom::blink::DevToolsFrontendAssociatedRequest); ~DevToolsFrontendImpl() override; void DidClearWindowObject(); void Trace(blink::Visitor*) override; private: - DevToolsFrontendImpl(LocalFrame&, - mojom::blink::DevToolsFrontendAssociatedRequest); void DestroyOnHostGone(); // mojom::blink::DevToolsFrontend implementation.
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 6274aab..65e9ae3 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -4,16 +4,16 @@ import("//build/config/chromecast_build.gni") import("//build/config/compiler/compiler.gni") -import("//build/toolchain/toolchain.gni") import("//build/config/ui.gni") import("//build/split_static_library.gni") +import("//build/toolchain/toolchain.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//third_party/blink/renderer/bindings/bindings.gni") import("//third_party/blink/renderer/bindings/modules/v8/generated.gni") import("//third_party/blink/renderer/bindings/scripts/scripts.gni") +import("//third_party/blink/renderer/build/scripts/scripts.gni") import("//third_party/blink/renderer/config.gni") import("//third_party/blink/renderer/core/core.gni") -import("//third_party/blink/renderer/build/scripts/scripts.gni") import("//third_party/blink/renderer/modules/modules_idl_files.gni") import("//third_party/blink/renderer/platform/platform_generated.gni") import("//third_party/protobuf/proto_library.gni") @@ -1991,6 +1991,7 @@ "layout/collapsed_border_value_test.cc", "layout/custom/layout_worklet_test.cc", "layout/grid_test.cc", + "layout/jank_region_test.cc", "layout/jank_tracker_test.cc", "layout/layout_block_test.cc", "layout/layout_box_model_object_test.cc",
diff --git a/third_party/blink/renderer/core/animation/inert_effect.cc b/third_party/blink/renderer/core/animation/inert_effect.cc index 7d82f71..d8d601b 100644 --- a/third_party/blink/renderer/core/animation/inert_effect.cc +++ b/third_party/blink/renderer/core/animation/inert_effect.cc
@@ -38,7 +38,8 @@ const Timing& timing, bool paused, double inherited_time) { - return new InertEffect(effect, timing, paused, inherited_time); + return MakeGarbageCollected<InertEffect>(effect, timing, paused, + inherited_time); } InertEffect::InertEffect(KeyframeEffectModelBase* model,
diff --git a/third_party/blink/renderer/core/animation/inert_effect.h b/third_party/blink/renderer/core/animation/inert_effect.h index c5d52dc..b622198 100644 --- a/third_party/blink/renderer/core/animation/inert_effect.h +++ b/third_party/blink/renderer/core/animation/inert_effect.h
@@ -46,6 +46,12 @@ const Timing&, bool paused, double inherited_time); + + InertEffect(KeyframeEffectModelBase*, + const Timing&, + bool paused, + double inherited_time); + void Sample(HeapVector<Member<Interpolation>>&) const; KeyframeEffectModelBase* Model() const { return model_.Get(); } bool Paused() const { return paused_; } @@ -62,10 +68,6 @@ double time_to_next_iteration) const override; private: - InertEffect(KeyframeEffectModelBase*, - const Timing&, - bool paused, - double inherited_time); Member<KeyframeEffectModelBase> model_; bool paused_; double inherited_time_;
diff --git a/third_party/blink/renderer/core/animation/keyframe_effect.cc b/third_party/blink/renderer/core/animation/keyframe_effect.cc index d8e9713..3a4339b 100644 --- a/third_party/blink/renderer/core/animation/keyframe_effect.cc +++ b/third_party/blink/renderer/core/animation/keyframe_effect.cc
@@ -53,7 +53,8 @@ const Timing& timing, Priority priority, EventDelegate* event_delegate) { - return new KeyframeEffect(target, model, timing, priority, event_delegate); + return MakeGarbageCollected<KeyframeEffect>(target, model, timing, priority, + event_delegate); } KeyframeEffect* KeyframeEffect::Create( @@ -110,8 +111,9 @@ ExceptionState& exception_state) { Timing new_timing = source->SpecifiedTiming(); KeyframeEffectModelBase* model = source->Model()->Clone(); - return new KeyframeEffect(source->target(), model, new_timing, - source->GetPriority(), source->GetEventDelegate()); + return MakeGarbageCollected<KeyframeEffect>(source->target(), model, + new_timing, source->GetPriority(), + source->GetEventDelegate()); } KeyframeEffect::KeyframeEffect(Element* target,
diff --git a/third_party/blink/renderer/core/animation/keyframe_effect.h b/third_party/blink/renderer/core/animation/keyframe_effect.h index d36560a..0c5861f 100644 --- a/third_party/blink/renderer/core/animation/keyframe_effect.h +++ b/third_party/blink/renderer/core/animation/keyframe_effect.h
@@ -71,6 +71,11 @@ ExceptionState&); static KeyframeEffect* Create(ScriptState*, KeyframeEffect*, ExceptionState&); + KeyframeEffect(Element*, + KeyframeEffectModelBase*, + const Timing&, + Priority, + EventDelegate*); ~KeyframeEffect() override; bool IsKeyframeEffect() const override { return true; } @@ -128,12 +133,6 @@ void Trace(blink::Visitor*) override; private: - KeyframeEffect(Element*, - KeyframeEffectModelBase*, - const Timing&, - Priority, - EventDelegate*); - EffectModel::CompositeOperation CompositeInternal() const; void ApplyEffects();
diff --git a/third_party/blink/renderer/core/animation/keyframe_effect_model.h b/third_party/blink/renderer/core/animation/keyframe_effect_model.h index 7b52cc8..3fe078e 100644 --- a/third_party/blink/renderer/core/animation/keyframe_effect_model.h +++ b/third_party/blink/renderer/core/animation/keyframe_effect_model.h
@@ -213,8 +213,15 @@ const KeyframeVector& keyframes, CompositeOperation composite = kCompositeReplace, scoped_refptr<TimingFunction> default_keyframe_easing = nullptr) { - return new KeyframeEffectModel(keyframes, composite, - std::move(default_keyframe_easing)); + return MakeGarbageCollected<KeyframeEffectModel<K>>( + keyframes, composite, std::move(default_keyframe_easing)); + } + + KeyframeEffectModel(const KeyframeVector& keyframes, + CompositeOperation composite, + scoped_refptr<TimingFunction> default_keyframe_easing) + : KeyframeEffectModelBase(composite, std::move(default_keyframe_easing)) { + keyframes_.AppendVector(keyframes); } KeyframeEffectModelBase* Clone() override { @@ -227,13 +234,6 @@ } private: - KeyframeEffectModel(const KeyframeVector& keyframes, - CompositeOperation composite, - scoped_refptr<TimingFunction> default_keyframe_easing) - : KeyframeEffectModelBase(composite, std::move(default_keyframe_easing)) { - keyframes_.AppendVector(keyframes); - } - bool IsStringKeyframeEffectModel() const override { return false; } bool IsTransitionKeyframeEffectModel() const override { return false; } };
diff --git a/third_party/blink/renderer/core/clipboard/data_object.cc b/third_party/blink/renderer/core/clipboard/data_object.cc index 1a096da..7ee02a7 100644 --- a/third_party/blink/renderer/core/clipboard/data_object.cc +++ b/third_party/blink/renderer/core/clipboard/data_object.cc
@@ -68,7 +68,7 @@ } DataObject* DataObject::Create() { - return new DataObject; + return MakeGarbageCollected<DataObject>(); } DataObject::~DataObject() = default;
diff --git a/third_party/blink/renderer/core/clipboard/data_object.h b/third_party/blink/renderer/core/clipboard/data_object.h index 63549f6..bcef964 100644 --- a/third_party/blink/renderer/core/clipboard/data_object.h +++ b/third_party/blink/renderer/core/clipboard/data_object.h
@@ -68,6 +68,7 @@ static DataObject* Create(); static DataObject* Create(WebDragData); + DataObject(); virtual ~DataObject(); // DataTransferItemList support. @@ -128,8 +129,6 @@ WebDragData ToWebDragData(); private: - DataObject(); - DataObjectItem* FindStringItem(const String& type) const; bool InternalAddStringItem(DataObjectItem*); void InternalAddFileItem(DataObjectItem*);
diff --git a/third_party/blink/renderer/core/clipboard/data_object_item.cc b/third_party/blink/renderer/core/clipboard/data_object_item.cc index aa2ab78..9f1bfed 100644 --- a/third_party/blink/renderer/core/clipboard/data_object_item.cc +++ b/third_party/blink/renderer/core/clipboard/data_object_item.cc
@@ -41,13 +41,15 @@ DataObjectItem* DataObjectItem::CreateFromString(const String& type, const String& data) { - DataObjectItem* item = new DataObjectItem(kStringKind, type); + DataObjectItem* item = + MakeGarbageCollected<DataObjectItem>(kStringKind, type); item->data_ = data; return item; } DataObjectItem* DataObjectItem::CreateFromFile(File* file) { - DataObjectItem* item = new DataObjectItem(kFileKind, file->type()); + DataObjectItem* item = + MakeGarbageCollected<DataObjectItem>(kFileKind, file->type()); item->file_ = file; return item; } @@ -55,7 +57,8 @@ DataObjectItem* DataObjectItem::CreateFromFileWithFileSystemId( File* file, const String& file_system_id) { - DataObjectItem* item = new DataObjectItem(kFileKind, file->type()); + DataObjectItem* item = + MakeGarbageCollected<DataObjectItem>(kFileKind, file->type()); item->file_ = file; item->file_system_id_ = file_system_id; return item; @@ -63,7 +66,8 @@ DataObjectItem* DataObjectItem::CreateFromURL(const String& url, const String& title) { - DataObjectItem* item = new DataObjectItem(kStringKind, kMimeTypeTextURIList); + DataObjectItem* item = + MakeGarbageCollected<DataObjectItem>(kStringKind, kMimeTypeTextURIList); item->data_ = url; item->title_ = title; return item; @@ -71,7 +75,8 @@ DataObjectItem* DataObjectItem::CreateFromHTML(const String& html, const KURL& base_url) { - DataObjectItem* item = new DataObjectItem(kStringKind, kMimeTypeTextHTML); + DataObjectItem* item = + MakeGarbageCollected<DataObjectItem>(kStringKind, kMimeTypeTextHTML); item->data_ = html; item->base_url_ = base_url; return item; @@ -82,7 +87,7 @@ const KURL& source_url, const String& filename_extension, const AtomicString& content_disposition) { - DataObjectItem* item = new DataObjectItem( + DataObjectItem* item = MakeGarbageCollected<DataObjectItem>( kFileKind, MIMETypeRegistry::GetWellKnownMIMETypeForExtension(filename_extension)); item->shared_buffer_ = std::move(buffer); @@ -95,9 +100,12 @@ DataObjectItem* DataObjectItem::CreateFromClipboard(const String& type, uint64_t sequence_number) { - if (type == kMimeTypeImagePng) - return new DataObjectItem(kFileKind, type, sequence_number); - return new DataObjectItem(kStringKind, type, sequence_number); + if (type == kMimeTypeImagePng) { + return MakeGarbageCollected<DataObjectItem>(kFileKind, type, + sequence_number); + } + return MakeGarbageCollected<DataObjectItem>(kStringKind, type, + sequence_number); } DataObjectItem::DataObjectItem(ItemKind kind, const String& type)
diff --git a/third_party/blink/renderer/core/clipboard/data_object_item.h b/third_party/blink/renderer/core/clipboard/data_object_item.h index 2aab3a2..fa2cd04 100644 --- a/third_party/blink/renderer/core/clipboard/data_object_item.h +++ b/third_party/blink/renderer/core/clipboard/data_object_item.h
@@ -64,6 +64,9 @@ static DataObjectItem* CreateFromClipboard(const String& type, uint64_t sequence_number); + DataObjectItem(ItemKind, const String& type); + DataObjectItem(ItemKind, const String& type, uint64_t sequence_number); + ItemKind Kind() const { return kind_; } String GetType() const { return type_; } String GetAsString() const; @@ -88,9 +91,6 @@ kInternalSource, }; - DataObjectItem(ItemKind, const String& type); - DataObjectItem(ItemKind, const String& type, uint64_t sequence_number); - DataSource source_; ItemKind kind_; String type_;
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 64f75a7..929af5bd 100644 --- a/third_party/blink/renderer/core/clipboard/data_object_test.cc +++ b/third_party/blink/renderer/core/clipboard/data_object_test.cc
@@ -33,7 +33,7 @@ }; TEST_F(DataObjectTest, DataObjectObserver) { - DataObjectObserver* observer = new DataObjectObserver; + DataObjectObserver* observer = MakeGarbageCollected<DataObjectObserver>(); data_object_->AddObserver(observer); data_object_->ClearAll(); @@ -62,7 +62,7 @@ EXPECT_EQ(1U, data_object_->length()); EXPECT_EQ(3U, observer->call_count()); - DataObjectObserver* observer2 = new DataObjectObserver; + DataObjectObserver* observer2 = MakeGarbageCollected<DataObjectObserver>(); data_object_->AddObserver(observer2); String file_path = test::BlinkRootDir();
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer.cc b/third_party/blink/renderer/core/clipboard/data_transfer.cc index 053d577..d020720 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer.cc
@@ -232,7 +232,7 @@ DataTransfer* DataTransfer::Create(DataTransferType type, DataTransferAccessPolicy policy, DataObject* data_object) { - return new DataTransfer(type, policy, data_object); + return MakeGarbageCollected<DataTransfer>(type, policy, data_object); } DataTransfer::~DataTransfer() = default;
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer.h b/third_party/blink/renderer/core/clipboard/data_transfer.h index 466f757..6cfbb54b 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer.h +++ b/third_party/blink/renderer/core/clipboard/data_transfer.h
@@ -71,6 +71,8 @@ static DataTransfer* Create(DataTransferType, DataTransferAccessPolicy, DataObject*); + + DataTransfer(DataTransferType, DataTransferAccessPolicy, DataObject*); ~DataTransfer() override; bool IsForCopyAndPaste() const { return transfer_type_ == kCopyAndPaste; } @@ -157,8 +159,6 @@ void Trace(blink::Visitor*) override; private: - DataTransfer(DataTransferType, DataTransferAccessPolicy, DataObject*); - void setDragImage(ImageResourceContent*, Node*, const IntPoint&); bool HasFileOfType(const String&) const;
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 312ef2d..cd501a0 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item.cc
@@ -44,7 +44,7 @@ DataTransferItem* DataTransferItem::Create(DataTransfer* data_transfer, DataObjectItem* item) { - return new DataTransferItem(data_transfer, item); + return MakeGarbageCollected<DataTransferItem>(data_transfer, item); } String DataTransferItem::kind() const {
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item.h b/third_party/blink/renderer/core/clipboard/data_transfer_item.h index 1ed59ec..8bea370 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item.h +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item.h
@@ -52,6 +52,8 @@ public: static DataTransferItem* Create(DataTransfer*, DataObjectItem*); + DataTransferItem(DataTransfer*, DataObjectItem*); + String kind() const; String type() const; @@ -64,8 +66,6 @@ void Trace(blink::Visitor*) override; private: - DataTransferItem(DataTransfer*, DataObjectItem*); - void RunGetAsStringTask( ExecutionContext*, V8PersistentCallbackFunction<V8FunctionStringCallback>*,
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item_list.cc b/third_party/blink/renderer/core/clipboard/data_transfer_item_list.cc index 6984e0c..601b9fc 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item_list.cc +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item_list.cc
@@ -35,7 +35,7 @@ DataTransferItemList* DataTransferItemList::Create(DataTransfer* data_transfer, DataObject* list) { - return new DataTransferItemList(data_transfer, list); + return MakeGarbageCollected<DataTransferItemList>(data_transfer, list); } uint32_t DataTransferItemList::length() const {
diff --git a/third_party/blink/renderer/core/clipboard/data_transfer_item_list.h b/third_party/blink/renderer/core/clipboard/data_transfer_item_list.h index 971b9c1f..c6e8242 100644 --- a/third_party/blink/renderer/core/clipboard/data_transfer_item_list.h +++ b/third_party/blink/renderer/core/clipboard/data_transfer_item_list.h
@@ -51,6 +51,8 @@ public: static DataTransferItemList* Create(DataTransfer*, DataObject*); + DataTransferItemList(DataTransfer*, DataObject*); + uint32_t length() const; DataTransferItem* item(uint32_t index); void deleteItem(uint32_t index, ExceptionState&); @@ -63,8 +65,6 @@ void Trace(blink::Visitor*) override; private: - DataTransferItemList(DataTransfer*, DataObject*); - Member<DataTransfer> data_transfer_; Member<DataObject> data_object_; };
diff --git a/third_party/blink/renderer/core/css/css_rule_list.h b/third_party/blink/renderer/core/css/css_rule_list.h index dd02709..84c65ef 100644 --- a/third_party/blink/renderer/core/css/css_rule_list.h +++ b/third_party/blink/renderer/core/css/css_rule_list.h
@@ -74,17 +74,17 @@ class LiveCSSRuleList final : public CSSRuleList { public: static LiveCSSRuleList* Create(Rule* rule) { - return new LiveCSSRuleList(rule); + return MakeGarbageCollected<LiveCSSRuleList>(rule); } + LiveCSSRuleList(Rule* rule) : rule_(rule) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(rule_); CSSRuleList::Trace(visitor); } private: - LiveCSSRuleList(Rule* rule) : rule_(rule) {} - unsigned length() const override { return rule_->length(); } CSSRule* item(unsigned index) const override { return rule_->Item(index); } CSSStyleSheet* GetStyleSheet() const override {
diff --git a/third_party/blink/renderer/core/css/css_style_rule.cc b/third_party/blink/renderer/core/css/css_style_rule.cc index f0a3feb..1818ed6 100644 --- a/third_party/blink/renderer/core/css/css_style_rule.cc +++ b/third_party/blink/renderer/core/css/css_style_rule.cc
@@ -44,7 +44,7 @@ CSSStyleRule::CSSStyleRule(StyleRule* style_rule, CSSStyleSheet* parent) : CSSRule(parent), style_rule_(style_rule), - style_map_(new DeclaredStylePropertyMap(this)) {} + style_map_(MakeGarbageCollected<DeclaredStylePropertyMap>(this)) {} CSSStyleRule::~CSSStyleRule() = default;
diff --git a/third_party/blink/renderer/core/css/css_uri_value.cc b/third_party/blink/renderer/core/css/css_uri_value.cc index be594ae..ef22d47 100644 --- a/third_party/blink/renderer/core/css/css_uri_value.cc +++ b/third_party/blink/renderer/core/css/css_uri_value.cc
@@ -25,7 +25,7 @@ SVGResource* CSSURIValue::EnsureResourceReference() const { if (!resource_) - resource_ = new ExternalSVGResource(AbsoluteUrl()); + resource_ = MakeGarbageCollected<ExternalSVGResource>(AbsoluteUrl()); return resource_; }
diff --git a/third_party/blink/renderer/core/css/font_face.cc b/third_party/blink/renderer/core/css/font_face.cc index 432a8856..029f71a 100644 --- a/third_party/blink/renderer/core/css/font_face.cc +++ b/third_party/blink/renderer/core/css/font_face.cc
@@ -138,7 +138,8 @@ const AtomicString& family, const String& source, const FontFaceDescriptors* descriptors) { - FontFace* font_face = new FontFace(context, family, descriptors); + FontFace* font_face = + MakeGarbageCollected<FontFace>(context, family, descriptors); const CSSValue* src = ParseCSSValue(context, source, AtRuleDescriptorID::Src); if (!src || !src->IsValueList()) { @@ -156,7 +157,8 @@ const AtomicString& family, DOMArrayBuffer* source, const FontFaceDescriptors* descriptors) { - FontFace* font_face = new FontFace(context, family, descriptors); + FontFace* font_face = + MakeGarbageCollected<FontFace>(context, family, descriptors); font_face->InitCSSFontFace(static_cast<const unsigned char*>(source->Data()), source->ByteLength()); return font_face; @@ -166,7 +168,8 @@ const AtomicString& family, DOMArrayBufferView* source, const FontFaceDescriptors* descriptors) { - FontFace* font_face = new FontFace(context, family, descriptors); + FontFace* font_face = + MakeGarbageCollected<FontFace>(context, family, descriptors); font_face->InitCSSFontFace( static_cast<const unsigned char*>(source->BaseAddress()), source->byteLength()); @@ -186,7 +189,7 @@ if (!src || !src->IsValueList()) return nullptr; - FontFace* font_face = new FontFace(document); + FontFace* font_face = MakeGarbageCollected<FontFace>(document); if (font_face->SetFamilyValue(*family) && font_face->SetPropertyFromStyle(properties, @@ -737,7 +740,8 @@ css_font_face_->AddSource(source); } } else { - css_font_face_->AddSource(new LocalFontFaceSource(item.GetResource())); + css_font_face_->AddSource( + MakeGarbageCollected<LocalFontFaceSource>(item.GetResource())); } }
diff --git a/third_party/blink/renderer/core/css/font_face.h b/third_party/blink/renderer/core/css/font_face.h index 1be42ea..1152b124 100644 --- a/third_party/blink/renderer/core/css/font_face.h +++ b/third_party/blink/renderer/core/css/font_face.h
@@ -71,6 +71,10 @@ const FontFaceDescriptors*); static FontFace* Create(Document*, const StyleRuleFontFace*); + explicit FontFace(ExecutionContext*); + FontFace(ExecutionContext*, + const AtomicString& family, + const FontFaceDescriptors*); ~FontFace() override; const AtomicString& family() const { return family_; } @@ -140,11 +144,6 @@ const String& source, const FontFaceDescriptors*); - explicit FontFace(ExecutionContext*); - FontFace(ExecutionContext*, - const AtomicString& family, - const FontFaceDescriptors*); - void InitCSSFontFace(ExecutionContext*, const CSSValue& src); void InitCSSFontFace(const unsigned char* data, size_t); void SetPropertyFromString(const ExecutionContext*,
diff --git a/third_party/blink/renderer/core/css/font_face_set.cc b/third_party/blink/renderer/core/css/font_face_set.cc index 846fd9b..d67753b 100644 --- a/third_party/blink/renderer/core/css/font_face_set.cc +++ b/third_party/blink/renderer/core/css/font_face_set.cc
@@ -308,7 +308,7 @@ for (const auto& font_face : non_css_connected_faces_) font_faces.push_back(font_face); } - return new IterationSource(font_faces); + return MakeGarbageCollected<IterationSource>(font_faces); } } // namespace blink
diff --git a/third_party/blink/renderer/core/css/font_face_set.h b/third_party/blink/renderer/core/css/font_face_set.h index 07e00297..b56e097baf 100644 --- a/third_party/blink/renderer/core/css/font_face_set.h +++ b/third_party/blink/renderer/core/css/font_face_set.h
@@ -146,7 +146,14 @@ public: static LoadFontPromiseResolver* Create(FontFaceArray faces, ScriptState* script_state) { - return new LoadFontPromiseResolver(faces, script_state); + return MakeGarbageCollected<LoadFontPromiseResolver>(faces, script_state); + } + + LoadFontPromiseResolver(FontFaceArray faces, ScriptState* script_state) + : num_loading_(faces.size()), + error_occured_(false), + resolver_(ScriptPromiseResolver::Create(script_state)) { + font_faces_.swap(faces); } void LoadFonts(); @@ -158,13 +165,6 @@ void Trace(blink::Visitor*) override; private: - LoadFontPromiseResolver(FontFaceArray faces, ScriptState* script_state) - : num_loading_(faces.size()), - error_occured_(false), - resolver_(ScriptPromiseResolver::Create(script_state)) { - font_faces_.swap(faces); - } - HeapVector<Member<FontFace>> font_faces_; int num_loading_; bool error_occured_;
diff --git a/third_party/blink/renderer/core/css/font_face_set_document.h b/third_party/blink/renderer/core/css/font_face_set_document.h index b1ff2d8..0ced9aa 100644 --- a/third_party/blink/renderer/core/css/font_face_set_document.h +++ b/third_party/blink/renderer/core/css/font_face_set_document.h
@@ -52,6 +52,7 @@ public: static const char kSupplementName[]; + explicit FontFaceSetDocument(Document&); ~FontFaceSetDocument() override; ScriptPromise ready(ScriptState*) override; @@ -85,11 +86,9 @@ private: static FontFaceSetDocument* Create(Document& document) { - return new FontFaceSetDocument(document); + return MakeGarbageCollected<FontFaceSetDocument>(document); } - explicit FontFaceSetDocument(Document&); - void FireDoneEventIfPossible() override; const HeapLinkedHashSet<Member<FontFace>>& CSSConnectedFontFaceList() const override;
diff --git a/third_party/blink/renderer/core/css/font_face_set_load_event.h b/third_party/blink/renderer/core/css/font_face_set_load_event.h index b317343..ca012ca0 100644 --- a/third_party/blink/renderer/core/css/font_face_set_load_event.h +++ b/third_party/blink/renderer/core/css/font_face_set_load_event.h
@@ -45,15 +45,17 @@ static FontFaceSetLoadEvent* Create( const AtomicString& type, const FontFaceSetLoadEventInit* initializer) { - return new FontFaceSetLoadEvent(type, initializer); + return MakeGarbageCollected<FontFaceSetLoadEvent>(type, initializer); } static FontFaceSetLoadEvent* CreateForFontFaces( const AtomicString& type, const FontFaceArray& fontfaces = FontFaceArray()) { - return new FontFaceSetLoadEvent(type, fontfaces); + return MakeGarbageCollected<FontFaceSetLoadEvent>(type, fontfaces); } + FontFaceSetLoadEvent(const AtomicString&, const FontFaceArray&); + FontFaceSetLoadEvent(const AtomicString&, const FontFaceSetLoadEventInit*); ~FontFaceSetLoadEvent() override; FontFaceArray fontfaces() const { return fontfaces_; } @@ -63,9 +65,6 @@ void Trace(blink::Visitor*) override; private: - FontFaceSetLoadEvent(const AtomicString&, const FontFaceArray&); - FontFaceSetLoadEvent(const AtomicString&, const FontFaceSetLoadEventInit*); - FontFaceArray fontfaces_; };
diff --git a/third_party/blink/renderer/core/css/font_face_set_worker.h b/third_party/blink/renderer/core/css/font_face_set_worker.h index 63c8734..f56d7f29 100644 --- a/third_party/blink/renderer/core/css/font_face_set_worker.h +++ b/third_party/blink/renderer/core/css/font_face_set_worker.h
@@ -29,6 +29,7 @@ public: static const char kSupplementName[]; + explicit FontFaceSetWorker(WorkerGlobalScope&); ~FontFaceSetWorker() override; ScriptPromise ready(ScriptState*) override; @@ -65,11 +66,9 @@ private: static FontFaceSetWorker* Create(WorkerGlobalScope& worker) { - return new FontFaceSetWorker(worker); + return MakeGarbageCollected<FontFaceSetWorker>(worker); } - explicit FontFaceSetWorker(WorkerGlobalScope&); - void FireDoneEventIfPossible() override; DISALLOW_COPY_AND_ASSIGN(FontFaceSetWorker); };
diff --git a/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h b/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h index 40a95e38..7c57d95 100644 --- a/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h +++ b/third_party/blink/renderer/core/css/keyframe_style_rule_css_style_declaration.h
@@ -17,13 +17,14 @@ static KeyframeStyleRuleCSSStyleDeclaration* Create( MutableCSSPropertyValueSet& property_set, CSSKeyframeRule* parent_rule) { - return new KeyframeStyleRuleCSSStyleDeclaration(property_set, parent_rule); + return MakeGarbageCollected<KeyframeStyleRuleCSSStyleDeclaration>( + property_set, parent_rule); } - private: KeyframeStyleRuleCSSStyleDeclaration(MutableCSSPropertyValueSet&, CSSKeyframeRule*); + private: void DidMutate(MutationType) override; bool IsKeyframeStyle() const final { return true; } };
diff --git a/third_party/blink/renderer/core/dom/dataset_dom_string_map.h b/third_party/blink/renderer/core/dom/dataset_dom_string_map.h index bb1c800a8..998d8f7 100644 --- a/third_party/blink/renderer/core/dom/dataset_dom_string_map.h +++ b/third_party/blink/renderer/core/dom/dataset_dom_string_map.h
@@ -36,9 +36,11 @@ class DatasetDOMStringMap final : public DOMStringMap { public: static DatasetDOMStringMap* Create(Element* element) { - return new DatasetDOMStringMap(element); + return MakeGarbageCollected<DatasetDOMStringMap>(element); } + explicit DatasetDOMStringMap(Element* element) : element_(element) {} + void GetNames(Vector<String>&) override; String item(const String& name) override; bool Contains(const String& name) override; @@ -50,8 +52,6 @@ void Trace(blink::Visitor*) override; private: - explicit DatasetDOMStringMap(Element* element) : element_(element) {} - Member<Element> element_; };
diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc index 4b5a31e..65f85f1 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc
@@ -7682,7 +7682,7 @@ LazyLoadImageObserver& Document::EnsureLazyLoadImageObserver() { if (!lazy_load_image_observer_) - lazy_load_image_observer_ = new LazyLoadImageObserver(); + lazy_load_image_observer_ = MakeGarbageCollected<LazyLoadImageObserver>(); return *lazy_load_image_observer_; } @@ -7696,11 +7696,12 @@ if (!frame) return; const String& feature_name = GetNameForFeature(feature); - FeaturePolicyViolationReportBody* body = new FeaturePolicyViolationReportBody( - feature_name, "Feature policy violation", - (disposition == mojom::FeaturePolicyDisposition::kReport ? "report" - : "enforce"), - SourceLocation::Capture()); + FeaturePolicyViolationReportBody* body = + MakeGarbageCollected<FeaturePolicyViolationReportBody>( + feature_name, "Feature policy violation", + (disposition == mojom::FeaturePolicyDisposition::kReport ? "report" + : "enforce"), + SourceLocation::Capture()); Report* report = new Report("feature-policy-violation", Url().GetString(), body); ReportingContext::From(this)->QueueReport(report);
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index 54a6c817..f7e4b9856 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -215,7 +215,7 @@ } // namespace Element* Element::Create(const QualifiedName& tag_name, Document* document) { - return new Element(tag_name, document, kCreateElement); + return MakeGarbageCollected<Element>(tag_name, document, kCreateElement); } Element::Element(const QualifiedName& tag_name, @@ -398,7 +398,7 @@ ElementAnimations& Element::EnsureElementAnimations() { ElementRareData& rare_data = EnsureElementRareData(); if (!rare_data.GetElementAnimations()) - rare_data.SetElementAnimations(new ElementAnimations()); + rare_data.SetElementAnimations(MakeGarbageCollected<ElementAnimations>()); return *rare_data.GetElementAnimations(); }
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index bb30ec1d..f48c261 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -156,6 +156,8 @@ public: static Element* Create(const QualifiedName&, Document*); + + Element(const QualifiedName& tag_name, Document*, ConstructionType); ~Element() override; DEFINE_ATTRIBUTE_EVENT_LISTENER(beforecopy, kBeforecopy); @@ -897,8 +899,6 @@ bool StyleRecalcBlockedByDisplayLock() const; protected: - Element(const QualifiedName& tag_name, Document*, ConstructionType); - const ElementData* GetElementData() const { return element_data_.Get(); } UniqueElementData& EnsureUniqueElementData();
diff --git a/third_party/blink/renderer/core/dom/element_data_cache.h b/third_party/blink/renderer/core/dom/element_data_cache.h index 4c915fb6..9e11542 100644 --- a/third_party/blink/renderer/core/dom/element_data_cache.h +++ b/third_party/blink/renderer/core/dom/element_data_cache.h
@@ -39,7 +39,11 @@ class ElementDataCache final : public GarbageCollected<ElementDataCache> { public: - static ElementDataCache* Create() { return new ElementDataCache; } + static ElementDataCache* Create() { + return MakeGarbageCollected<ElementDataCache>(); + } + + ElementDataCache(); ShareableElementData* CachedShareableElementDataWithAttributes( const Vector<Attribute>&); @@ -47,8 +51,6 @@ void Trace(blink::Visitor*); private: - ElementDataCache(); - typedef HeapHashMap<unsigned, Member<ShareableElementData>, AlreadyHashed> ShareableElementDataCache; ShareableElementDataCache shareable_element_data_cache_;
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 b3d84095..692a5f96 100644 --- a/third_party/blink/renderer/core/dom/element_rare_data.cc +++ b/third_party/blink/renderer/core/dom/element_rare_data.cc
@@ -57,15 +57,18 @@ CSSStyleDeclaration& ElementRareData::EnsureInlineCSSStyleDeclaration( Element* owner_element) { - if (!cssom_wrapper_) - cssom_wrapper_ = new InlineCSSStyleDeclaration(owner_element); + if (!cssom_wrapper_) { + cssom_wrapper_ = + MakeGarbageCollected<InlineCSSStyleDeclaration>(owner_element); + } return *cssom_wrapper_; } InlineStylePropertyMap& ElementRareData::EnsureInlineStylePropertyMap( Element* owner_element) { if (!cssom_map_wrapper_) { - cssom_map_wrapper_ = new InlineStylePropertyMap(owner_element); + cssom_map_wrapper_ = + MakeGarbageCollected<InlineStylePropertyMap>(owner_element); } return *cssom_map_wrapper_; }
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 5469573..a3ad9560 100644 --- a/third_party/blink/renderer/core/dom/element_rare_data.h +++ b/third_party/blink/renderer/core/dom/element_rare_data.h
@@ -56,9 +56,10 @@ class ElementRareData : public NodeRareData { public: static ElementRareData* Create(NodeRenderingData* node_layout_data) { - return new ElementRareData(node_layout_data); + return MakeGarbageCollected<ElementRareData>(node_layout_data); } + explicit ElementRareData(NodeRenderingData*); ~ElementRareData(); void SetPseudoElement(PseudoId, PseudoElement*); @@ -180,7 +181,8 @@ } ElementIntersectionObserverData& EnsureIntersectionObserverData() { if (!intersection_observer_data_) { - intersection_observer_data_ = new ElementIntersectionObserverData(); + intersection_observer_data_ = + MakeGarbageCollected<ElementIntersectionObserverData>(); } return *intersection_observer_data_; } @@ -241,8 +243,6 @@ WeakMember<DisplayLockContext> display_lock_context_; bool did_attach_internals_ = false; - - explicit ElementRareData(NodeRenderingData*); }; inline LayoutSize DefaultMinimumSizeForResizing() {
diff --git a/third_party/blink/renderer/core/dom/element_visibility_observer_test.cc b/third_party/blink/renderer/core/dom/element_visibility_observer_test.cc index f0139fc..f629fe86 100644 --- a/third_party/blink/renderer/core/dom/element_visibility_observer_test.cc +++ b/third_party/blink/renderer/core/dom/element_visibility_observer_test.cc
@@ -28,8 +28,9 @@ Document& document = *helper_.LocalMainFrame()->GetFrame()->GetDocument(); HTMLElement* element = HTMLDivElement::Create( *DOMImplementation::Create(document)->createHTMLDocument("test")); - ElementVisibilityObserver* observer = new ElementVisibilityObserver( - element, ElementVisibilityObserver::VisibilityCallback()); + ElementVisibilityObserver* observer = + MakeGarbageCollected<ElementVisibilityObserver>( + element, ElementVisibilityObserver::VisibilityCallback()); observer->Start(); observer->Stop(); // It should not crash. @@ -44,7 +45,8 @@ Persistent<HTMLElement> element = HTMLDivElement::Create(document); ElementVisibilityObserver* observer = - new ElementVisibilityObserver(element, WTF::BindRepeating([](bool) {})); + MakeGarbageCollected<ElementVisibilityObserver>( + element, WTF::BindRepeating([](bool) {})); observer->Start(); observer->DeliverObservationsForTesting(); observer->Stop();
diff --git a/third_party/blink/renderer/core/dom/empty_node_list.h b/third_party/blink/renderer/core/dom/empty_node_list.h index be910c0d..85b73df 100644 --- a/third_party/blink/renderer/core/dom/empty_node_list.h +++ b/third_party/blink/renderer/core/dom/empty_node_list.h
@@ -39,8 +39,10 @@ class EmptyNodeList final : public NodeList { public: static EmptyNodeList* Create(Node& root_node) { - return new EmptyNodeList(root_node); + return MakeGarbageCollected<EmptyNodeList>(root_node); } + + explicit EmptyNodeList(Node& root_node) : owner_(root_node) {} ~EmptyNodeList() override; Node& OwnerNode() const { return *owner_; } @@ -48,8 +50,6 @@ void Trace(blink::Visitor*) override; private: - explicit EmptyNodeList(Node& root_node) : owner_(root_node) {} - unsigned length() const override { return 0; } Node* item(unsigned) const override { return nullptr; }
diff --git a/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h b/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h index 2b39fb8..1c5235c 100644 --- a/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h +++ b/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h
@@ -39,9 +39,10 @@ class CORE_EXPORT FirstLetterPseudoElement final : public PseudoElement { public: static FirstLetterPseudoElement* Create(Element* parent) { - return new FirstLetterPseudoElement(parent); + return MakeGarbageCollected<FirstLetterPseudoElement>(parent); } + explicit FirstLetterPseudoElement(Element*); ~FirstLetterPseudoElement() override; static LayoutText* FirstLetterTextLayoutObject(const Element&); @@ -59,8 +60,6 @@ Node* InnerNodeForHitTesting() const override; private: - explicit FirstLetterPseudoElement(Element*); - scoped_refptr<ComputedStyle> CustomStyleForLayoutObject() override; void AttachFirstLetterTextLayoutObjects(LayoutText* first_letter_text);
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 0aca9b3..3d69e24d 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
@@ -59,17 +59,19 @@ class CORE_EXPORT V8FrameCallback : public FrameCallback { public: static V8FrameCallback* Create(V8FrameRequestCallback* callback) { - return new V8FrameCallback(callback); + return MakeGarbageCollected<V8FrameCallback>(callback); } void Trace(blink::Visitor*) override; const char* NameInHeapSnapshot() const override { return "V8FrameCallback"; } + + explicit V8FrameCallback(V8FrameRequestCallback*); ~V8FrameCallback() override = default; + void Invoke(double) override; private: - explicit V8FrameCallback(V8FrameRequestCallback*); TraceWrapperMember<V8FrameRequestCallback> callback_; };
diff --git a/third_party/blink/renderer/core/dom/id_target_observer_registry.cc b/third_party/blink/renderer/core/dom/id_target_observer_registry.cc index ee89fc6a..7c73ad21e 100644 --- a/third_party/blink/renderer/core/dom/id_target_observer_registry.cc +++ b/third_party/blink/renderer/core/dom/id_target_observer_registry.cc
@@ -30,7 +30,7 @@ namespace blink { IdTargetObserverRegistry* IdTargetObserverRegistry::Create() { - return new IdTargetObserverRegistry(); + return MakeGarbageCollected<IdTargetObserverRegistry>(); } void IdTargetObserverRegistry::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/dom/id_target_observer_registry.h b/third_party/blink/renderer/core/dom/id_target_observer_registry.h index 5c94327..fd7d789 100644 --- a/third_party/blink/renderer/core/dom/id_target_observer_registry.h +++ b/third_party/blink/renderer/core/dom/id_target_observer_registry.h
@@ -43,12 +43,14 @@ public: static IdTargetObserverRegistry* Create(); + + IdTargetObserverRegistry() : notifying_observers_in_set_(nullptr) {} + void Trace(blink::Visitor*); void NotifyObservers(const AtomicString& id); bool HasObservers(const AtomicString& id) const; private: - IdTargetObserverRegistry() : notifying_observers_in_set_(nullptr) {} void AddObserver(const AtomicString& id, IdTargetObserver*); void RemoveObserver(const AtomicString& id, IdTargetObserver*); void NotifyObserversInternal(const AtomicString& id);
diff --git a/third_party/blink/renderer/core/dom/idle_deadline.h b/third_party/blink/renderer/core/dom/idle_deadline.h index 59c37cd..471935f 100644 --- a/third_party/blink/renderer/core/dom/idle_deadline.h +++ b/third_party/blink/renderer/core/dom/idle_deadline.h
@@ -19,9 +19,11 @@ enum class CallbackType { kCalledWhenIdle, kCalledByTimeout }; static IdleDeadline* Create(TimeTicks deadline, CallbackType callback_type) { - return new IdleDeadline(deadline, callback_type); + return MakeGarbageCollected<IdleDeadline>(deadline, callback_type); } + IdleDeadline(TimeTicks deadline, CallbackType); + double timeRemaining() const; bool didTimeout() const { @@ -29,8 +31,6 @@ } private: - IdleDeadline(TimeTicks deadline, CallbackType); - TimeTicks deadline_; CallbackType callback_type_; };
diff --git a/third_party/blink/renderer/core/dom/node_test.cc b/third_party/blink/renderer/core/dom/node_test.cc index 1546ed9..56563b0 100644 --- a/third_party/blink/renderer/core/dom/node_test.cc +++ b/third_party/blink/renderer/core/dom/node_test.cc
@@ -297,13 +297,15 @@ } TEST_F(NodeTest, HasMediaControlAncestor_MediaControlElement) { - FakeMediaControlElement* node = new FakeMediaControlElement(GetDocument()); + FakeMediaControlElement* node = + MakeGarbageCollected<FakeMediaControlElement>(GetDocument()); EXPECT_TRUE(node->HasMediaControlAncestor()); EXPECT_TRUE(InitializeUserAgentShadowTree(node)->HasMediaControlAncestor()); } TEST_F(NodeTest, HasMediaControlAncestor_MediaControls) { - FakeMediaControls* node = new FakeMediaControls(GetDocument()); + FakeMediaControls* node = + MakeGarbageCollected<FakeMediaControls>(GetDocument()); EXPECT_TRUE(node->HasMediaControlAncestor()); EXPECT_TRUE(InitializeUserAgentShadowTree(node)->HasMediaControlAncestor()); }
diff --git a/third_party/blink/renderer/core/editing/commands/delete_from_text_node_command.h b/third_party/blink/renderer/core/editing/commands/delete_from_text_node_command.h index 9ceb5b9..f361a8d 100644 --- a/third_party/blink/renderer/core/editing/commands/delete_from_text_node_command.h +++ b/third_party/blink/renderer/core/editing/commands/delete_from_text_node_command.h
@@ -37,14 +37,14 @@ static DeleteFromTextNodeCommand* Create(Text* node, unsigned offset, unsigned count) { - return new DeleteFromTextNodeCommand(node, offset, count); + return MakeGarbageCollected<DeleteFromTextNodeCommand>(node, offset, count); } + DeleteFromTextNodeCommand(Text*, unsigned offset, unsigned count); + void Trace(blink::Visitor*) override; private: - DeleteFromTextNodeCommand(Text*, unsigned offset, unsigned count); - void DoApply(EditingState*) override; void DoUnapply() override;
diff --git a/third_party/blink/renderer/core/editing/commands/delete_selection_command.h b/third_party/blink/renderer/core/editing/commands/delete_selection_command.h index 81d8ede..ca382fd 100644 --- a/third_party/blink/renderer/core/editing/commands/delete_selection_command.h +++ b/third_party/blink/renderer/core/editing/commands/delete_selection_command.h
@@ -42,19 +42,17 @@ const DeleteSelectionOptions& options, InputEvent::InputType input_type = InputEvent::InputType::kNone, const Position& reference_move_position = Position()) { - return new DeleteSelectionCommand(document, options, input_type, - reference_move_position); + return MakeGarbageCollected<DeleteSelectionCommand>( + document, options, input_type, reference_move_position); } static DeleteSelectionCommand* Create( const VisibleSelection& selection, const DeleteSelectionOptions& options, InputEvent::InputType input_type = InputEvent::InputType::kNone) { - return new DeleteSelectionCommand(selection, options, input_type); + return MakeGarbageCollected<DeleteSelectionCommand>(selection, options, + input_type); } - void Trace(blink::Visitor*) override; - - private: DeleteSelectionCommand(Document&, const DeleteSelectionOptions&, InputEvent::InputType, @@ -63,6 +61,9 @@ const DeleteSelectionOptions&, InputEvent::InputType); + void Trace(blink::Visitor*) override; + + private: void DoApply(EditingState*) override; InputEvent::InputType GetInputType() const override;
diff --git a/third_party/blink/renderer/core/editing/commands/drag_and_drop_command.h b/third_party/blink/renderer/core/editing/commands/drag_and_drop_command.h index baa7a83..36f25d19 100644 --- a/third_party/blink/renderer/core/editing/commands/drag_and_drop_command.h +++ b/third_party/blink/renderer/core/editing/commands/drag_and_drop_command.h
@@ -17,15 +17,15 @@ class DragAndDropCommand final : public CompositeEditCommand { public: static DragAndDropCommand* Create(Document& document) { - return new DragAndDropCommand(document); + return MakeGarbageCollected<DragAndDropCommand>(document); } + explicit DragAndDropCommand(Document&); + bool IsCommandGroupWrapper() const override; bool IsDragAndDropCommand() const override; private: - explicit DragAndDropCommand(Document&); - void DoApply(EditingState*) override; InputEvent::InputType GetInputType() const override; };
diff --git a/third_party/blink/renderer/core/editing/commands/format_block_command.h b/third_party/blink/renderer/core/editing/commands/format_block_command.h index e4c50dc..63b54f24 100644 --- a/third_party/blink/renderer/core/editing/commands/format_block_command.h +++ b/third_party/blink/renderer/core/editing/commands/format_block_command.h
@@ -39,17 +39,17 @@ public: static FormatBlockCommand* Create(Document& document, const QualifiedName& tag_name) { - return new FormatBlockCommand(document, tag_name); + return MakeGarbageCollected<FormatBlockCommand>(document, tag_name); } + FormatBlockCommand(Document&, const QualifiedName& tag_name); + bool PreservesTypingStyle() const override { return true; } static Element* ElementForFormatBlockCommand(const EphemeralRange&); bool DidApply() const { return did_apply_; } private: - FormatBlockCommand(Document&, const QualifiedName& tag_name); - void FormatSelection(const VisiblePosition& start_of_selection, const VisiblePosition& end_of_selection, EditingState*) override;
diff --git a/third_party/blink/renderer/core/editing/commands/indent_outdent_command.h b/third_party/blink/renderer/core/editing/commands/indent_outdent_command.h index 302ea86..ebf84db 100644 --- a/third_party/blink/renderer/core/editing/commands/indent_outdent_command.h +++ b/third_party/blink/renderer/core/editing/commands/indent_outdent_command.h
@@ -34,14 +34,14 @@ public: enum EIndentType { kIndent, kOutdent }; static IndentOutdentCommand* Create(Document& document, EIndentType type) { - return new IndentOutdentCommand(document, type); + return MakeGarbageCollected<IndentOutdentCommand>(document, type); } + IndentOutdentCommand(Document&, EIndentType); + bool PreservesTypingStyle() const override { return true; } private: - IndentOutdentCommand(Document&, EIndentType); - InputEvent::InputType GetInputType() const override; void OutdentRegion(const VisiblePosition&,
diff --git a/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.cc b/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.cc index 88775900..9df720b50 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.cc +++ b/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.cc
@@ -122,7 +122,8 @@ Document& document, const String& text, RebalanceType rebalance_type) { - return new InsertIncrementalTextCommand(document, text, rebalance_type); + return MakeGarbageCollected<InsertIncrementalTextCommand>(document, text, + rebalance_type); } InsertIncrementalTextCommand::InsertIncrementalTextCommand(
diff --git a/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.h b/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.h index 7c0778c4..165a04a 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.h +++ b/third_party/blink/renderer/core/editing/commands/insert_incremental_text_command.h
@@ -17,10 +17,11 @@ const String&, RebalanceType = kRebalanceLeadingAndTrailingWhitespaces); - private: InsertIncrementalTextCommand(Document&, const String& text, RebalanceType); + + private: void DoApply(EditingState*) override; };
diff --git a/third_party/blink/renderer/core/editing/commands/insert_into_text_node_command.h b/third_party/blink/renderer/core/editing/commands/insert_into_text_node_command.h index bd651d46..94bae27d 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_into_text_node_command.h +++ b/third_party/blink/renderer/core/editing/commands/insert_into_text_node_command.h
@@ -37,14 +37,14 @@ static InsertIntoTextNodeCommand* Create(Text* node, unsigned offset, const String& text) { - return new InsertIntoTextNodeCommand(node, offset, text); + return MakeGarbageCollected<InsertIntoTextNodeCommand>(node, offset, text); } + InsertIntoTextNodeCommand(Text* node, unsigned offset, const String& text); + void Trace(blink::Visitor*) override; private: - InsertIntoTextNodeCommand(Text* node, unsigned offset, const String& text); - void DoApply(EditingState*) override; void DoUnapply() override;
diff --git a/third_party/blink/renderer/core/editing/commands/insert_line_break_command.h b/third_party/blink/renderer/core/editing/commands/insert_line_break_command.h index bc8f144..793d298 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_line_break_command.h +++ b/third_party/blink/renderer/core/editing/commands/insert_line_break_command.h
@@ -33,12 +33,12 @@ class InsertLineBreakCommand final : public CompositeEditCommand { public: static InsertLineBreakCommand* Create(Document& document) { - return new InsertLineBreakCommand(document); + return MakeGarbageCollected<InsertLineBreakCommand>(document); } - private: explicit InsertLineBreakCommand(Document&); + private: void DoApply(EditingState*) override; bool PreservesTypingStyle() const override;
diff --git a/third_party/blink/renderer/core/editing/commands/insert_list_command.h b/third_party/blink/renderer/core/editing/commands/insert_list_command.h index aaadb8d..8913ee9 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_list_command.h +++ b/third_party/blink/renderer/core/editing/commands/insert_list_command.h
@@ -38,16 +38,16 @@ enum Type { kOrderedList, kUnorderedList }; static InsertListCommand* Create(Document& document, Type list_type) { - return new InsertListCommand(document, list_type); + return MakeGarbageCollected<InsertListCommand>(document, list_type); } + InsertListCommand(Document&, Type); + bool PreservesTypingStyle() const override { return true; } void Trace(blink::Visitor*) override; private: - InsertListCommand(Document&, Type); - void DoApply(EditingState*) override; InputEvent::InputType GetInputType() const override;
diff --git a/third_party/blink/renderer/core/editing/commands/insert_node_before_command.h b/third_party/blink/renderer/core/editing/commands/insert_node_before_command.h index 15138b6a..8fafa29 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_node_before_command.h +++ b/third_party/blink/renderer/core/editing/commands/insert_node_before_command.h
@@ -37,18 +37,18 @@ Node* child_to_insert_before, ShouldAssumeContentIsAlwaysEditable should_assume_content_is_always_editable) { - return new InsertNodeBeforeCommand( + return MakeGarbageCollected<InsertNodeBeforeCommand>( child_to_insert, child_to_insert_before, should_assume_content_is_always_editable); } - void Trace(blink::Visitor*) override; - - private: InsertNodeBeforeCommand(Node* child_to_insert, Node* child_to_insert_before, ShouldAssumeContentIsAlwaysEditable); + void Trace(blink::Visitor*) override; + + private: void DoApply(EditingState*) override; void DoUnapply() override;
diff --git a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.h b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.h index 0386f60..761b409 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.h +++ b/third_party/blink/renderer/core/editing/commands/insert_paragraph_separator_command.h
@@ -39,18 +39,18 @@ Document& document, bool use_default_paragraph_element = false, bool paste_blockquote_into_unquoted_area = false) { - return new InsertParagraphSeparatorCommand( + return MakeGarbageCollected<InsertParagraphSeparatorCommand>( document, use_default_paragraph_element, paste_blockquote_into_unquoted_area); } - void Trace(blink::Visitor*) override; - - private: InsertParagraphSeparatorCommand(Document&, bool use_default_paragraph_element, bool paste_blockquote_into_unquoted_area); + void Trace(blink::Visitor*) override; + + private: void DoApply(EditingState*) override; void CalculateStyleBeforeInsertion(const Position&);
diff --git a/third_party/blink/renderer/core/editing/commands/insert_text_command.h b/third_party/blink/renderer/core/editing/commands/insert_text_command.h index c839cedd..2350525 100644 --- a/third_party/blink/renderer/core/editing/commands/insert_text_command.h +++ b/third_party/blink/renderer/core/editing/commands/insert_text_command.h
@@ -41,16 +41,17 @@ Document& document, const String& text, RebalanceType rebalance_type = kRebalanceLeadingAndTrailingWhitespaces) { - return new InsertTextCommand(document, text, rebalance_type); + return MakeGarbageCollected<InsertTextCommand>(document, text, + rebalance_type); } - String TextDataForInputEvent() const final; - - protected: InsertTextCommand(Document&, const String& text, RebalanceType); + String TextDataForInputEvent() const final; + + protected: void DoApply(EditingState*) override; Position PositionInsideTextNode(const Position&, EditingState*);
diff --git a/third_party/blink/renderer/core/editing/drag_caret.cc b/third_party/blink/renderer/core/editing/drag_caret.cc index c89904f..135a4f7 100644 --- a/third_party/blink/renderer/core/editing/drag_caret.cc +++ b/third_party/blink/renderer/core/editing/drag_caret.cc
@@ -39,7 +39,7 @@ DragCaret::~DragCaret() = default; DragCaret* DragCaret::Create() { - return new DragCaret; + return MakeGarbageCollected<DragCaret>(); } void DragCaret::ClearPreviousVisualRect(const LayoutBlock& block) {
diff --git a/third_party/blink/renderer/core/editing/drag_caret.h b/third_party/blink/renderer/core/editing/drag_caret.h index 74c57e5..734a6a5 100644 --- a/third_party/blink/renderer/core/editing/drag_caret.h +++ b/third_party/blink/renderer/core/editing/drag_caret.h
@@ -47,6 +47,7 @@ public: static DragCaret* Create(); + DragCaret(); virtual ~DragCaret(); // Paint invalidation methods delegating to CaretDisplayItemClient. @@ -70,8 +71,6 @@ void Trace(blink::Visitor*) override; private: - DragCaret(); - // Implementations of |SynchronousMutationObserver| void NodeChildrenWillBeRemoved(ContainerNode&) final; void NodeWillBeRemoved(Node&) final;
diff --git a/third_party/blink/renderer/core/editing/editing_style.h b/third_party/blink/renderer/core/editing/editing_style.h index 6bcaf1c3..627b5b6c 100644 --- a/third_party/blink/renderer/core/editing/editing_style.h +++ b/third_party/blink/renderer/core/editing/editing_style.h
@@ -76,30 +76,37 @@ }; static float no_font_delta_; - static EditingStyle* Create() { return new EditingStyle(); } + static EditingStyle* Create() { return MakeGarbageCollected<EditingStyle>(); } static EditingStyle* Create(ContainerNode* node, PropertiesToInclude properties_to_include = kOnlyEditingInheritableProperties) { - return new EditingStyle(node, properties_to_include); + return MakeGarbageCollected<EditingStyle>(node, properties_to_include); } static EditingStyle* Create(const Position& position, PropertiesToInclude properties_to_include = kOnlyEditingInheritableProperties) { - return new EditingStyle(position, properties_to_include); + return MakeGarbageCollected<EditingStyle>(position, properties_to_include); } static EditingStyle* Create(const CSSPropertyValueSet* style) { - return new EditingStyle(style); + return MakeGarbageCollected<EditingStyle>(style); } static EditingStyle* Create(CSSPropertyID property_id, const String& value, SecureContextMode secure_context_mode) { - return new EditingStyle(property_id, value, secure_context_mode); + return MakeGarbageCollected<EditingStyle>(property_id, value, + secure_context_mode); } + EditingStyle() = default; + EditingStyle(ContainerNode*, PropertiesToInclude); + EditingStyle(const Position&, PropertiesToInclude); + explicit EditingStyle(const CSSPropertyValueSet*); + EditingStyle(CSSPropertyID, const String& value, SecureContextMode); + MutableCSSPropertyValueSet* Style() { return mutable_style_.Get(); } bool GetTextDirection(WritingDirection&) const; bool IsEmpty() const; @@ -176,11 +183,6 @@ const String& value); private: - EditingStyle() = default; - EditingStyle(ContainerNode*, PropertiesToInclude); - EditingStyle(const Position&, PropertiesToInclude); - explicit EditingStyle(const CSSPropertyValueSet*); - EditingStyle(CSSPropertyID, const String& value, SecureContextMode); void Init(Node*, PropertiesToInclude); void RemoveInheritedColorsIfNeeded(const ComputedStyle*); void ReplaceFontSizeByKeywordIfPossible(const ComputedStyle*,
diff --git a/third_party/blink/renderer/core/editing/editor.cc b/third_party/blink/renderer/core/editing/editor.cc index 5caff9a..6ee4910 100644 --- a/third_party/blink/renderer/core/editing/editor.cc +++ b/third_party/blink/renderer/core/editing/editor.cc
@@ -447,7 +447,7 @@ } Editor* Editor::Create(LocalFrame& frame) { - return new Editor(frame); + return MakeGarbageCollected<Editor>(frame); } Editor::Editor(LocalFrame& frame)
diff --git a/third_party/blink/renderer/core/editing/editor.h b/third_party/blink/renderer/core/editing/editor.h index b98e652..b6f3c97 100644 --- a/third_party/blink/renderer/core/editing/editor.h +++ b/third_party/blink/renderer/core/editing/editor.h
@@ -64,6 +64,8 @@ class CORE_EXPORT Editor final : public GarbageCollectedFinalized<Editor> { public: static Editor* Create(LocalFrame&); + + explicit Editor(LocalFrame&); ~Editor(); CompositeEditCommand* LastEditCommand() { return last_edit_command_.Get(); } @@ -245,8 +247,6 @@ Member<EditingStyle> typing_style_; bool mark_is_directional_ = false; - explicit Editor(LocalFrame&); - LocalFrame& GetFrame() const { DCHECK(frame_); return *frame_;
diff --git a/third_party/blink/renderer/core/editing/frame_selection.cc b/third_party/blink/renderer/core/editing/frame_selection.cc index 3638301a..7db9e58 100644 --- a/third_party/blink/renderer/core/editing/frame_selection.cc +++ b/third_party/blink/renderer/core/editing/frame_selection.cc
@@ -103,7 +103,8 @@ focused_(frame.GetPage() && frame.GetPage()->GetFocusController().FocusedFrame() == frame), is_directional_(ShouldAlwaysUseDirectionalSelection(frame_)), - frame_caret_(new FrameCaret(frame, *selection_editor_)) {} + frame_caret_( + MakeGarbageCollected<FrameCaret>(frame, *selection_editor_)) {} FrameSelection::~FrameSelection() = default;
diff --git a/third_party/blink/renderer/core/editing/frame_selection.h b/third_party/blink/renderer/core/editing/frame_selection.h index 8a74d20..e03de64 100644 --- a/third_party/blink/renderer/core/editing/frame_selection.h +++ b/third_party/blink/renderer/core/editing/frame_selection.h
@@ -125,8 +125,10 @@ public: static FrameSelection* Create(LocalFrame& frame) { - return new FrameSelection(frame); + return MakeGarbageCollected<FrameSelection>(frame); } + + explicit FrameSelection(LocalFrame&); ~FrameSelection(); bool IsAvailable() const { return LifecycleContext(); } @@ -283,8 +285,6 @@ friend class PaintControllerPaintTestBase; friend class SelectionControllerTest; - explicit FrameSelection(LocalFrame&); - const DisplayItemClient& CaretDisplayItemClientForTesting() const; // Note: We have |selectionInFlatTree()| for unit tests, we should
diff --git a/third_party/blink/renderer/core/editing/ime/input_method_controller.cc b/third_party/blink/renderer/core/editing/ime/input_method_controller.cc index 5ce8368b..039eff77 100644 --- a/third_party/blink/renderer/core/editing/ime/input_method_controller.cc +++ b/third_party/blink/renderer/core/editing/ime/input_method_controller.cc
@@ -366,7 +366,7 @@ enum class InputMethodController::TypingContinuation { kContinue, kEnd }; InputMethodController* InputMethodController::Create(LocalFrame& frame) { - return new InputMethodController(frame); + return MakeGarbageCollected<InputMethodController>(frame); } InputMethodController::InputMethodController(LocalFrame& frame)
diff --git a/third_party/blink/renderer/core/editing/ime/input_method_controller.h b/third_party/blink/renderer/core/editing/ime/input_method_controller.h index 3d3e49e..b62b701 100644 --- a/third_party/blink/renderer/core/editing/ime/input_method_controller.h +++ b/third_party/blink/renderer/core/editing/ime/input_method_controller.h
@@ -58,6 +58,8 @@ }; static InputMethodController* Create(LocalFrame&); + + explicit InputMethodController(LocalFrame&); virtual ~InputMethodController(); void Trace(blink::Visitor*) override; @@ -120,8 +122,6 @@ Member<Range> composition_range_; bool has_composition_; - explicit InputMethodController(LocalFrame&); - Editor& GetEditor() const; LocalFrame& GetFrame() const { DCHECK(frame_);
diff --git a/third_party/blink/renderer/core/editing/layout_selection.cc b/third_party/blink/renderer/core/editing/layout_selection.cc index 2feea6e..a93e9e1 100644 --- a/third_party/blink/renderer/core/editing/layout_selection.cc +++ b/third_party/blink/renderer/core/editing/layout_selection.cc
@@ -586,9 +586,8 @@ // Even If |fragment| is before linebreak, if its direction differs to line // direction, we don't paint line break. See // paint/selection/text-selection-newline-mixed-ltr-rtl.html. - const ShapeResultView* shape_result = - ToNGPhysicalTextFragment(fragment.PhysicalFragment()).TextShapeResult(); - return physical_line_box.BaseDirection() == shape_result->Direction(); + return physical_line_box.BaseDirection() == + fragment.PhysicalFragment().ResolvedDirection(); } static Text* AssociatedTextNode(const LayoutText& text) {
diff --git a/third_party/blink/renderer/core/editing/layout_selection.h b/third_party/blink/renderer/core/editing/layout_selection.h index bb7561e..19607fa 100644 --- a/third_party/blink/renderer/core/editing/layout_selection.h +++ b/third_party/blink/renderer/core/editing/layout_selection.h
@@ -41,9 +41,11 @@ class LayoutSelection final : public GarbageCollected<LayoutSelection> { public: static LayoutSelection* Create(FrameSelection& frame_selection) { - return new LayoutSelection(frame_selection); + return MakeGarbageCollected<LayoutSelection>(frame_selection); } + LayoutSelection(FrameSelection&); + void SetHasPendingSelection(); void Commit(); @@ -59,8 +61,6 @@ void Trace(blink::Visitor*); private: - LayoutSelection(FrameSelection&); - Member<FrameSelection> frame_selection_; bool has_pending_selection_ : 1;
diff --git a/third_party/blink/renderer/core/editing/layout_selection_test.cc b/third_party/blink/renderer/core/editing/layout_selection_test.cc index 623e9e1..120eb68 100644 --- a/third_party/blink/renderer/core/editing/layout_selection_test.cc +++ b/third_party/blink/renderer/core/editing/layout_selection_test.cc
@@ -1156,4 +1156,15 @@ Selection().ComputeLayoutSelectionStatus(GetNGPaintFragment(layout_br))); } +// https://crbug.com/907186 +TEST_F(NGLayoutSelectionTest, WBRStatus) { + SetSelectionAndUpdateLayoutSelection( + "<div style=\"width:0\">^foo<wbr>bar|</div>"); + const LayoutObject* layout_wbr = + GetDocument().QuerySelector("wbr")->GetLayoutObject(); + EXPECT_EQ( + LayoutSelectionStatus(3u, 4u, SelectSoftLineBreak::kSelected), + Selection().ComputeLayoutSelectionStatus(GetNGPaintFragment(layout_wbr))); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/editing/link_selection_test.cc b/third_party/blink/renderer/core/editing/link_selection_test.cc index 0b261ba..9c0d13e 100644 --- a/third_party/blink/renderer/core/editing/link_selection_test.cc +++ b/third_party/blink/renderer/core/editing/link_selection_test.cc
@@ -267,16 +267,17 @@ protected: class MockEventListener final : public EventListener { public: - static MockEventListener* Create() { return new MockEventListener(); } + static MockEventListener* Create() { + return MakeGarbageCollected<MockEventListener>(); + } + + MockEventListener() : EventListener(kCPPEventListenerType) {} bool operator==(const EventListener& other) const final { return this == &other; } MOCK_METHOD2(Invoke, void(ExecutionContext* executionContext, Event*)); - - private: - MockEventListener() : EventListener(kCPPEventListenerType) {} }; void SetUp() override {
diff --git a/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc b/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc index 955b09a..3981ae88 100644 --- a/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc +++ b/third_party/blink/renderer/core/editing/markers/document_marker_controller.cc
@@ -93,7 +93,7 @@ case DocumentMarker::kSpelling: return new SpellingMarkerListImpl(); case DocumentMarker::kGrammar: - return new GrammarMarkerListImpl(); + return MakeGarbageCollected<GrammarMarkerListImpl>(); case DocumentMarker::kSuggestion: return new SuggestionMarkerListImpl(); case DocumentMarker::kTextMatch: @@ -161,7 +161,8 @@ void DocumentMarkerController::AddGrammarMarker(const EphemeralRange& range, const String& description) { AddMarkerInternal(range, [&description](int start_offset, int end_offset) { - return new GrammarMarker(start_offset, end_offset, description); + return MakeGarbageCollected<GrammarMarker>(start_offset, end_offset, + description); }); }
diff --git a/third_party/blink/renderer/core/editing/markers/grammar_marker_list_impl_test.cc b/third_party/blink/renderer/core/editing/markers/grammar_marker_list_impl_test.cc index 29192ae..00c87ca 100644 --- a/third_party/blink/renderer/core/editing/markers/grammar_marker_list_impl_test.cc +++ b/third_party/blink/renderer/core/editing/markers/grammar_marker_list_impl_test.cc
@@ -15,7 +15,8 @@ class GrammarMarkerListImplTest : public testing::Test { protected: - GrammarMarkerListImplTest() : marker_list_(new GrammarMarkerListImpl()) {} + GrammarMarkerListImplTest() + : marker_list_(MakeGarbageCollected<GrammarMarkerListImpl>()) {} Persistent<GrammarMarkerListImpl> marker_list_; };
diff --git a/third_party/blink/renderer/core/editing/markers/grammar_marker_test.cc b/third_party/blink/renderer/core/editing/markers/grammar_marker_test.cc index c7c1197..6fd4262 100644 --- a/third_party/blink/renderer/core/editing/markers/grammar_marker_test.cc +++ b/third_party/blink/renderer/core/editing/markers/grammar_marker_test.cc
@@ -13,17 +13,20 @@ class GrammarMarkerTest : public testing::Test {}; TEST_F(GrammarMarkerTest, MarkerType) { - DocumentMarker* marker = new GrammarMarker(0, 1, kDescription); + DocumentMarker* marker = + MakeGarbageCollected<GrammarMarker>(0, 1, kDescription); EXPECT_EQ(DocumentMarker::kGrammar, marker->GetType()); } TEST_F(GrammarMarkerTest, IsSpellCheckMarker) { - DocumentMarker* marker = new GrammarMarker(0, 1, kDescription); + DocumentMarker* marker = + MakeGarbageCollected<GrammarMarker>(0, 1, kDescription); EXPECT_TRUE(IsSpellCheckMarker(*marker)); } TEST_F(GrammarMarkerTest, ConstructorAndGetters) { - GrammarMarker* marker = new GrammarMarker(0, 1, kDescription); + GrammarMarker* marker = + MakeGarbageCollected<GrammarMarker>(0, 1, kDescription); EXPECT_EQ(kDescription, marker->Description()); }
diff --git a/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc b/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc index c0b1fdd3b..fe08af3 100644 --- a/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc +++ b/third_party/blink/renderer/core/editing/spellcheck/idle_spell_check_controller.cc
@@ -43,18 +43,18 @@ : public ScriptedIdleTaskController::IdleTask { public: static IdleCallback* Create(IdleSpellCheckController* controller) { - return new IdleCallback(controller); + return MakeGarbageCollected<IdleCallback>(controller); } + explicit IdleCallback(IdleSpellCheckController* controller) + : controller_(controller) {} + void Trace(blink::Visitor* visitor) final { visitor->Trace(controller_); ScriptedIdleTaskController::IdleTask::Trace(visitor); } private: - explicit IdleCallback(IdleSpellCheckController* controller) - : controller_(controller) {} - void invoke(IdleDeadline* deadline) final { controller_->Invoke(deadline); } const Member<IdleSpellCheckController> controller_;
diff --git a/third_party/blink/renderer/core/editing/visible_units.cc b/third_party/blink/renderer/core/editing/visible_units.cc index 7fc178a..debe9cad 100644 --- a/third_party/blink/renderer/core/editing/visible_units.cc +++ b/third_party/blink/renderer/core/editing/visible_units.cc
@@ -343,99 +343,6 @@ return boundary; } -template <typename Strategy> -static PositionTemplate<Strategy> PreviousBoundaryAlgorithm( - const VisiblePositionTemplate<Strategy>& c, - BoundarySearchFunction search_function) { - DCHECK(c.IsValid()) << c; - const PositionTemplate<Strategy> pos = c.DeepEquivalent(); - Node* boundary = ParentEditingBoundary(pos); - if (!boundary) - return PositionTemplate<Strategy>(); - - const PositionTemplate<Strategy> start = - PositionTemplate<Strategy>::EditingPositionOf(boundary, 0) - .ParentAnchoredEquivalent(); - const PositionTemplate<Strategy> end = pos.ParentAnchoredEquivalent(); - - ForwardsTextBuffer suffix_string; - if (RequiresContextForWordBoundary(CharacterBefore(c))) { - TextIteratorAlgorithm<Strategy> forwards_iterator( - end, PositionTemplate<Strategy>::AfterNode(*boundary)); - while (!forwards_iterator.AtEnd()) { - forwards_iterator.CopyTextTo(&suffix_string); - int context_end_index = EndOfFirstWordBoundaryContext( - suffix_string.Data() + suffix_string.Size() - - forwards_iterator.length(), - forwards_iterator.length()); - if (context_end_index < forwards_iterator.length()) { - suffix_string.Shrink(forwards_iterator.length() - context_end_index); - break; - } - forwards_iterator.Advance(); - } - } - - unsigned suffix_length = suffix_string.Size(); - BackwardsTextBuffer string; - string.PushRange(suffix_string.Data(), suffix_string.Size()); - - // Treat bullets used in the text security mode as regular characters when - // looking for boundaries. - SimplifiedBackwardsTextIteratorAlgorithm<Strategy> it( - EphemeralRangeTemplate<Strategy>(start, end), - TextIteratorBehavior::Builder() - .SetEmitsSmallXForTextSecurity(true) - .Build()); - unsigned next = 0; - bool need_more_context = false; - while (!it.AtEnd()) { - // iterate to get chunks until the searchFunction returns a non-zero - // value. - int run_offset = 0; - do { - run_offset += it.CopyTextTo(&string, run_offset, string.Capacity()); - next = search_function(string.Data(), string.Size(), - string.Size() - suffix_length, kMayHaveMoreContext, - need_more_context); - } while (!next && run_offset < it.length()); - if (next) - break; - it.Advance(); - } - if (need_more_context) { - // The last search returned the beginning of the buffer and asked for - // more context, but there is no earlier text. Force a search with - // what's available. - next = search_function(string.Data(), string.Size(), - string.Size() - suffix_length, kDontHaveMoreContext, - need_more_context); - DCHECK(!need_more_context); - } - - if (!next) - return it.AtEnd() ? it.StartPosition() : pos; - - // Use the character iterator to translate the next value into a DOM - // position. - BackwardsCharacterIteratorAlgorithm<Strategy> char_it( - EphemeralRangeTemplate<Strategy>(start, end)); - char_it.Advance(string.Size() - suffix_length - next); - // TODO(yosin) charIt can get out of shadow host. - return char_it.EndPosition(); -} - -Position PreviousBoundary(const VisiblePosition& visible_position, - BoundarySearchFunction search_function) { - return PreviousBoundaryAlgorithm(visible_position, search_function); -} - -PositionInFlatTree PreviousBoundary( - const VisiblePositionInFlatTree& visible_position, - BoundarySearchFunction search_function) { - return PreviousBoundaryAlgorithm(visible_position, search_function); -} - // --------- template <typename Strategy>
diff --git a/third_party/blink/renderer/core/editing/visible_units.h b/third_party/blink/renderer/core/editing/visible_units.h index 2417115ee..a696cc39 100644 --- a/third_party/blink/renderer/core/editing/visible_units.h +++ b/third_party/blink/renderer/core/editing/visible_units.h
@@ -267,22 +267,6 @@ // |FirstRectForRange| requires up-to-date layout. IntRect FirstRectForRange(const EphemeralRange&); -// Export below functions only for |VisibleUnit| family. -enum BoundarySearchContextAvailability { - kDontHaveMoreContext, - kMayHaveMoreContext -}; - -typedef unsigned (*BoundarySearchFunction)(const UChar*, - unsigned length, - unsigned offset, - BoundarySearchContextAvailability, - bool& need_more_context); - -Position PreviousBoundary(const VisiblePosition&, BoundarySearchFunction); -PositionInFlatTree PreviousBoundary(const VisiblePositionInFlatTree&, - BoundarySearchFunction); - CORE_EXPORT PositionWithAffinity AdjustForwardPositionToAvoidCrossingEditingBoundaries( const PositionWithAffinity&,
diff --git a/third_party/blink/renderer/core/editing/visible_units_sentence.cc b/third_party/blink/renderer/core/editing/visible_units_sentence.cc index 02609ad..50df69b 100644 --- a/third_party/blink/renderer/core/editing/visible_units_sentence.cc +++ b/third_party/blink/renderer/core/editing/visible_units_sentence.cc
@@ -123,8 +123,13 @@ // between sentences. const unsigned offset = FindNonSpaceCharacter(text, passed_offset); const int result = iterator->following(offset); - if (result == kTextBreakDone) + if (result == kTextBreakDone) { + if (text.length()) { + // Block boundaries are also sentence boundaries. + return Position::After(text.length()); + } return Position(); + } return result == 0 ? Position::Before(0) : Position::After(result - 1); }
diff --git a/third_party/blink/renderer/core/events/drag_event.h b/third_party/blink/renderer/core/events/drag_event.h index b540da9..11a6c43 100644 --- a/third_party/blink/renderer/core/events/drag_event.h +++ b/third_party/blink/renderer/core/events/drag_event.h
@@ -17,22 +17,28 @@ DEFINE_WRAPPERTYPEINFO(); public: - static DragEvent* Create() { return new DragEvent; } + static DragEvent* Create() { return MakeGarbageCollected<DragEvent>(); } static DragEvent* Create(const AtomicString& type, const DragEventInit* initializer, TimeTicks platform_time_stamp, SyntheticEventType synthetic_event_type) { - return new DragEvent(type, initializer, platform_time_stamp, - synthetic_event_type); + return MakeGarbageCollected<DragEvent>( + type, initializer, platform_time_stamp, synthetic_event_type); } static DragEvent* Create(const AtomicString& type, const DragEventInit* initializer) { - return new DragEvent(type, initializer, CurrentTimeTicks(), - kRealOrIndistinguishable); + return MakeGarbageCollected<DragEvent>( + type, initializer, CurrentTimeTicks(), kRealOrIndistinguishable); } + DragEvent(); + DragEvent(const AtomicString& type, + const DragEventInit*, + TimeTicks platform_time_stamp, + SyntheticEventType); + DataTransfer* getDataTransfer() const override { return IsDragEvent() ? data_transfer_.Get() : nullptr; } @@ -45,12 +51,6 @@ void Trace(blink::Visitor*) override; private: - DragEvent(); - DragEvent(const AtomicString& type, - const DragEventInit*, - TimeTicks platform_time_stamp, - SyntheticEventType); - Member<DataTransfer> data_transfer_; };
diff --git a/third_party/blink/renderer/core/events/focus_event.h b/third_party/blink/renderer/core/events/focus_event.h index 0791ce0..aa7c51024 100644 --- a/third_party/blink/renderer/core/events/focus_event.h +++ b/third_party/blink/renderer/core/events/focus_event.h
@@ -36,7 +36,7 @@ DEFINE_WRAPPERTYPEINFO(); public: - static FocusEvent* Create() { return new FocusEvent; } + static FocusEvent* Create() { return MakeGarbageCollected<FocusEvent>(); } static FocusEvent* Create(const AtomicString& type, Bubbles bubbles, @@ -44,15 +44,24 @@ int detail, EventTarget* related_target, InputDeviceCapabilities* source_capabilities) { - return new FocusEvent(type, bubbles, view, detail, related_target, - source_capabilities); + return MakeGarbageCollected<FocusEvent>( + type, bubbles, view, detail, related_target, source_capabilities); } static FocusEvent* Create(const AtomicString& type, const FocusEventInit* initializer) { - return new FocusEvent(type, initializer); + return MakeGarbageCollected<FocusEvent>(type, initializer); } + FocusEvent(); + FocusEvent(const AtomicString& type, + Bubbles, + AbstractView*, + int, + EventTarget*, + InputDeviceCapabilities*); + FocusEvent(const AtomicString& type, const FocusEventInit*); + EventTarget* relatedTarget() const { return related_target_.Get(); } void SetRelatedTarget(EventTarget* related_target) { related_target_ = related_target; @@ -66,15 +75,6 @@ void Trace(blink::Visitor*) override; private: - FocusEvent(); - FocusEvent(const AtomicString& type, - Bubbles, - AbstractView*, - int, - EventTarget*, - InputDeviceCapabilities*); - FocusEvent(const AtomicString& type, const FocusEventInit*); - Member<EventTarget> related_target_; };
diff --git a/third_party/blink/renderer/core/events/gesture_event.cc b/third_party/blink/renderer/core/events/gesture_event.cc index 632ac8d..7ee15a9 100644 --- a/third_party/blink/renderer/core/events/gesture_event.cc +++ b/third_party/blink/renderer/core/events/gesture_event.cc
@@ -70,7 +70,7 @@ default: return nullptr; } - return new GestureEvent(event_type, view, event); + return MakeGarbageCollected<GestureEvent>(event_type, view, event); } GestureEvent::GestureEvent(const AtomicString& event_type,
diff --git a/third_party/blink/renderer/core/events/gesture_event.h b/third_party/blink/renderer/core/events/gesture_event.h index aaffffd..0cd4fe36 100644 --- a/third_party/blink/renderer/core/events/gesture_event.h +++ b/third_party/blink/renderer/core/events/gesture_event.h
@@ -36,6 +36,8 @@ class CORE_EXPORT GestureEvent final : public UIEventWithKeyState { public: static GestureEvent* Create(AbstractView*, const WebGestureEvent&); + + GestureEvent(const AtomicString&, AbstractView*, const WebGestureEvent&); ~GestureEvent() override = default; bool IsGestureEvent() const override; @@ -47,8 +49,6 @@ void Trace(blink::Visitor*) override; private: - GestureEvent(const AtomicString&, AbstractView*, const WebGestureEvent&); - WebGestureEvent native_event_; };
diff --git a/third_party/blink/renderer/core/events/hash_change_event.h b/third_party/blink/renderer/core/events/hash_change_event.h index 86b1a22..e6bc7d7 100644 --- a/third_party/blink/renderer/core/events/hash_change_event.h +++ b/third_party/blink/renderer/core/events/hash_change_event.h
@@ -31,15 +31,31 @@ DEFINE_WRAPPERTYPEINFO(); public: - static HashChangeEvent* Create() { return new HashChangeEvent; } + static HashChangeEvent* Create() { + return MakeGarbageCollected<HashChangeEvent>(); + } static HashChangeEvent* Create(const String& old_url, const String& new_url) { - return new HashChangeEvent(old_url, new_url); + return MakeGarbageCollected<HashChangeEvent>(old_url, new_url); } static HashChangeEvent* Create(const AtomicString& type, const HashChangeEventInit* initializer) { - return new HashChangeEvent(type, initializer); + return MakeGarbageCollected<HashChangeEvent>(type, initializer); + } + + HashChangeEvent() = default; + HashChangeEvent(const String& old_url, const String& new_url) + : Event(event_type_names::kHashchange, Bubbles::kNo, Cancelable::kNo), + old_url_(old_url), + new_url_(new_url) {} + HashChangeEvent(const AtomicString& type, + const HashChangeEventInit* initializer) + : Event(type, initializer) { + if (initializer->hasOldURL()) + old_url_ = initializer->oldURL(); + if (initializer->hasNewURL()) + new_url_ = initializer->newURL(); } const String& oldURL() const { return old_url_; } @@ -52,22 +68,6 @@ void Trace(blink::Visitor* visitor) override { Event::Trace(visitor); } private: - HashChangeEvent() = default; - - HashChangeEvent(const String& old_url, const String& new_url) - : Event(event_type_names::kHashchange, Bubbles::kNo, Cancelable::kNo), - old_url_(old_url), - new_url_(new_url) {} - - HashChangeEvent(const AtomicString& type, - const HashChangeEventInit* initializer) - : Event(type, initializer) { - if (initializer->hasOldURL()) - old_url_ = initializer->oldURL(); - if (initializer->hasNewURL()) - new_url_ = initializer->newURL(); - } - String old_url_; String new_url_; };
diff --git a/third_party/blink/renderer/core/events/input_event.h b/third_party/blink/renderer/core/events/input_event.h index 0e8b447..1451d95 100644 --- a/third_party/blink/renderer/core/events/input_event.h +++ b/third_party/blink/renderer/core/events/input_event.h
@@ -19,7 +19,7 @@ public: static InputEvent* Create(const AtomicString& type, const InputEventInit* initializer) { - return new InputEvent(type, initializer); + return MakeGarbageCollected<InputEvent>(type, initializer); } // https://w3c.github.io/input-events/#h-interface-inputevent-attributes @@ -97,6 +97,8 @@ EventIsComposing, const StaticRangeVector*); + InputEvent(const AtomicString&, const InputEventInit*); + String inputType() const; const String& data() const { return data_; } DataTransfer* dataTransfer() const { return data_transfer_.Get(); } @@ -112,8 +114,6 @@ void Trace(blink::Visitor*) override; private: - InputEvent(const AtomicString&, const InputEventInit*); - InputType input_type_; String data_; Member<DataTransfer> data_transfer_;
diff --git a/third_party/blink/renderer/core/events/keyboard_event.cc b/third_party/blink/renderer/core/events/keyboard_event.cc index 19f4e7b..70610af 100644 --- a/third_party/blink/renderer/core/events/keyboard_event.cc +++ b/third_party/blink/renderer/core/events/keyboard_event.cc
@@ -86,7 +86,7 @@ initializer->ctrlKey(), initializer->altKey(), initializer->shiftKey(), initializer->metaKey()); } - return new KeyboardEvent(type, initializer); + return MakeGarbageCollected<KeyboardEvent>(type, initializer); } KeyboardEvent::KeyboardEvent() : location_(kDomKeyLocationStandard) {}
diff --git a/third_party/blink/renderer/core/events/keyboard_event.h b/third_party/blink/renderer/core/events/keyboard_event.h index 397fe45..7459d6b 100644 --- a/third_party/blink/renderer/core/events/keyboard_event.h +++ b/third_party/blink/renderer/core/events/keyboard_event.h
@@ -44,17 +44,21 @@ kDomKeyLocationNumpad = 0x03 }; - static KeyboardEvent* Create() { return new KeyboardEvent; } + static KeyboardEvent* Create() { + return MakeGarbageCollected<KeyboardEvent>(); + } static KeyboardEvent* Create(const WebKeyboardEvent& web_event, LocalDOMWindow* dom_window) { - return new KeyboardEvent(web_event, dom_window); + return MakeGarbageCollected<KeyboardEvent>(web_event, dom_window); } static KeyboardEvent* Create(ScriptState*, const AtomicString& type, const KeyboardEventInit*); + KeyboardEvent(); + KeyboardEvent(const WebKeyboardEvent&, LocalDOMWindow*); KeyboardEvent(const AtomicString&, const KeyboardEventInit*); ~KeyboardEvent() override; @@ -90,9 +94,6 @@ void Trace(blink::Visitor*) override; private: - KeyboardEvent(); - KeyboardEvent(const WebKeyboardEvent&, LocalDOMWindow*); - void InitLocationModifiers(unsigned location); std::unique_ptr<WebKeyboardEvent> key_event_;
diff --git a/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc b/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc index fabfea0..ae1d84d 100644 --- a/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc +++ b/third_party/blink/renderer/core/events/web_input_event_conversion_test.cc
@@ -61,7 +61,7 @@ key_event_init->setBubbles(true); key_event_init->setCancelable(true); key_event_init->setLocation(location); - return new KeyboardEvent("keydown", key_event_init); + return MakeGarbageCollected<KeyboardEvent>("keydown", key_event_init); } int GetModifiersForKeyLocationCode(KeyboardEvent::KeyLocationCode location) {
diff --git a/third_party/blink/renderer/core/execution_context/execution_context.cc b/third_party/blink/renderer/core/execution_context/execution_context.cc index 04f518b..c4d83a2 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.cc +++ b/third_party/blink/renderer/core/execution_context/execution_context.cc
@@ -205,7 +205,7 @@ FetchClientSettingsObjectSnapshot* ExecutionContext::CreateFetchClientSettingsObjectSnapshot() { - return new FetchClientSettingsObjectSnapshot( + return MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( BaseURL(), GetSecurityOrigin(), GetReferrerPolicy(), OutgoingReferrer(), GetHttpsState()); }
diff --git a/third_party/blink/renderer/core/exported/local_frame_client_impl.cc b/third_party/blink/renderer/core/exported/local_frame_client_impl.cc index be9d939..1b4000a 100644 --- a/third_party/blink/renderer/core/exported/local_frame_client_impl.cc +++ b/third_party/blink/renderer/core/exported/local_frame_client_impl.cc
@@ -165,7 +165,7 @@ : web_frame_(frame) {} LocalFrameClientImpl* LocalFrameClientImpl::Create(WebLocalFrameImpl* frame) { - return new LocalFrameClientImpl(frame); + return MakeGarbageCollected<LocalFrameClientImpl>(frame); } LocalFrameClientImpl::~LocalFrameClientImpl() = default;
diff --git a/third_party/blink/renderer/core/exported/local_frame_client_impl.h b/third_party/blink/renderer/core/exported/local_frame_client_impl.h index 5740f75..518e9b24 100644 --- a/third_party/blink/renderer/core/exported/local_frame_client_impl.h +++ b/third_party/blink/renderer/core/exported/local_frame_client_impl.h
@@ -53,6 +53,7 @@ public: static LocalFrameClientImpl* Create(WebLocalFrameImpl*); + explicit LocalFrameClientImpl(WebLocalFrameImpl*); ~LocalFrameClientImpl() override; void Trace(blink::Visitor*) override; @@ -299,8 +300,6 @@ bool UsePrintingLayout() const override; private: - explicit LocalFrameClientImpl(WebLocalFrameImpl*); - bool IsLocalFrameClientImpl() const override { return true; } WebDevToolsAgentImpl* DevToolsAgent();
diff --git a/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc b/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc index dd8f3cc..1a579cf 100644 --- a/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc +++ b/third_party/blink/renderer/core/exported/web_dev_tools_agent_impl.cc
@@ -302,7 +302,8 @@ probe_sink_(web_local_frame_impl_->GetFrame()->GetProbeSink()), resource_content_loader_(InspectorResourceContentLoader::Create( web_local_frame_impl_->GetFrame())), - inspected_frames_(new InspectedFrames(web_local_frame_impl_->GetFrame())), + inspected_frames_(MakeGarbageCollected<InspectedFrames>( + web_local_frame_impl_->GetFrame())), resource_container_( MakeGarbageCollected<InspectorResourceContainer>(inspected_frames_)), include_view_agents_(include_view_agents) {
diff --git a/third_party/blink/renderer/core/feature_policy/policy_test.cc b/third_party/blink/renderer/core/feature_policy/policy_test.cc index fe0b4e52..2d45104 100644 --- a/third_party/blink/renderer/core/feature_policy/policy_test.cc +++ b/third_party/blink/renderer/core/feature_policy/policy_test.cc
@@ -50,8 +50,9 @@ public: void SetUp() override { PolicyTest::SetUp(); - policy_ = new IFramePolicy(document_, {}, - SecurityOrigin::CreateFromString(kSelfOrigin)); + policy_ = MakeGarbageCollected<IFramePolicy>( + document_, ParsedFeaturePolicy(), + SecurityOrigin::CreateFromString(kSelfOrigin)); } };
diff --git a/third_party/blink/renderer/core/fetch/blob_bytes_consumer.cc b/third_party/blink/renderer/core/fetch/blob_bytes_consumer.cc index 17a17f5..9308f12 100644 --- a/third_party/blink/renderer/core/fetch/blob_bytes_consumer.cc +++ b/third_party/blink/renderer/core/fetch/blob_bytes_consumer.cc
@@ -28,8 +28,8 @@ scoped_refptr<EncodedFormData> form_data = EncodedFormData::Create(); form_data->AppendDataPipe(base::MakeRefCounted<WrappedDataPipeGetter>( blob_data_handle_->AsDataPipeGetter())); - nested_consumer_ = - new FormDataBytesConsumer(execution_context_, std::move(form_data)); + nested_consumer_ = MakeGarbageCollected<FormDataBytesConsumer>( + execution_context_, std::move(form_data)); if (client_) nested_consumer_->SetClient(client_); blob_data_handle_ = nullptr;
diff --git a/third_party/blink/renderer/core/fetch/body_stream_buffer_test.cc b/third_party/blink/renderer/core/fetch/body_stream_buffer_test.cc index e9861ad2..02464aca 100644 --- a/third_party/blink/renderer/core/fetch/body_stream_buffer_test.cc +++ b/third_party/blink/renderer/core/fetch/body_stream_buffer_test.cc
@@ -284,10 +284,11 @@ scoped_refptr<EncodedFormData> input_form_data = data->EncodeMultiPartFormData(); - BodyStreamBuffer* buffer = new BodyStreamBuffer( - scope.GetScriptState(), - new FormDataBytesConsumer(scope.GetExecutionContext(), input_form_data), - nullptr); + BodyStreamBuffer* buffer = + new BodyStreamBuffer(scope.GetScriptState(), + MakeGarbageCollected<FormDataBytesConsumer>( + scope.GetExecutionContext(), input_form_data), + nullptr); EXPECT_FALSE(buffer->IsStreamLocked(ASSERT_NO_EXCEPTION).value_or(true)); EXPECT_FALSE(buffer->IsStreamDisturbed(ASSERT_NO_EXCEPTION).value_or(true));
diff --git a/third_party/blink/renderer/core/fetch/fetch_header_list.cc b/third_party/blink/renderer/core/fetch/fetch_header_list.cc index 473013e..496df60 100644 --- a/third_party/blink/renderer/core/fetch/fetch_header_list.cc +++ b/third_party/blink/renderer/core/fetch/fetch_header_list.cc
@@ -13,7 +13,7 @@ namespace blink { FetchHeaderList* FetchHeaderList::Create() { - return new FetchHeaderList(); + return MakeGarbageCollected<FetchHeaderList>(); } FetchHeaderList* FetchHeaderList::Clone() const {
diff --git a/third_party/blink/renderer/core/fetch/fetch_header_list.h b/third_party/blink/renderer/core/fetch/fetch_header_list.h index 51d1c8a..28178044 100644 --- a/third_party/blink/renderer/core/fetch/fetch_header_list.h +++ b/third_party/blink/renderer/core/fetch/fetch_header_list.h
@@ -28,7 +28,9 @@ static FetchHeaderList* Create(); FetchHeaderList* Clone() const; + FetchHeaderList(); ~FetchHeaderList(); + void Append(const String&, const String&); void Set(const String&, const String&); // FIXME: Implement parse() @@ -53,8 +55,6 @@ void Trace(blink::Visitor* visitor) {} private: - FetchHeaderList(); - // While using STL data structures in Blink is not very common or // encouraged, we do need a multimap here. The closest WTF structure // comparable to what we need would be a
diff --git a/third_party/blink/renderer/core/fetch/fetch_manager.cc b/third_party/blink/renderer/core/fetch/fetch_manager.cc index 93f872d3..d23653c3 100644 --- a/third_party/blink/renderer/core/fetch/fetch_manager.cc +++ b/third_party/blink/renderer/core/fetch/fetch_manager.cc
@@ -210,10 +210,17 @@ FetchRequestData* request, bool is_isolated_world, AbortSignal* signal) { - return new Loader(execution_context, fetch_manager, resolver, request, - is_isolated_world, signal); + return MakeGarbageCollected<Loader>(execution_context, fetch_manager, + resolver, request, is_isolated_world, + signal); } + Loader(ExecutionContext*, + FetchManager*, + ScriptPromiseResolver*, + FetchRequestData*, + bool is_isolated_world, + AbortSignal*); ~Loader() override; void Trace(blink::Visitor*) override; @@ -305,8 +312,8 @@ SubresourceIntegrityHelper::DoReport(*loader_->GetExecutionContext(), report_info); if (check_result) { - updater_->Update( - new FormDataBytesConsumer(buffer_.data(), buffer_.size())); + updater_->Update(MakeGarbageCollected<FormDataBytesConsumer>( + buffer_.data(), buffer_.size())); loader_->resolver_->Resolve(response_); loader_->resolver_.Clear(); // FetchManager::Loader::didFinishLoading() can @@ -349,13 +356,6 @@ }; private: - Loader(ExecutionContext*, - FetchManager*, - ScriptPromiseResolver*, - FetchRequestData*, - bool is_isolated_world, - AbortSignal*); - void PerformSchemeFetch(ExceptionState&); void PerformNetworkError(const String& message); void PerformHTTPFetch(ExceptionState&); @@ -602,7 +602,7 @@ resolver_.Clear(); } else { DCHECK(!integrity_verifier_); - integrity_verifier_ = new SRIVerifier( + integrity_verifier_ = MakeGarbageCollected<SRIVerifier>( std::move(handle), sri_consumer, r, this, fetch_request_data_->Integrity(), response.Url(), r->GetResponse()->GetType(), @@ -954,7 +954,7 @@ } FetchManager* FetchManager::Create(ExecutionContext* execution_context) { - return new FetchManager(execution_context); + return MakeGarbageCollected<FetchManager>(execution_context); } FetchManager::FetchManager(ExecutionContext* execution_context)
diff --git a/third_party/blink/renderer/core/fetch/fetch_manager.h b/third_party/blink/renderer/core/fetch/fetch_manager.h index f6e04ff3..521f05d8 100644 --- a/third_party/blink/renderer/core/fetch/fetch_manager.h +++ b/third_party/blink/renderer/core/fetch/fetch_manager.h
@@ -24,6 +24,9 @@ public: static FetchManager* Create(ExecutionContext*); + + explicit FetchManager(ExecutionContext*); + ScriptPromise Fetch(ScriptState*, FetchRequestData*, AbortSignal*, @@ -33,8 +36,6 @@ void Trace(blink::Visitor*) override; private: - explicit FetchManager(ExecutionContext*); - class Loader; // Removes loader from |m_loaders|.
diff --git a/third_party/blink/renderer/core/fetch/fetch_request_data.cc b/third_party/blink/renderer/core/fetch/fetch_request_data.cc index 3507f2d..83ff752 100644 --- a/third_party/blink/renderer/core/fetch/fetch_request_data.cc +++ b/third_party/blink/renderer/core/fetch/fetch_request_data.cc
@@ -22,7 +22,7 @@ namespace blink { FetchRequestData* FetchRequestData::Create() { - return new FetchRequestData(); + return MakeGarbageCollected<FetchRequestData>(); } FetchRequestData* FetchRequestData::Create( @@ -37,8 +37,8 @@ if (scoped_refptr<EncodedFormData> body = web_request.Body()) { request->SetBuffer(new BodyStreamBuffer( script_state, - new FormDataBytesConsumer(ExecutionContext::From(script_state), - std::move(body)), + MakeGarbageCollected<FormDataBytesConsumer>( + ExecutionContext::From(script_state), std::move(body)), nullptr /* AbortSignal */)); } else if (web_request.GetBlobDataHandle()) { request->SetBuffer(new BodyStreamBuffer(
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 56a61b2..485bed1 100644 --- a/third_party/blink/renderer/core/fetch/fetch_request_data.h +++ b/third_party/blink/renderer/core/fetch/fetch_request_data.h
@@ -43,6 +43,8 @@ // Call Request::refreshBody() after calling clone() or pass(). FetchRequestData* Clone(ScriptState*, ExceptionState&); FetchRequestData* Pass(ScriptState*, ExceptionState&); + + FetchRequestData(); ~FetchRequestData(); void SetMethod(AtomicString method) { method_ = method; } @@ -115,8 +117,6 @@ void Trace(blink::Visitor*); private: - FetchRequestData(); - FetchRequestData* CloneExceptBody(); AtomicString method_;
diff --git a/third_party/blink/renderer/core/fetch/fetch_response_data.cc b/third_party/blink/renderer/core/fetch/fetch_response_data.cc index 87e1646..cdd01b3 100644 --- a/third_party/blink/renderer/core/fetch/fetch_response_data.cc +++ b/third_party/blink/renderer/core/fetch/fetch_response_data.cc
@@ -45,14 +45,15 @@ // "Unless stated otherwise, a response's url is null, status is 200, status // message is the empty byte sequence, header list is an empty header list, // and body is null." - return new FetchResponseData(Type::kDefault, 200, g_empty_atom); + return MakeGarbageCollected<FetchResponseData>(Type::kDefault, 200, + g_empty_atom); } FetchResponseData* FetchResponseData::CreateNetworkErrorResponse() { // "A network error is a response whose status is always 0, status message // is always the empty byte sequence, header list is aways an empty list, // and body is always null." - return new FetchResponseData(Type::kError, 0, g_empty_atom); + return MakeGarbageCollected<FetchResponseData>(Type::kError, 0, g_empty_atom); } FetchResponseData* FetchResponseData::CreateWithBuffer( @@ -67,8 +68,8 @@ // "A basic filtered response is a filtered response whose type is |basic|, // header list excludes any headers in internal response's header list whose // name is `Set-Cookie` or `Set-Cookie2`." - FetchResponseData* response = - new FetchResponseData(Type::kBasic, status_, status_message_); + FetchResponseData* response = MakeGarbageCollected<FetchResponseData>( + Type::kBasic, status_, status_message_); response->SetURLList(url_list_); for (const auto& header : header_list_->List()) { if (FetchUtils::IsForbiddenResponseHeaderName(header.first)) @@ -91,8 +92,8 @@ // `Pragma`, and except those whose name is one of the values resulting from // parsing `Access-Control-Expose-Headers` in internal response's header // list." - FetchResponseData* response = - new FetchResponseData(Type::kCors, status_, status_message_); + FetchResponseData* response = MakeGarbageCollected<FetchResponseData>( + Type::kCors, status_, status_message_); response->SetURLList(url_list_); for (const auto& header : header_list_->List()) { const String& name = header.first; @@ -118,7 +119,7 @@ // // https://fetch.spec.whatwg.org/#concept-filtered-response-opaque FetchResponseData* response = - new FetchResponseData(Type::kOpaque, 0, g_empty_atom); + MakeGarbageCollected<FetchResponseData>(Type::kOpaque, 0, g_empty_atom); response->internal_response_ = const_cast<FetchResponseData*>(this); return response; } @@ -131,8 +132,8 @@ // header list is the empty list, body is null, and cache state is 'none'." // // https://fetch.spec.whatwg.org/#concept-filtered-response-opaque-redirect - FetchResponseData* response = - new FetchResponseData(Type::kOpaqueRedirect, 0, g_empty_atom); + FetchResponseData* response = MakeGarbageCollected<FetchResponseData>( + Type::kOpaqueRedirect, 0, g_empty_atom); response->SetURLList(url_list_); response->internal_response_ = const_cast<FetchResponseData*>(this); return response;
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 2ffc6e7..d111677 100644 --- a/third_party/blink/renderer/core/fetch/fetch_response_data.h +++ b/third_party/blink/renderer/core/fetch/fetch_response_data.h
@@ -44,6 +44,10 @@ static FetchResponseData* CreateNetworkErrorResponse(); static FetchResponseData* CreateWithBuffer(BodyStreamBuffer*); + FetchResponseData(network::mojom::FetchResponseType, + unsigned short, + AtomicString); + FetchResponseData* CreateBasicFilteredResponse() const; FetchResponseData* CreateCorsFilteredResponse( const WebHTTPHeaderSet& exposed_headers) const; @@ -106,10 +110,6 @@ void Trace(blink::Visitor*); private: - FetchResponseData(network::mojom::FetchResponseType, - unsigned short, - AtomicString); - network::mojom::FetchResponseType type_; std::unique_ptr<TerminationReason> termination_reason_; Vector<KURL> url_list_;
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 1087668..1ac7e1b 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
@@ -26,12 +26,16 @@ CORE_EXPORT FormDataBytesConsumer(const void* data, wtf_size_t); CORE_EXPORT FormDataBytesConsumer(ExecutionContext*, scoped_refptr<EncodedFormData>); + CORE_EXPORT FormDataBytesConsumer(ExecutionContext*, + scoped_refptr<EncodedFormData>, + BytesConsumer* consumer_for_testing); + CORE_EXPORT static FormDataBytesConsumer* CreateForTesting( ExecutionContext* execution_context, scoped_refptr<EncodedFormData> form_data, BytesConsumer* consumer) { - return new FormDataBytesConsumer(execution_context, std::move(form_data), - consumer); + return MakeGarbageCollected<FormDataBytesConsumer>( + execution_context, std::move(form_data), consumer); } // BytesConsumer implementation @@ -68,9 +72,6 @@ static BytesConsumer* GetImpl(ExecutionContext*, scoped_refptr<EncodedFormData>, BytesConsumer* consumer_for_testing); - CORE_EXPORT FormDataBytesConsumer(ExecutionContext*, - scoped_refptr<EncodedFormData>, - BytesConsumer* consumer_for_testing); const TraceWrapperMember<BytesConsumer> impl_; };
diff --git a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc index 6f28747..0fa2fc1 100644 --- a/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc +++ b/third_party/blink/renderer/core/fetch/form_data_bytes_consumer_test.cc
@@ -126,9 +126,10 @@ }; TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromString) { - auto result = (new BytesConsumerTestUtil::TwoPhaseReader( - new FormDataBytesConsumer("hello, world"))) - ->Run(); + auto result = + (new BytesConsumerTestUtil::TwoPhaseReader( + MakeGarbageCollected<FormDataBytesConsumer>("hello, world"))) + ->Run(); EXPECT_EQ(Result::kDone, result.first); EXPECT_EQ("hello, world", BytesConsumerTestUtil::CharVectorToString(result.second)); @@ -137,7 +138,7 @@ TEST_F(FormDataBytesConsumerTest, TwoPhaseReadFromStringNonLatin) { constexpr UChar kCs[] = {0x3042, 0}; auto result = (new BytesConsumerTestUtil::TwoPhaseReader( - new FormDataBytesConsumer(String(kCs)))) + MakeGarbageCollected<FormDataBytesConsumer>(String(kCs)))) ->Run(); EXPECT_EQ(Result::kDone, result.first); EXPECT_EQ("\xe3\x81\x82", @@ -149,7 +150,7 @@ 0x42, 0x30, 0x42, 0x99, 0x88}; DOMArrayBuffer* buffer = DOMArrayBuffer::Create(kData, arraysize(kData)); auto result = (new BytesConsumerTestUtil::TwoPhaseReader( - new FormDataBytesConsumer(buffer))) + MakeGarbageCollected<FormDataBytesConsumer>(buffer))) ->Run(); Vector<char> expected; expected.Append(kData, arraysize(kData)); @@ -163,10 +164,10 @@ 0x42, 0x30, 0x42, 0x99, 0x88}; constexpr size_t kOffset = 1, kSize = 4; DOMArrayBuffer* buffer = DOMArrayBuffer::Create(kData, arraysize(kData)); - auto result = - (new BytesConsumerTestUtil::TwoPhaseReader(new FormDataBytesConsumer( - DOMUint8Array::Create(buffer, kOffset, kSize)))) - ->Run(); + auto result = (new BytesConsumerTestUtil::TwoPhaseReader( + MakeGarbageCollected<FormDataBytesConsumer>( + DOMUint8Array::Create(buffer, kOffset, kSize)))) + ->Run(); Vector<char> expected; expected.Append(kData + kOffset, kSize); @@ -179,9 +180,10 @@ data->AppendData("foo", 3); data->AppendData("hoge", 4); - auto result = (new BytesConsumerTestUtil::TwoPhaseReader( - new FormDataBytesConsumer(&GetDocument(), data))) - ->Run(); + auto result = + (new BytesConsumerTestUtil::TwoPhaseReader( + MakeGarbageCollected<FormDataBytesConsumer>(&GetDocument(), data))) + ->Run(); EXPECT_EQ(Result::kDone, result.first); EXPECT_EQ("foohoge", BytesConsumerTestUtil::CharVectorToString(result.second)); @@ -213,7 +215,8 @@ } TEST_F(FormDataBytesConsumerTest, EndReadCanReturnDone) { - BytesConsumer* consumer = new FormDataBytesConsumer("hello, world"); + BytesConsumer* consumer = + MakeGarbageCollected<FormDataBytesConsumer>("hello, world"); const char* buffer = nullptr; size_t available = 0; ASSERT_EQ(Result::kOk, consumer->BeginRead(&buffer, &available)); @@ -226,7 +229,8 @@ } TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromString) { - BytesConsumer* consumer = new FormDataBytesConsumer("hello, world"); + BytesConsumer* consumer = + MakeGarbageCollected<FormDataBytesConsumer>("hello, world"); scoped_refptr<BlobDataHandle> blob_data_handle = consumer->DrainAsBlobDataHandle(); ASSERT_TRUE(blob_data_handle); @@ -241,8 +245,8 @@ } TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromArrayBuffer) { - BytesConsumer* consumer = - new FormDataBytesConsumer(DOMArrayBuffer::Create("foo", 3)); + BytesConsumer* consumer = MakeGarbageCollected<FormDataBytesConsumer>( + DOMArrayBuffer::Create("foo", 3)); scoped_refptr<BlobDataHandle> blob_data_handle = consumer->DrainAsBlobDataHandle(); ASSERT_TRUE(blob_data_handle); @@ -263,8 +267,8 @@ scoped_refptr<EncodedFormData> input_form_data = data->EncodeMultiPartFormData(); - BytesConsumer* consumer = - new FormDataBytesConsumer(&GetDocument(), input_form_data); + BytesConsumer* consumer = MakeGarbageCollected<FormDataBytesConsumer>( + &GetDocument(), input_form_data); scoped_refptr<BlobDataHandle> blob_data_handle = consumer->DrainAsBlobDataHandle(); ASSERT_TRUE(blob_data_handle); @@ -282,8 +286,8 @@ TEST_F(FormDataBytesConsumerTest, DrainAsBlobDataHandleFromComplexFormData) { scoped_refptr<EncodedFormData> input_form_data = ComplexFormData(); - BytesConsumer* consumer = - new FormDataBytesConsumer(&GetDocument(), input_form_data); + BytesConsumer* consumer = MakeGarbageCollected<FormDataBytesConsumer>( + &GetDocument(), input_form_data); scoped_refptr<BlobDataHandle> blob_data_handle = consumer->DrainAsBlobDataHandle(); ASSERT_TRUE(blob_data_handle); @@ -296,7 +300,8 @@ } TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromString) { - BytesConsumer* consumer = new FormDataBytesConsumer("hello, world"); + BytesConsumer* consumer = + MakeGarbageCollected<FormDataBytesConsumer>("hello, world"); scoped_refptr<EncodedFormData> form_data = consumer->DrainAsFormData(); ASSERT_TRUE(form_data); EXPECT_EQ("hello, world", form_data->FlattenToString()); @@ -309,8 +314,8 @@ } TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromArrayBuffer) { - BytesConsumer* consumer = - new FormDataBytesConsumer(DOMArrayBuffer::Create("foo", 3)); + BytesConsumer* consumer = MakeGarbageCollected<FormDataBytesConsumer>( + DOMArrayBuffer::Create("foo", 3)); scoped_refptr<EncodedFormData> form_data = consumer->DrainAsFormData(); ASSERT_TRUE(form_data); EXPECT_TRUE(form_data->IsSafeToSendToAnotherThread()); @@ -330,8 +335,8 @@ scoped_refptr<EncodedFormData> input_form_data = data->EncodeMultiPartFormData(); - BytesConsumer* consumer = - new FormDataBytesConsumer(&GetDocument(), input_form_data); + BytesConsumer* consumer = MakeGarbageCollected<FormDataBytesConsumer>( + &GetDocument(), input_form_data); EXPECT_EQ(input_form_data, consumer->DrainAsFormData()); EXPECT_FALSE(consumer->DrainAsBlobDataHandle()); const char* buffer = nullptr; @@ -343,8 +348,8 @@ TEST_F(FormDataBytesConsumerTest, DrainAsFormDataFromComplexFormData) { scoped_refptr<EncodedFormData> input_form_data = ComplexFormData(); - BytesConsumer* consumer = - new FormDataBytesConsumer(&GetDocument(), input_form_data); + BytesConsumer* consumer = MakeGarbageCollected<FormDataBytesConsumer>( + &GetDocument(), input_form_data); EXPECT_EQ(input_form_data, consumer->DrainAsFormData()); EXPECT_FALSE(consumer->DrainAsBlobDataHandle()); const char* buffer = nullptr; @@ -356,7 +361,8 @@ TEST_F(FormDataBytesConsumerTest, BeginReadAffectsDraining) { const char* buffer = nullptr; size_t available = 0; - BytesConsumer* consumer = new FormDataBytesConsumer("hello, world"); + BytesConsumer* consumer = + MakeGarbageCollected<FormDataBytesConsumer>("hello, world"); ASSERT_EQ(Result::kOk, consumer->BeginRead(&buffer, &available)); EXPECT_EQ("hello, world", String(buffer, available)); @@ -447,7 +453,8 @@ // Tests consuming an EncodedFormData with data pipe elements. TEST_F(FormDataBytesConsumerTest, DataPipeFormData) { scoped_refptr<EncodedFormData> input_form_data = DataPipeFormData(); - auto* consumer = new FormDataBytesConsumer(&GetDocument(), input_form_data); + auto* consumer = MakeGarbageCollected<FormDataBytesConsumer>(&GetDocument(), + input_form_data); auto* reader = new BytesConsumerTestUtil::TwoPhaseReader(consumer); std::pair<BytesConsumer::Result, Vector<char>> result = reader->Run(); EXPECT_EQ(Result::kDone, result.first); @@ -458,7 +465,8 @@ // Tests DrainAsFormData() on an EncodedFormData with data pipe elements. TEST_F(FormDataBytesConsumerTest, DataPipeFormData_DrainAsFormData) { scoped_refptr<EncodedFormData> input_form_data = DataPipeFormData(); - auto* consumer = new FormDataBytesConsumer(&GetDocument(), input_form_data); + auto* consumer = MakeGarbageCollected<FormDataBytesConsumer>(&GetDocument(), + input_form_data); scoped_refptr<EncodedFormData> drained_form_data = consumer->DrainAsFormData(); EXPECT_EQ(*input_form_data, *drained_form_data); @@ -471,7 +479,8 @@ DataPipeFormData_DrainAsFormDataWhileReading) { // Create the consumer and start reading. scoped_refptr<EncodedFormData> input_form_data = DataPipeFormData(); - auto* consumer = new FormDataBytesConsumer(&GetDocument(), input_form_data); + auto* consumer = MakeGarbageCollected<FormDataBytesConsumer>(&GetDocument(), + input_form_data); const char* buffer = nullptr; size_t available = 0; EXPECT_EQ(BytesConsumer::Result::kOk,
diff --git a/third_party/blink/renderer/core/fetch/headers.cc b/third_party/blink/renderer/core/fetch/headers.cc index 0334e25..1dd5e6a6 100644 --- a/third_party/blink/renderer/core/fetch/headers.cc +++ b/third_party/blink/renderer/core/fetch/headers.cc
@@ -46,7 +46,7 @@ } // namespace Headers* Headers::Create(ExceptionState&) { - return new Headers; + return MakeGarbageCollected<Headers>(); } Headers* Headers::Create(const HeadersInit& init, @@ -61,7 +61,7 @@ } Headers* Headers::Create(FetchHeaderList* header_list) { - return new Headers(header_list); + return MakeGarbageCollected<Headers>(header_list); } Headers* Headers::Clone() const {
diff --git a/third_party/blink/renderer/core/fetch/headers.h b/third_party/blink/renderer/core/fetch/headers.h index 0fbdd7e..3b05567 100644 --- a/third_party/blink/renderer/core/fetch/headers.h +++ b/third_party/blink/renderer/core/fetch/headers.h
@@ -39,6 +39,10 @@ // Shares the FetchHeaderList. Called when creating a Request or Response. static Headers* Create(FetchHeaderList*); + Headers(); + // Shares the FetchHeaderList. Called when creating a Request or Response. + explicit Headers(FetchHeaderList*); + Headers* Clone() const; // Headers.idl implementation. @@ -59,10 +63,6 @@ void Trace(blink::Visitor*) override; private: - Headers(); - // Shares the FetchHeaderList. Called when creating a Request or Response. - explicit Headers(FetchHeaderList*); - // These methods should only be called when size() would return 0. void FillWith(const Vector<Vector<String>>&, ExceptionState&); void FillWith(const Vector<std::pair<String, String>>&, ExceptionState&);
diff --git a/third_party/blink/renderer/core/fetch/request.cc b/third_party/blink/renderer/core/fetch/request.cc index d1a52b8e..ddc8fa3 100644 --- a/third_party/blink/renderer/core/fetch/request.cc +++ b/third_party/blink/renderer/core/fetch/request.cc
@@ -111,7 +111,7 @@ // is potentially unsafe. DOMArrayBuffer* array_buffer = V8ArrayBuffer::ToImpl(body.As<v8::Object>()); return_buffer = new BodyStreamBuffer( - script_state, new FormDataBytesConsumer(array_buffer), + script_state, MakeGarbageCollected<FormDataBytesConsumer>(array_buffer), nullptr /* AbortSignal */); } else if (body->IsArrayBufferView()) { // Avoid calling into V8 from the following constructor parameters, which @@ -119,7 +119,8 @@ DOMArrayBufferView* array_buffer_view = V8ArrayBufferView::ToImpl(body.As<v8::Object>()); return_buffer = new BodyStreamBuffer( - script_state, new FormDataBytesConsumer(array_buffer_view), + script_state, + MakeGarbageCollected<FormDataBytesConsumer>(array_buffer_view), nullptr /* AbortSignal */); } else if (V8FormData::hasInstance(body, isolate)) { scoped_refptr<EncodedFormData> form_data = @@ -128,17 +129,19 @@ // FormDataEncoder::generateUniqueBoundaryString. content_type = AtomicString("multipart/form-data; boundary=") + form_data->Boundary().data(); - return_buffer = new BodyStreamBuffer( - script_state, - new FormDataBytesConsumer(execution_context, std::move(form_data)), - nullptr /* AbortSignal */); + return_buffer = + new BodyStreamBuffer(script_state, + MakeGarbageCollected<FormDataBytesConsumer>( + execution_context, std::move(form_data)), + nullptr /* AbortSignal */); } else if (V8URLSearchParams::hasInstance(body, isolate)) { scoped_refptr<EncodedFormData> form_data = V8URLSearchParams::ToImpl(body.As<v8::Object>())->ToEncodedFormData(); - return_buffer = new BodyStreamBuffer( - script_state, - new FormDataBytesConsumer(execution_context, std::move(form_data)), - nullptr /* AbortSignal */); + return_buffer = + new BodyStreamBuffer(script_state, + MakeGarbageCollected<FormDataBytesConsumer>( + execution_context, std::move(form_data)), + nullptr /* AbortSignal */); content_type = "application/x-www-form-urlencoded;charset=UTF-8"; } else { String string = NativeValueTraits<IDLUSVString>::NativeValue( @@ -146,9 +149,9 @@ if (exception_state.HadException()) return nullptr; - return_buffer = - new BodyStreamBuffer(script_state, new FormDataBytesConsumer(string), - nullptr /* AbortSignal */); + return_buffer = new BodyStreamBuffer( + script_state, MakeGarbageCollected<FormDataBytesConsumer>(string), + nullptr /* AbortSignal */); content_type = "text/plain;charset=UTF-8"; }
diff --git a/third_party/blink/renderer/core/fetch/response.cc b/third_party/blink/renderer/core/fetch/response.cc index 15d26c8b..fb9a086 100644 --- a/third_party/blink/renderer/core/fetch/response.cc +++ b/third_party/blink/renderer/core/fetch/response.cc
@@ -168,16 +168,17 @@ // Avoid calling into V8 from the following constructor parameters, which // is potentially unsafe. DOMArrayBuffer* array_buffer = V8ArrayBuffer::ToImpl(body.As<v8::Object>()); - body_buffer = new BodyStreamBuffer(script_state, - new FormDataBytesConsumer(array_buffer), - nullptr /* AbortSignal */); + body_buffer = new BodyStreamBuffer( + script_state, MakeGarbageCollected<FormDataBytesConsumer>(array_buffer), + nullptr /* AbortSignal */); } else if (body->IsArrayBufferView()) { // Avoid calling into V8 from the following constructor parameters, which // is potentially unsafe. DOMArrayBufferView* array_buffer_view = V8ArrayBufferView::ToImpl(body.As<v8::Object>()); body_buffer = new BodyStreamBuffer( - script_state, new FormDataBytesConsumer(array_buffer_view), + script_state, + MakeGarbageCollected<FormDataBytesConsumer>(array_buffer_view), nullptr /* AbortSignal */); } else if (V8FormData::hasInstance(body, isolate)) { scoped_refptr<EncodedFormData> form_data = @@ -186,17 +187,19 @@ // FormDataEncoder::generateUniqueBoundaryString. content_type = AtomicString("multipart/form-data; boundary=") + form_data->Boundary().data(); - body_buffer = new BodyStreamBuffer( - script_state, - new FormDataBytesConsumer(execution_context, std::move(form_data)), - nullptr /* AbortSignal */); + body_buffer = + new BodyStreamBuffer(script_state, + MakeGarbageCollected<FormDataBytesConsumer>( + execution_context, std::move(form_data)), + nullptr /* AbortSignal */); } else if (V8URLSearchParams::hasInstance(body, isolate)) { scoped_refptr<EncodedFormData> form_data = V8URLSearchParams::ToImpl(body.As<v8::Object>())->ToEncodedFormData(); - body_buffer = new BodyStreamBuffer( - script_state, - new FormDataBytesConsumer(execution_context, std::move(form_data)), - nullptr /* AbortSignal */); + body_buffer = + new BodyStreamBuffer(script_state, + MakeGarbageCollected<FormDataBytesConsumer>( + execution_context, std::move(form_data)), + nullptr /* AbortSignal */); content_type = "application/x-www-form-urlencoded;charset=UTF-8"; } else if (V8ReadableStream::hasInstance(body, isolate)) { UseCounter::Count(execution_context, @@ -208,9 +211,9 @@ isolate, body, exception_state); if (exception_state.HadException()) return nullptr; - body_buffer = - new BodyStreamBuffer(script_state, new FormDataBytesConsumer(string), - nullptr /* AbortSignal */); + body_buffer = new BodyStreamBuffer( + script_state, MakeGarbageCollected<FormDataBytesConsumer>(string), + nullptr /* AbortSignal */); content_type = "text/plain;charset=UTF-8"; } return Create(script_state, body_buffer, content_type, init, exception_state);
diff --git a/third_party/blink/renderer/core/fileapi/file.cc b/third_party/blink/renderer/core/fileapi/file.cc index 62eb77df..22cfc783 100644 --- a/third_party/blink/renderer/core/fileapi/file.cc +++ b/third_party/blink/renderer/core/fileapi/file.cc
@@ -152,7 +152,8 @@ File* File::CreateWithRelativePath(const String& path, const String& relative_path) { - File* file = new File(path, File::kAllContentTypes, File::kIsUserVisible); + File* file = MakeGarbageCollected<File>(path, File::kAllContentTypes, + File::kIsUserVisible); file->relative_path_ = relative_path; return file; } @@ -248,7 +249,7 @@ relative_path_(other.relative_path_) {} File* File::Clone(const String& name) const { - File* file = new File(*this); + File* file = MakeGarbageCollected<File>(*this); if (!name.IsNull()) file->name_ = name; return file;
diff --git a/third_party/blink/renderer/core/fileapi/file.h b/third_party/blink/renderer/core/fileapi/file.h index cfb5fed..2ca09ab8 100644 --- a/third_party/blink/renderer/core/fileapi/file.h +++ b/third_party/blink/renderer/core/fileapi/file.h
@@ -67,13 +67,14 @@ static File* Create(const String& path, ContentTypeLookupPolicy policy = kWellKnownContentTypes) { - return new File(path, policy, File::kIsUserVisible); + return MakeGarbageCollected<File>(path, policy, File::kIsUserVisible); } static File* Create(const String& name, double modification_time, scoped_refptr<BlobDataHandle> blob_data_handle) { - return new File(name, modification_time, std::move(blob_data_handle)); + return MakeGarbageCollected<File>(name, modification_time, + std::move(blob_data_handle)); } // For deserialization. @@ -86,9 +87,9 @@ uint64_t size, double last_modified, scoped_refptr<BlobDataHandle> blob_data_handle) { - return new File(path, name, relative_path, user_visibility, - has_snapshot_data, size, last_modified, - std::move(blob_data_handle)); + return MakeGarbageCollected<File>( + path, name, relative_path, user_visibility, has_snapshot_data, size, + last_modified, std::move(blob_data_handle)); } static File* CreateFromIndexedSerialization( const String& path, @@ -96,8 +97,9 @@ uint64_t size, double last_modified, scoped_refptr<BlobDataHandle> blob_data_handle) { - return new File(path, name, String(), kIsNotUserVisible, true, size, - last_modified, std::move(blob_data_handle)); + return MakeGarbageCollected<File>(path, name, String(), kIsNotUserVisible, + true, size, last_modified, + std::move(blob_data_handle)); } static File* CreateWithRelativePath(const String& path, @@ -112,15 +114,35 @@ static File* CreateForFileSystemFile(const String& name, const FileMetadata& metadata, UserVisibility user_visibility) { - return new File(name, metadata, user_visibility); + return MakeGarbageCollected<File>(name, metadata, user_visibility); } static File* CreateForFileSystemFile(const KURL& url, const FileMetadata& metadata, UserVisibility user_visibility) { - return new File(url, metadata, user_visibility); + return MakeGarbageCollected<File>(url, metadata, user_visibility); } + File(const String& path, ContentTypeLookupPolicy, UserVisibility); + File(const String& path, + const String& name, + ContentTypeLookupPolicy, + UserVisibility); + File(const String& path, + const String& name, + const String& relative_path, + UserVisibility, + bool has_snapshot_data, + uint64_t size, + double last_modified, + scoped_refptr<BlobDataHandle>); + File(const String& name, + double modification_time, + scoped_refptr<BlobDataHandle>); + File(const String& name, const FileMetadata&, UserVisibility); + File(const KURL& file_system_url, const FileMetadata&, UserVisibility); + File(const File&); + KURL FileSystemURL() const { #if DCHECK_IS_ON() DCHECK(HasValidFileSystemURL()); @@ -132,10 +154,12 @@ // associated DOM properties) that differs from the one provided in the path. static File* CreateForUserProvidedFile(const String& path, const String& display_name) { - if (display_name.IsEmpty()) - return new File(path, File::kAllContentTypes, File::kIsUserVisible); - return new File(path, display_name, File::kAllContentTypes, - File::kIsUserVisible); + if (display_name.IsEmpty()) { + return MakeGarbageCollected<File>(path, File::kAllContentTypes, + File::kIsUserVisible); + } + return MakeGarbageCollected<File>( + path, display_name, File::kAllContentTypes, File::kIsUserVisible); } static File* CreateForFileSystemFile( @@ -143,8 +167,9 @@ const String& name, ContentTypeLookupPolicy policy = kWellKnownContentTypes) { if (name.IsEmpty()) - return new File(path, policy, File::kIsNotUserVisible); - return new File(path, name, policy, File::kIsNotUserVisible); + return MakeGarbageCollected<File>(path, policy, File::kIsNotUserVisible); + return MakeGarbageCollected<File>(path, name, policy, + File::kIsNotUserVisible); } File* Clone(const String& name = String()) const; @@ -196,26 +221,6 @@ bool HasSameSource(const File& other) const; private: - File(const String& path, ContentTypeLookupPolicy, UserVisibility); - File(const String& path, - const String& name, - ContentTypeLookupPolicy, - UserVisibility); - File(const String& path, - const String& name, - const String& relative_path, - UserVisibility, - bool has_snapshot_data, - uint64_t size, - double last_modified, - scoped_refptr<BlobDataHandle>); - File(const String& name, - double modification_time, - scoped_refptr<BlobDataHandle>); - File(const String& name, const FileMetadata&, UserVisibility); - File(const KURL& file_system_url, const FileMetadata&, UserVisibility); - File(const File&); - void InvalidateSnapshotMetadata() { snapshot_size_ = -1; } // Returns File's last modified time (in MS since Epoch.)
diff --git a/third_party/blink/renderer/core/fileapi/file_list.h b/third_party/blink/renderer/core/fileapi/file_list.h index e934abb..0eeec3d 100644 --- a/third_party/blink/renderer/core/fileapi/file_list.h +++ b/third_party/blink/renderer/core/fileapi/file_list.h
@@ -38,7 +38,9 @@ DEFINE_WRAPPERTYPEINFO(); public: - static FileList* Create() { return new FileList; } + static FileList* Create() { return MakeGarbageCollected<FileList>(); } + + FileList(); unsigned length() const { return files_.size(); } File* item(unsigned index) const; @@ -51,8 +53,6 @@ void Trace(blink::Visitor*) override; private: - FileList(); - HeapVector<Member<File>> files_; };
diff --git a/third_party/blink/renderer/core/fileapi/file_reader.cc b/third_party/blink/renderer/core/fileapi/file_reader.cc index d0eae59..7b595c4 100644 --- a/third_party/blink/renderer/core/fileapi/file_reader.cc +++ b/third_party/blink/renderer/core/fileapi/file_reader.cc
@@ -83,7 +83,7 @@ ThrottlingController* controller = Supplement<ExecutionContext>::From<ThrottlingController>(*context); if (!controller) { - controller = new ThrottlingController(*context); + controller = MakeGarbageCollected<ThrottlingController>(*context); ProvideTo(*context, controller); } return controller; @@ -120,6 +120,10 @@ probe::AsyncTaskCanceled(context, reader); } + explicit ThrottlingController(ExecutionContext& context) + : Supplement<ExecutionContext>(context), + max_running_readers_(kMaxOutstandingRequestsPerThread) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(pending_readers_); visitor->Trace(running_readers_); @@ -127,10 +131,6 @@ } private: - explicit ThrottlingController(ExecutionContext& context) - : Supplement<ExecutionContext>(context), - max_running_readers_(kMaxOutstandingRequestsPerThread) {} - void PushReader(FileReader* reader) { if (pending_readers_.IsEmpty() && running_readers_.size() < max_running_readers_) { @@ -193,7 +193,7 @@ "FileReaderThrottlingController"; FileReader* FileReader::Create(ExecutionContext* context) { - return new FileReader(context); + return MakeGarbageCollected<FileReader>(context); } FileReader::FileReader(ExecutionContext* context)
diff --git a/third_party/blink/renderer/core/fileapi/file_reader.h b/third_party/blink/renderer/core/fileapi/file_reader.h index 42df8cca..7c5cfd4 100644 --- a/third_party/blink/renderer/core/fileapi/file_reader.h +++ b/third_party/blink/renderer/core/fileapi/file_reader.h
@@ -59,6 +59,7 @@ public: static FileReader* Create(ExecutionContext*); + explicit FileReader(ExecutionContext*); ~FileReader() override; enum ReadyState { kEmpty = 0, kLoading = 1, kDone = 2 }; @@ -104,8 +105,6 @@ private: class ThrottlingController; - explicit FileReader(ExecutionContext*); - void Terminate(); void ReadInternal(Blob*, FileReaderLoader::ReadType, ExceptionState&); void FireEvent(const AtomicString& type);
diff --git a/third_party/blink/renderer/core/fileapi/file_reader_sync.h b/third_party/blink/renderer/core/fileapi/file_reader_sync.h index d5db3fc..2c93cb71 100644 --- a/third_party/blink/renderer/core/fileapi/file_reader_sync.h +++ b/third_party/blink/renderer/core/fileapi/file_reader_sync.h
@@ -48,9 +48,11 @@ public: static FileReaderSync* Create(ExecutionContext* context) { - return new FileReaderSync(context); + return MakeGarbageCollected<FileReaderSync>(context); } + explicit FileReaderSync(ExecutionContext*); + DOMArrayBuffer* readAsArrayBuffer(Blob*, ExceptionState&); String readAsBinaryString(Blob*, ExceptionState&); String readAsText(Blob* blob, ExceptionState& ec) { @@ -60,8 +62,6 @@ String readAsDataURL(Blob*, ExceptionState&); private: - explicit FileReaderSync(ExecutionContext*); - void StartLoading(FileReaderLoader&, const Blob&, ExceptionState&); };
diff --git a/third_party/blink/renderer/core/frame/deprecation.cc b/third_party/blink/renderer/core/frame/deprecation.cc index b4c3db8..04d9568 100644 --- a/third_party/blink/renderer/core/frame/deprecation.cc +++ b/third_party/blink/renderer/core/frame/deprecation.cc
@@ -822,7 +822,7 @@ // Construct the deprecation report. double removal_date = MilestoneDate(info.anticipated_removal); - DeprecationReportBody* body = new DeprecationReportBody( + DeprecationReportBody* body = MakeGarbageCollected<DeprecationReportBody>( info.id, removal_date, info.message, SourceLocation::Capture()); Report* report = new Report("deprecation", document->Url().GetString(), body);
diff --git a/third_party/blink/renderer/core/frame/display_cutout_client_impl.cc b/third_party/blink/renderer/core/frame/display_cutout_client_impl.cc index 055f69c..ddddffce 100644 --- a/third_party/blink/renderer/core/frame/display_cutout_client_impl.cc +++ b/third_party/blink/renderer/core/frame/display_cutout_client_impl.cc
@@ -33,7 +33,7 @@ mojom::blink::DisplayCutoutClientAssociatedRequest request) { if (!frame) return; - new DisplayCutoutClientImpl(frame, std::move(request)); + MakeGarbageCollected<DisplayCutoutClientImpl>(frame, std::move(request)); } void DisplayCutoutClientImpl::SetSafeArea(
diff --git a/third_party/blink/renderer/core/frame/display_cutout_client_impl.h b/third_party/blink/renderer/core/frame/display_cutout_client_impl.h index 56aade2..b547e26 100644 --- a/third_party/blink/renderer/core/frame/display_cutout_client_impl.h +++ b/third_party/blink/renderer/core/frame/display_cutout_client_impl.h
@@ -24,15 +24,15 @@ LocalFrame*, mojom::blink::DisplayCutoutClientAssociatedRequest); + DisplayCutoutClientImpl(LocalFrame*, + mojom::blink::DisplayCutoutClientAssociatedRequest); + // Notify the renderer that the safe areas have changed. void SetSafeArea(mojom::blink::DisplayCutoutSafeAreaPtr safe_area) override; void Trace(Visitor*); private: - DisplayCutoutClientImpl(LocalFrame*, - mojom::blink::DisplayCutoutClientAssociatedRequest); - Member<LocalFrame> frame_; mojo::AssociatedBinding<mojom::blink::DisplayCutoutClient> binding_;
diff --git a/third_party/blink/renderer/core/frame/dom_window.cc b/third_party/blink/renderer/core/frame/dom_window.cc index 28ee9ca..d19eb542 100644 --- a/third_party/blink/renderer/core/frame/dom_window.cc +++ b/third_party/blink/renderer/core/frame/dom_window.cc
@@ -391,8 +391,10 @@ } InputDeviceCapabilitiesConstants* DOMWindow::GetInputDeviceCapabilities() { - if (!input_capabilities_) - input_capabilities_ = new InputDeviceCapabilitiesConstants; + if (!input_capabilities_) { + input_capabilities_ = + MakeGarbageCollected<InputDeviceCapabilitiesConstants>(); + } return input_capabilities_; }
diff --git a/third_party/blink/renderer/core/frame/find_in_page.h b/third_party/blink/renderer/core/frame/find_in_page.h index 6bdc6922..ba979ce 100644 --- a/third_party/blink/renderer/core/frame/find_in_page.h +++ b/third_party/blink/renderer/core/frame/find_in_page.h
@@ -30,9 +30,11 @@ public: static FindInPage* Create(WebLocalFrameImpl& frame, InterfaceRegistry* interface_registry) { - return new FindInPage(frame, interface_registry); + return MakeGarbageCollected<FindInPage>(frame, interface_registry); } + FindInPage(WebLocalFrameImpl& frame, InterfaceRegistry* interface_registry); + bool FindInternal(int identifier, const WebString& search_text, const mojom::blink::FindOptions&, @@ -101,8 +103,6 @@ } private: - FindInPage(WebLocalFrameImpl& frame, InterfaceRegistry* interface_registry); - // Will be initialized after first call to ensureTextFinder(). Member<TextFinder> text_finder_;
diff --git a/third_party/blink/renderer/core/frame/frame_console.h b/third_party/blink/renderer/core/frame/frame_console.h index 96d9e57..d8061d2 100644 --- a/third_party/blink/renderer/core/frame/frame_console.h +++ b/third_party/blink/renderer/core/frame/frame_console.h
@@ -52,9 +52,11 @@ : public GarbageCollectedFinalized<FrameConsole> { public: static FrameConsole* Create(LocalFrame& frame) { - return new FrameConsole(frame); + return MakeGarbageCollected<FrameConsole>(frame); } + explicit FrameConsole(LocalFrame&); + void AddMessage(ConsoleMessage*); bool AddMessageToStorage(ConsoleMessage*); @@ -74,8 +76,6 @@ void Trace(blink::Visitor*); private: - explicit FrameConsole(LocalFrame&); - Member<LocalFrame> frame_; };
diff --git a/third_party/blink/renderer/core/frame/frame_owner.h b/third_party/blink/renderer/core/frame/frame_owner.h index 1f0bab73..2c524470 100644 --- a/third_party/blink/renderer/core/frame/frame_owner.h +++ b/third_party/blink/renderer/core/frame/frame_owner.h
@@ -82,7 +82,9 @@ USING_GARBAGE_COLLECTED_MIXIN(DummyFrameOwner); public: - static DummyFrameOwner* Create() { return new DummyFrameOwner; } + static DummyFrameOwner* Create() { + return MakeGarbageCollected<DummyFrameOwner>(); + } void Trace(blink::Visitor* visitor) override { FrameOwner::Trace(visitor); }
diff --git a/third_party/blink/renderer/core/frame/frame_view_auto_size_info.h b/third_party/blink/renderer/core/frame/frame_view_auto_size_info.h index bdda5c65..6d99f1d 100644 --- a/third_party/blink/renderer/core/frame/frame_view_auto_size_info.h +++ b/third_party/blink/renderer/core/frame/frame_view_auto_size_info.h
@@ -19,17 +19,17 @@ : public GarbageCollected<FrameViewAutoSizeInfo> { public: static FrameViewAutoSizeInfo* Create(LocalFrameView* frame_view) { - return new FrameViewAutoSizeInfo(frame_view); + return MakeGarbageCollected<FrameViewAutoSizeInfo>(frame_view); } + explicit FrameViewAutoSizeInfo(LocalFrameView*); + void ConfigureAutoSizeMode(const IntSize& min_size, const IntSize& max_size); void AutoSizeIfNeeded(); void Trace(blink::Visitor*); private: - explicit FrameViewAutoSizeInfo(LocalFrameView*); - Member<LocalFrameView> frame_view_; // The lower bound on the size when autosizing.
diff --git a/third_party/blink/renderer/core/frame/history.h b/third_party/blink/renderer/core/frame/history.h index abacee7..f16dd789 100644 --- a/third_party/blink/renderer/core/frame/history.h +++ b/third_party/blink/renderer/core/frame/history.h
@@ -51,7 +51,11 @@ USING_GARBAGE_COLLECTED_MIXIN(History); public: - static History* Create(LocalFrame* frame) { return new History(frame); } + static History* Create(LocalFrame* frame) { + return MakeGarbageCollected<History>(frame); + } + + explicit History(LocalFrame*); unsigned length(ExceptionState&) const; SerializedScriptValue* state(ExceptionState&); @@ -83,8 +87,6 @@ FRIEND_TEST_ALL_PREFIXES(HistoryTest, CanChangeToURLInFileOrigin); FRIEND_TEST_ALL_PREFIXES(HistoryTest, CanChangeToURLInUniqueOrigin); - explicit History(LocalFrame*); - static bool CanChangeToUrl(const KURL&, const SecurityOrigin*, const KURL& document_url);
diff --git a/third_party/blink/renderer/core/frame/intervention.cc b/third_party/blink/renderer/core/frame/intervention.cc index f65037b8..b243c517e 100644 --- a/third_party/blink/renderer/core/frame/intervention.cc +++ b/third_party/blink/renderer/core/frame/intervention.cc
@@ -33,8 +33,8 @@ return; // Construct the intervention report. - InterventionReportBody* body = - new InterventionReportBody(id, message, SourceLocation::Capture()); + InterventionReportBody* body = MakeGarbageCollected<InterventionReportBody>( + id, message, SourceLocation::Capture()); Report* report = new Report("intervention", document->Url().GetString(), body);
diff --git a/third_party/blink/renderer/core/frame/link_highlights.h b/third_party/blink/renderer/core/frame/link_highlights.h index 940eb54..55bf38e6 100644 --- a/third_party/blink/renderer/core/frame/link_highlights.h +++ b/third_party/blink/renderer/core/frame/link_highlights.h
@@ -24,7 +24,11 @@ class CORE_EXPORT LinkHighlights final : public GarbageCollectedFinalized<LinkHighlights> { public: - static LinkHighlights* Create(Page& page) { return new LinkHighlights(page); } + static LinkHighlights* Create(Page& page) { + return MakeGarbageCollected<LinkHighlights>(page); + } + + explicit LinkHighlights(Page&); virtual ~LinkHighlights(); virtual void Trace(blink::Visitor*); @@ -58,8 +62,6 @@ FRIEND_TEST_ALL_PREFIXES(LinkHighlightImplTest, multipleHighlights); FRIEND_TEST_ALL_PREFIXES(LinkHighlightImplTest, HighlightLayerEffectNode); - explicit LinkHighlights(Page&); - void RemoveAllHighlights(); LocalFrame* MainFrame() const;
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index 1ead7338..ed064a4 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -1297,7 +1297,7 @@ External* LocalDOMWindow::external() { if (!external_) - external_ = new External; + external_ = MakeGarbageCollected<External>(); return external_; }
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 962c912..a15415a0 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.h +++ b/third_party/blink/renderer/core/frame/local_dom_window.h
@@ -101,11 +101,12 @@ const DocumentInit&, bool force_xhtml); static LocalDOMWindow* Create(LocalFrame& frame) { - return new LocalDOMWindow(frame); + return MakeGarbageCollected<LocalDOMWindow>(frame); } static LocalDOMWindow* From(const ScriptState*); + explicit LocalDOMWindow(LocalFrame&); ~LocalDOMWindow() override; LocalFrame* GetFrame() const { return ToLocalFrame(DOMWindow::GetFrame()); } @@ -341,7 +342,6 @@ bool IsRemoteDOMWindow() const override { return false; } void WarnUnusedPreloads(TimerBase*); - explicit LocalDOMWindow(LocalFrame&); void Dispose(); void DispatchLoadEvent();
diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc index 4bf0c457..fef8f9fe 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc
@@ -214,7 +214,7 @@ Page& page, FrameOwner* owner, InterfaceRegistry* interface_registry) { - LocalFrame* frame = new LocalFrame( + LocalFrame* frame = MakeGarbageCollected<LocalFrame>( client, page, owner, interface_registry ? interface_registry : InterfaceRegistry::GetEmptyInterfaceRegistry()); @@ -982,7 +982,7 @@ ad_tracker_ = LocalFrameRoot().ad_tracker_; performance_monitor_ = LocalFrameRoot().performance_monitor_; } - idleness_detector_ = new IdlenessDetector(this); + idleness_detector_ = MakeGarbageCollected<IdlenessDetector>(this); inspector_task_runner_->InitIsolate(V8PerIsolateData::MainThreadIsolate()); if (ad_tracker_) {
diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h index 87e3646d..193c363 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h
@@ -118,6 +118,8 @@ FrameOwner*, InterfaceRegistry* = nullptr); + LocalFrame(LocalFrameClient*, Page&, FrameOwner*, InterfaceRegistry*); + void Init(); void SetView(LocalFrameView*); void CreateView(const IntSize&, const Color&); @@ -411,8 +413,6 @@ private: friend class FrameNavigationDisabler; - LocalFrame(LocalFrameClient*, Page&, FrameOwner*, InterfaceRegistry*); - // Frame protected overrides: void DetachImpl(FrameDetachType) override;
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 98530aa6..2bd1f7ec 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -275,15 +275,15 @@ } LocalFrameView* LocalFrameView::Create(LocalFrame& frame) { - LocalFrameView* view = new LocalFrameView(frame, IntRect()); + LocalFrameView* view = MakeGarbageCollected<LocalFrameView>(frame, IntRect()); view->Show(); return view; } LocalFrameView* LocalFrameView::Create(LocalFrame& frame, const IntSize& initial_size) { - LocalFrameView* view = - new LocalFrameView(frame, IntRect(IntPoint(), initial_size)); + LocalFrameView* view = MakeGarbageCollected<LocalFrameView>( + frame, IntRect(IntPoint(), initial_size)); view->SetLayoutSizeInternal(initial_size); view->Show(); @@ -366,7 +366,7 @@ if (!target_element) return; - visibility_observer_ = new ElementVisibilityObserver( + visibility_observer_ = MakeGarbageCollected<ElementVisibilityObserver>( target_element, WTF::BindRepeating( [](LocalFrameView* frame_view, bool is_visible) { if (!frame_view)
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.h b/third_party/blink/renderer/core/frame/local_frame_view.h index ae06319..6e93c622 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.h +++ b/third_party/blink/renderer/core/frame/local_frame_view.h
@@ -110,6 +110,7 @@ static LocalFrameView* Create(LocalFrame&); static LocalFrameView* Create(LocalFrame&, const IntSize& initial_size); + explicit LocalFrameView(LocalFrame&, IntRect); ~LocalFrameView() override; void Invalidate() { InvalidateRect(IntRect(0, 0, Width(), Height())); } @@ -721,8 +722,6 @@ }; #endif - explicit LocalFrameView(LocalFrame&, IntRect); - void PaintInternal(GraphicsContext&, const GlobalPaintFlags, const CullRect&) const;
diff --git a/third_party/blink/renderer/core/frame/location.h b/third_party/blink/renderer/core/frame/location.h index 0b83297..18853be 100644 --- a/third_party/blink/renderer/core/frame/location.h +++ b/third_party/blink/renderer/core/frame/location.h
@@ -54,9 +54,11 @@ public: static Location* Create(DOMWindow* dom_window) { - return new Location(dom_window); + return MakeGarbageCollected<Location>(dom_window); } + explicit Location(DOMWindow*); + DOMWindow* DomWindow() const { return dom_window_.Get(); } void setHref(LocalDOMWindow* current_window, @@ -125,8 +127,6 @@ void Trace(blink::Visitor*) override; private: - explicit Location(DOMWindow*); - // Note: it is only valid to call this if this is a Location object for a // LocalDOMWindow. Document* GetDocument() const;
diff --git a/third_party/blink/renderer/core/frame/remote_frame_view.cc b/third_party/blink/renderer/core/frame/remote_frame_view.cc index ef43c1e..e572155 100644 --- a/third_party/blink/renderer/core/frame/remote_frame_view.cc +++ b/third_party/blink/renderer/core/frame/remote_frame_view.cc
@@ -309,7 +309,7 @@ if (!target_element) return; - visibility_observer_ = new ElementVisibilityObserver( + visibility_observer_ = MakeGarbageCollected<ElementVisibilityObserver>( target_element, WTF::BindRepeating( [](RemoteFrameView* remote_view, bool is_visible) { remote_view->UpdateRenderThrottlingStatus(
diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.cc b/third_party/blink/renderer/core/fullscreen/fullscreen.cc index dc351bd..d7b294a9 100644 --- a/third_party/blink/renderer/core/fullscreen/fullscreen.cc +++ b/third_party/blink/renderer/core/fullscreen/fullscreen.cc
@@ -472,7 +472,7 @@ Fullscreen& Fullscreen::From(Document& document) { Fullscreen* fullscreen = FromIfExists(document); if (!fullscreen) { - fullscreen = new Fullscreen(document); + fullscreen = MakeGarbageCollected<Fullscreen>(document); ProvideTo(document, fullscreen); } return *fullscreen; @@ -620,7 +620,7 @@ } From(document).pending_requests_.push_back( - new PendingRequest(&pending, request_type, resolver)); + MakeGarbageCollected<PendingRequest>(&pending, request_type, resolver)); LocalFrame& frame = *document.GetFrame(); frame.GetChromeClient().EnterFullscreen(frame, options); } else {
diff --git a/third_party/blink/renderer/core/fullscreen/fullscreen.h b/third_party/blink/renderer/core/fullscreen/fullscreen.h index 0e22e5b..636f982 100644 --- a/third_party/blink/renderer/core/fullscreen/fullscreen.h +++ b/third_party/blink/renderer/core/fullscreen/fullscreen.h
@@ -59,7 +59,9 @@ public: static const char kSupplementName[]; + explicit Fullscreen(Document&); virtual ~Fullscreen(); + static Fullscreen& From(Document&); static Element* FullscreenElementFrom(Document&); static Element* FullscreenElementForBindingFrom(TreeScope&); @@ -107,8 +109,6 @@ private: static Fullscreen* FromIfExists(Document&); - explicit Fullscreen(Document&); - Document* GetDocument(); static void ContinueRequestFullscreen(Document&,
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc b/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc index af1de9ce..1e66fde 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_reaction_queue_test.cc
@@ -17,7 +17,7 @@ TEST(CustomElementReactionQueueTest, invokeReactions_one) { std::vector<char> log; CustomElementReactionQueue* queue = new CustomElementReactionQueue(); - queue->Add(new TestReaction({new Log('a', log)})); + queue->Add(new TestReaction({MakeGarbageCollected<Log>('a', log)})); queue->InvokeReactions(nullptr); EXPECT_EQ(log, std::vector<char>({'a'})) << "the reaction should have been invoked"; @@ -26,9 +26,9 @@ TEST(CustomElementReactionQueueTest, invokeReactions_many) { std::vector<char> log; CustomElementReactionQueue* queue = new CustomElementReactionQueue(); - queue->Add(new TestReaction({new Log('a', log)})); - queue->Add(new TestReaction({new Log('b', log)})); - queue->Add(new TestReaction({new Log('c', log)})); + queue->Add(new TestReaction({MakeGarbageCollected<Log>('a', log)})); + queue->Add(new TestReaction({MakeGarbageCollected<Log>('b', log)})); + queue->Add(new TestReaction({MakeGarbageCollected<Log>('c', log)})); queue->InvokeReactions(nullptr); EXPECT_EQ(log, std::vector<char>({'a', 'b', 'c'})) << "the reaction should have been invoked"; @@ -38,15 +38,18 @@ std::vector<char> log; CustomElementReactionQueue* queue = new CustomElementReactionQueue(); - CustomElementReaction* third = new TestReaction( - {new Log('c', log), new Recurse(queue)}); // "Empty" recursion + CustomElementReaction* third = + new TestReaction({MakeGarbageCollected<Log>('c', log), + new Recurse(queue)}); // "Empty" recursion - CustomElementReaction* second = new TestReaction( - {new Log('b', log), - new Enqueue(queue, third)}); // Unwinds one level of recursion + CustomElementReaction* second = + new TestReaction({MakeGarbageCollected<Log>('b', log), + MakeGarbageCollected<Enqueue>( + queue, third)}); // Unwinds one level of recursion CustomElementReaction* first = - new TestReaction({new Log('a', log), new Enqueue(queue, second), + new TestReaction({MakeGarbageCollected<Log>('a', log), + MakeGarbageCollected<Enqueue>(queue, second), new Recurse(queue)}); // Non-empty recursion queue->Add(first); @@ -59,11 +62,11 @@ std::vector<char> log; CustomElementReactionQueue* queue = new CustomElementReactionQueue(); - queue->Add(new TestReaction({new Log('a', log)})); + queue->Add(new TestReaction({MakeGarbageCollected<Log>('a', log)})); queue->Add(new TestReaction({new Call(WTF::Bind( [](CustomElementReactionQueue* queue, Element*) { queue->Clear(); }, WrapPersistent(queue)))})); - queue->Add(new TestReaction({new Log('b', log)})); + queue->Add(new TestReaction({MakeGarbageCollected<Log>('b', log)})); queue->InvokeReactions(nullptr); EXPECT_EQ(log, std::vector<char>({'a'}))
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack_test.cc b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack_test.cc index 5ed8fbfa..86d0999 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack_test.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack_test.cc
@@ -21,8 +21,9 @@ CustomElementReactionStack* stack = new CustomElementReactionStack(); stack->Push(); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('a', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('a', log)})); stack->PopInvokingReactions(); EXPECT_EQ(log, std::vector<char>({'a'})) @@ -34,10 +35,12 @@ CustomElementReactionStack* stack = new CustomElementReactionStack(); stack->Push(); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('a', log)})); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('b', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('a', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('b', log)})); stack->PopInvokingReactions(); EXPECT_EQ(log, std::vector<char>({'a', 'b'})) @@ -49,8 +52,9 @@ CustomElementReactionStack* stack = new CustomElementReactionStack(); stack->Push(); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('a', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('a', log)})); stack->Push(); stack->PopInvokingReactions(); @@ -63,11 +67,13 @@ CustomElementReactionStack* stack = new CustomElementReactionStack(); stack->Push(); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('a', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('a', log)})); stack->Push(); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('b', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('b', log)})); stack->PopInvokingReactions(); EXPECT_EQ(log, std::vector<char>({'b'})) @@ -81,10 +87,13 @@ CustomElementReactionStack* stack = new CustomElementReactionStack(); stack->Push(); - stack->EnqueueToCurrentQueue(element, new TestReaction({new Log('a', log)})); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('z', log)})); - stack->EnqueueToCurrentQueue(element, new TestReaction({new Log('b', log)})); + stack->EnqueueToCurrentQueue( + element, new TestReaction({MakeGarbageCollected<Log>('a', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('z', log)})); + stack->EnqueueToCurrentQueue( + element, new TestReaction({MakeGarbageCollected<Log>('b', log)})); stack->PopInvokingReactions(); EXPECT_EQ(log, std::vector<char>({'a', 'b', 'z'})) @@ -98,13 +107,17 @@ CustomElementReactionStack* stack = new CustomElementReactionStack(); stack->Push(); - stack->EnqueueToCurrentQueue(element, new TestReaction({new Log('a', log)})); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('z', log)})); + stack->EnqueueToCurrentQueue( + element, new TestReaction({MakeGarbageCollected<Log>('a', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('z', log)})); stack->Push(); - stack->EnqueueToCurrentQueue(CreateElement("a"), - new TestReaction({new Log('y', log)})); - stack->EnqueueToCurrentQueue(element, new TestReaction({new Log('b', log)})); + stack->EnqueueToCurrentQueue( + CreateElement("a"), + new TestReaction({MakeGarbageCollected<Log>('y', log)})); + stack->EnqueueToCurrentQueue( + element, new TestReaction({MakeGarbageCollected<Log>('b', log)})); stack->PopInvokingReactions(); EXPECT_EQ(log, std::vector<char>({'y', 'a', 'b'})) @@ -148,8 +161,9 @@ CustomElementReactionStack* stack = new CustomElementReactionStack(); stack->Push(); stack->EnqueueToCurrentQueue( - element, new TestReaction({new EnqueueToStack( - stack, element, new TestReaction({new Log('a', log)}))})); + element, new TestReaction({MakeGarbageCollected<EnqueueToStack>( + stack, element, + new TestReaction({MakeGarbageCollected<Log>('a', log)}))})); stack->PopInvokingReactions(); EXPECT_EQ(log, std::vector<char>({'a'})) << "enqueued reaction from another "
diff --git a/third_party/blink/renderer/core/html/custom/custom_element_registry_test.cc b/third_party/blink/renderer/core/html/custom/custom_element_registry_test.cc index 443aadb..522e811 100644 --- a/third_party/blink/renderer/core/html/custom/custom_element_registry_test.cc +++ b/third_party/blink/renderer/core/html/custom/custom_element_registry_test.cc
@@ -243,7 +243,7 @@ Document* new_owner) override { logs_.push_back(kAdoptedCallback); EXPECT_EQ(element, element_); - adopted_.push_back(new Adopted(old_owner, new_owner)); + adopted_.push_back(MakeGarbageCollected<Adopted>(old_owner, new_owner)); } void RunAttributeChangedCallback(Element* element, @@ -266,7 +266,7 @@ CustomElementDefinition* Build(const CustomElementDescriptor& descriptor, CustomElementDefinition::Id) override { - return new LogUpgradeDefinition(descriptor); + return MakeGarbageCollected<LogUpgradeDefinition>(descriptor); } DISALLOW_COPY_AND_ASSIGN(LogUpgradeBuilder);
diff --git a/third_party/blink/renderer/core/html/forms/date_input_type.cc b/third_party/blink/renderer/core/html/forms/date_input_type.cc index 657e058c..0bd61ed 100644 --- a/third_party/blink/renderer/core/html/forms/date_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/date_input_type.cc
@@ -52,7 +52,7 @@ : BaseTemporalInputType(element) {} InputType* DateInputType::Create(HTMLInputElement& element) { - return new DateInputType(element); + return MakeGarbageCollected<DateInputType>(element); } void DateInputType::CountUsage() {
diff --git a/third_party/blink/renderer/core/html/forms/date_input_type.h b/third_party/blink/renderer/core/html/forms/date_input_type.h index cbae403..b5a8e7eb 100644 --- a/third_party/blink/renderer/core/html/forms/date_input_type.h +++ b/third_party/blink/renderer/core/html/forms/date_input_type.h
@@ -39,9 +39,9 @@ public: static InputType* Create(HTMLInputElement&); - private: explicit DateInputType(HTMLInputElement&); + private: void CountUsage() override; const AtomicString& FormControlType() const override; StepRange CreateStepRange(AnyStepHandling) const override;
diff --git a/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.cc b/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.cc index 6f8040a7..b378ec7 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.cc +++ b/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.cc
@@ -62,7 +62,8 @@ ChromeClient* chrome_client, DateTimeChooserClient* client, const DateTimeChooserParameters& parameters) { - return new DateTimeChooserImpl(chrome_client, client, parameters); + return MakeGarbageCollected<DateTimeChooserImpl>(chrome_client, client, + parameters); } DateTimeChooserImpl::~DateTimeChooserImpl() = default;
diff --git a/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.h b/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.h index 92cae9e4..e896239 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.h +++ b/third_party/blink/renderer/core/html/forms/date_time_chooser_impl.h
@@ -48,6 +48,10 @@ static DateTimeChooserImpl* Create(ChromeClient*, DateTimeChooserClient*, const DateTimeChooserParameters&); + + DateTimeChooserImpl(ChromeClient*, + DateTimeChooserClient*, + const DateTimeChooserParameters&); ~DateTimeChooserImpl() override; // DateTimeChooser functions: @@ -57,9 +61,6 @@ void Trace(blink::Visitor*) override; private: - DateTimeChooserImpl(ChromeClient*, - DateTimeChooserClient*, - const DateTimeChooserParameters&); // PagePopupClient functions: void WriteDocument(SharedBuffer*) override; void SelectFontsFromOwnerDocument(Document&) override {}
diff --git a/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc b/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc index ae6e1be2..ad829d07 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc +++ b/third_party/blink/renderer/core/html/forms/date_time_edit_element.cc
@@ -557,7 +557,7 @@ Document& document, EditControlOwner& edit_control_owner) { DateTimeEditElement* container = - new DateTimeEditElement(document, edit_control_owner); + MakeGarbageCollected<DateTimeEditElement>(document, edit_control_owner); container->SetShadowPseudoId(AtomicString("-webkit-datetime-edit")); container->setAttribute(kIdAttr, shadow_element_names::DateTimeEdit()); return container;
diff --git a/third_party/blink/renderer/core/html/forms/date_time_edit_element.h b/third_party/blink/renderer/core/html/forms/date_time_edit_element.h index d2d4b43e..dbd2469 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_edit_element.h +++ b/third_party/blink/renderer/core/html/forms/date_time_edit_element.h
@@ -84,6 +84,7 @@ static DateTimeEditElement* Create(Document&, EditControlOwner&); + DateTimeEditElement(Document&, EditControlOwner&); ~DateTimeEditElement() override; void Trace(blink::Visitor*) override; @@ -125,8 +126,6 @@ // 8. AM/PM static const int kMaximumNumberOfFields = 8; - DateTimeEditElement(Document&, EditControlOwner&); - DateTimeFieldElement* FieldAt(wtf_size_t) const; wtf_size_t FieldIndexOf(const DateTimeFieldElement&) const; DateTimeFieldElement* FocusedField() const;
diff --git a/third_party/blink/renderer/core/html/forms/date_time_field_elements.cc b/third_party/blink/renderer/core/html/forms/date_time_field_elements.cc index bfb4b4b7..091f984b 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_field_elements.cc +++ b/third_party/blink/renderer/core/html/forms/date_time_field_elements.cc
@@ -52,7 +52,8 @@ DEFINE_STATIC_LOCAL(AtomicString, ampm_pseudo_id, ("-webkit-datetime-edit-ampm-field")); DateTimeAMPMFieldElement* field = - new DateTimeAMPMFieldElement(document, field_owner, ampm_labels); + MakeGarbageCollected<DateTimeAMPMFieldElement>(document, field_owner, + ampm_labels); field->Initialize(ampm_pseudo_id, QueryString(WebLocalizedString::kAXAMPMFieldText)); return field; @@ -99,8 +100,10 @@ const Range& range) { DEFINE_STATIC_LOCAL(AtomicString, day_pseudo_id, ("-webkit-datetime-edit-day-field")); - DateTimeDayFieldElement* field = new DateTimeDayFieldElement( - document, field_owner, placeholder.IsEmpty() ? "--" : placeholder, range); + DateTimeDayFieldElement* field = + MakeGarbageCollected<DateTimeDayFieldElement>( + document, field_owner, placeholder.IsEmpty() ? "--" : placeholder, + range); field->Initialize(day_pseudo_id, QueryString(WebLocalizedString::kAXDayOfMonthFieldText)); return field; @@ -207,7 +210,8 @@ } DateTimeHour11FieldElement* field = - new DateTimeHour11FieldElement(document, field_owner, range, step); + MakeGarbageCollected<DateTimeHour11FieldElement>(document, field_owner, + range, step); field->Initialize(); return field; } @@ -265,7 +269,8 @@ range.maximum = 12; } DateTimeHour12FieldElement* field = - new DateTimeHour12FieldElement(document, field_owner, range, step); + MakeGarbageCollected<DateTimeHour12FieldElement>(document, field_owner, + range, step); field->Initialize(); return field; } @@ -305,7 +310,8 @@ DCHECK_LE(hour23_range.maximum, 23); DCHECK_LE(hour23_range.minimum, hour23_range.maximum); DateTimeHour23FieldElement* field = - new DateTimeHour23FieldElement(document, field_owner, hour23_range, step); + MakeGarbageCollected<DateTimeHour23FieldElement>(document, field_owner, + hour23_range, step); field->Initialize(); return field; } @@ -360,7 +366,8 @@ } DateTimeHour24FieldElement* field = - new DateTimeHour24FieldElement(document, field_owner, range, step); + MakeGarbageCollected<DateTimeHour24FieldElement>(document, field_owner, + range, step); field->Initialize(); return field; } @@ -415,7 +422,8 @@ DEFINE_STATIC_LOCAL(AtomicString, millisecond_pseudo_id, ("-webkit-datetime-edit-millisecond-field")); DateTimeMillisecondFieldElement* field = - new DateTimeMillisecondFieldElement(document, field_owner, range, step); + MakeGarbageCollected<DateTimeMillisecondFieldElement>( + document, field_owner, range, step); field->Initialize(millisecond_pseudo_id, QueryString(WebLocalizedString::kAXMillisecondFieldText)); return field; @@ -469,7 +477,8 @@ DEFINE_STATIC_LOCAL(AtomicString, minute_pseudo_id, ("-webkit-datetime-edit-minute-field")); DateTimeMinuteFieldElement* field = - new DateTimeMinuteFieldElement(document, field_owner, range, step); + MakeGarbageCollected<DateTimeMinuteFieldElement>(document, field_owner, + range, step); field->Initialize(minute_pseudo_id, QueryString(WebLocalizedString::kAXMinuteFieldText)); return field; @@ -520,8 +529,10 @@ const Range& range) { DEFINE_STATIC_LOCAL(AtomicString, month_pseudo_id, ("-webkit-datetime-edit-month-field")); - DateTimeMonthFieldElement* field = new DateTimeMonthFieldElement( - document, field_owner, placeholder.IsEmpty() ? "--" : placeholder, range); + DateTimeMonthFieldElement* field = + MakeGarbageCollected<DateTimeMonthFieldElement>( + document, field_owner, placeholder.IsEmpty() ? "--" : placeholder, + range); field->Initialize(month_pseudo_id, QueryString(WebLocalizedString::kAXMonthFieldText)); return field; @@ -574,7 +585,8 @@ DEFINE_STATIC_LOCAL(AtomicString, second_pseudo_id, ("-webkit-datetime-edit-second-field")); DateTimeSecondFieldElement* field = - new DateTimeSecondFieldElement(document, field_owner, range, step); + MakeGarbageCollected<DateTimeSecondFieldElement>(document, field_owner, + range, step); field->Initialize(second_pseudo_id, QueryString(WebLocalizedString::kAXSecondFieldText)); return field; @@ -629,8 +641,8 @@ DEFINE_STATIC_LOCAL(AtomicString, month_pseudo_id, ("-webkit-datetime-edit-month-field")); DateTimeSymbolicMonthFieldElement* field = - new DateTimeSymbolicMonthFieldElement(document, field_owner, labels, - minimum, maximum); + MakeGarbageCollected<DateTimeSymbolicMonthFieldElement>( + document, field_owner, labels, minimum, maximum); field->Initialize(month_pseudo_id, QueryString(WebLocalizedString::kAXMonthFieldText)); return field; @@ -684,7 +696,8 @@ DEFINE_STATIC_LOCAL(AtomicString, week_pseudo_id, ("-webkit-datetime-edit-week-field")); DateTimeWeekFieldElement* field = - new DateTimeWeekFieldElement(document, field_owner, range); + MakeGarbageCollected<DateTimeWeekFieldElement>(document, field_owner, + range); field->Initialize(week_pseudo_id, QueryString(WebLocalizedString::kAXWeekOfYearFieldText)); return field; @@ -741,7 +754,8 @@ DEFINE_STATIC_LOCAL(AtomicString, year_pseudo_id, ("-webkit-datetime-edit-year-field")); DateTimeYearFieldElement* field = - new DateTimeYearFieldElement(document, field_owner, parameters); + MakeGarbageCollected<DateTimeYearFieldElement>(document, field_owner, + parameters); field->Initialize(year_pseudo_id, QueryString(WebLocalizedString::kAXYearFieldText)); return field;
diff --git a/third_party/blink/renderer/core/html/forms/date_time_field_elements.h b/third_party/blink/renderer/core/html/forms/date_time_field_elements.h index f2ff719..9fccb5c 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_field_elements.h +++ b/third_party/blink/renderer/core/html/forms/date_time_field_elements.h
@@ -39,9 +39,9 @@ FieldOwner&, const Vector<String>&); - private: DateTimeAMPMFieldElement(Document&, FieldOwner&, const Vector<String>&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -57,12 +57,12 @@ const String& placeholder, const Range&); - private: DateTimeDayFieldElement(Document&, FieldOwner&, const String& placeholder, const Range&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -95,12 +95,12 @@ const Range&, const Step&); - private: DateTimeHour11FieldElement(Document&, FieldOwner&, const Range& hour23_range, const Step&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsInteger(int, EventBehavior = kDispatchNoEvent) override; @@ -115,12 +115,12 @@ const Range&, const Step&); - private: DateTimeHour12FieldElement(Document&, FieldOwner&, const Range& hour23_range, const Step&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsInteger(int, EventBehavior = kDispatchNoEvent) override; @@ -135,12 +135,12 @@ const Range&, const Step&); - private: DateTimeHour23FieldElement(Document&, FieldOwner&, const Range& hour23_range, const Step&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsInteger(int, EventBehavior = kDispatchNoEvent) override; @@ -155,12 +155,12 @@ const Range&, const Step&); - private: DateTimeHour24FieldElement(Document&, FieldOwner&, const Range& hour23_range, const Step&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsInteger(int, EventBehavior = kDispatchNoEvent) override; @@ -176,12 +176,12 @@ const Range&, const Step&); - private: DateTimeMillisecondFieldElement(Document&, FieldOwner&, const Range&, const Step&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -197,9 +197,9 @@ const Range&, const Step&); - private: DateTimeMinuteFieldElement(Document&, FieldOwner&, const Range&, const Step&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -215,12 +215,12 @@ const String& placeholder, const Range&); - private: DateTimeMonthFieldElement(Document&, FieldOwner&, const String& placeholder, const Range&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -236,9 +236,9 @@ const Range&, const Step&); - private: DateTimeSecondFieldElement(Document&, FieldOwner&, const Range&, const Step&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -256,13 +256,13 @@ int minimum, int maximum); - private: DateTimeSymbolicMonthFieldElement(Document&, FieldOwner&, const Vector<String>&, int minimum, int maximum); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -275,9 +275,9 @@ public: static DateTimeWeekFieldElement* Create(Document&, FieldOwner&, const Range&); - private: DateTimeWeekFieldElement(Document&, FieldOwner&, const Range&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override; @@ -309,9 +309,9 @@ FieldOwner&, const Parameters&); - private: DateTimeYearFieldElement(Document&, FieldOwner&, const Parameters&); + private: // DateTimeFieldElement functions. void PopulateDateTimeFieldsState(DateTimeFieldsState&) override; void SetValueAsDate(const DateComponents&) override;
diff --git a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc index e44e1a8..ddf1980 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.cc
@@ -50,7 +50,7 @@ static const int kDateTimeLocalStepScaleFactor = 1000; InputType* DateTimeLocalInputType::Create(HTMLInputElement& element) { - return new DateTimeLocalInputType(element); + return MakeGarbageCollected<DateTimeLocalInputType>(element); } void DateTimeLocalInputType::CountUsage() {
diff --git a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h index 102cdc3..8404bdf4b 100644 --- a/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h +++ b/third_party/blink/renderer/core/html/forms/date_time_local_input_type.h
@@ -41,10 +41,10 @@ public: static InputType* Create(HTMLInputElement&); - private: explicit DateTimeLocalInputType(HTMLInputElement& element) : BaseTemporalInputType(element) {} + private: void CountUsage() override; const AtomicString& FormControlType() const override; double ValueAsDate() const override;
diff --git a/third_party/blink/renderer/core/html/forms/email_input_type.cc b/third_party/blink/renderer/core/html/forms/email_input_type.cc index b73aea1a..dd937e4a47 100644 --- a/third_party/blink/renderer/core/html/forms/email_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/email_input_type.cc
@@ -160,7 +160,7 @@ : BaseTextInputType(element) {} InputType* EmailInputType::Create(HTMLInputElement& element) { - return new EmailInputType(element); + return MakeGarbageCollected<EmailInputType>(element); } void EmailInputType::CountUsage() {
diff --git a/third_party/blink/renderer/core/html/forms/email_input_type.h b/third_party/blink/renderer/core/html/forms/email_input_type.h index 58a6e74..0e37b497 100644 --- a/third_party/blink/renderer/core/html/forms/email_input_type.h +++ b/third_party/blink/renderer/core/html/forms/email_input_type.h
@@ -39,6 +39,8 @@ public: static InputType* Create(HTMLInputElement&); + explicit EmailInputType(HTMLInputElement&); + // They are public for unit testing. CORE_EXPORT static String ConvertEmailAddressToASCII(const ScriptRegexp&, const String&); @@ -47,7 +49,6 @@ CORE_EXPORT static std::unique_ptr<ScriptRegexp> CreateEmailRegexp(); private: - explicit EmailInputType(HTMLInputElement&); void CountUsage() override; const AtomicString& FormControlType() const override; bool TypeMismatchFor(const String&) const override;
diff --git a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc index c798fa5..c5dd324 100644 --- a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc +++ b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.cc
@@ -74,7 +74,8 @@ DateTimeChooserClient* client, const DateTimeChooserParameters& parameters) { DCHECK(chrome_client); - ExternalDateTimeChooser* chooser = new ExternalDateTimeChooser(client); + ExternalDateTimeChooser* chooser = + MakeGarbageCollected<ExternalDateTimeChooser>(client); if (!chooser->OpenDateTimeChooser(chrome_client, web_view_client, parameters)) chooser = nullptr; return chooser;
diff --git a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h index 19d5125..4994a5f3 100644 --- a/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h +++ b/third_party/blink/renderer/core/html/forms/external_date_time_chooser.h
@@ -42,6 +42,8 @@ WebViewClient*, DateTimeChooserClient*, const DateTimeChooserParameters&); + + ExternalDateTimeChooser(DateTimeChooserClient*); ~ExternalDateTimeChooser() override; void Trace(blink::Visitor*) override; @@ -51,7 +53,6 @@ void DidCancelChooser(); private: - ExternalDateTimeChooser(DateTimeChooserClient*); bool OpenDateTimeChooser(ChromeClient*, WebViewClient*, const DateTimeChooserParameters&);
diff --git a/third_party/blink/renderer/core/html/forms/file_input_type.cc b/third_party/blink/renderer/core/html/forms/file_input_type.cc index f7f479a..c1d08ba 100644 --- a/third_party/blink/renderer/core/html/forms/file_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/file_input_type.cc
@@ -72,7 +72,7 @@ file_list_(FileList::Create()) {} InputType* FileInputType::Create(HTMLInputElement& element) { - return new FileInputType(element); + return MakeGarbageCollected<FileInputType>(element); } void FileInputType::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/html/forms/file_input_type.h b/third_party/blink/renderer/core/html/forms/file_input_type.h index 4952ef8fb..0175590 100644 --- a/third_party/blink/renderer/core/html/forms/file_input_type.h +++ b/third_party/blink/renderer/core/html/forms/file_input_type.h
@@ -52,6 +52,9 @@ public: static InputType* Create(HTMLInputElement&); + + FileInputType(HTMLInputElement&); + void Trace(blink::Visitor*) override; using InputType::GetElement; static Vector<String> FilesFromFormControlState(const FormControlState&); @@ -63,7 +66,6 @@ void SetFilesFromPaths(const Vector<String>&) override; private: - FileInputType(HTMLInputElement&); InputTypeView* CreateView() override; const AtomicString& FormControlType() const override; FormControlState SaveFormControlState() const override;
diff --git a/third_party/blink/renderer/core/html/forms/form_controller.cc b/third_party/blink/renderer/core/html/forms/form_controller.cc index ca0a13f..96c940d9 100644 --- a/third_party/blink/renderer/core/html/forms/form_controller.cc +++ b/third_party/blink/renderer/core/html/forms/form_controller.cc
@@ -310,14 +310,17 @@ : public GarbageCollectedFinalized<FormKeyGenerator> { public: - static FormKeyGenerator* Create() { return new FormKeyGenerator; } + static FormKeyGenerator* Create() { + return MakeGarbageCollected<FormKeyGenerator>(); + } + + FormKeyGenerator() = default; + void Trace(blink::Visitor* visitor) { visitor->Trace(form_to_key_map_); } const AtomicString& FormKey(const HTMLFormControlElementWithState&); void WillDeleteForm(HTMLFormElement*); private: - FormKeyGenerator() = default; - using FormToKeyMap = HeapHashMap<Member<HTMLFormElement>, AtomicString>; using FormSignatureToNextIndexMap = HashMap<String, unsigned>; FormToKeyMap form_to_key_map_;
diff --git a/third_party/blink/renderer/core/html/forms/form_controller.h b/third_party/blink/renderer/core/html/forms/form_controller.h index 480b5b3..9ac07b4 100644 --- a/third_party/blink/renderer/core/html/forms/form_controller.h +++ b/third_party/blink/renderer/core/html/forms/form_controller.h
@@ -92,7 +92,11 @@ class FormController final : public GarbageCollectedFinalized<FormController> { public: - static FormController* Create() { return new FormController; } + static FormController* Create() { + return MakeGarbageCollected<FormController>(); + } + + FormController(); ~FormController(); void Trace(blink::Visitor*); @@ -113,7 +117,6 @@ const Vector<String>& state_vector); private: - FormController(); FormControlState TakeStateForFormElement( const HTMLFormControlElementWithState&); static void FormStatesFromStateVector(const Vector<String>&,
diff --git a/third_party/blink/renderer/core/html/forms/form_data.cc b/third_party/blink/renderer/core/html/forms/form_data.cc index 6fbc506..097419b7 100644 --- a/third_party/blink/renderer/core/html/forms/form_data.cc +++ b/third_party/blink/renderer/core/html/forms/form_data.cc
@@ -91,7 +91,7 @@ FormData* FormData::Create(HTMLFormElement* form, ExceptionState& exception_state) { - auto* form_data = new FormData(); + auto* form_data = MakeGarbageCollected<FormData>(); // TODO(tkent): Null check should be unnecessary. We should remove // LegacyInterfaceTypeChecking from form_data.idl. crbug.com/561338 if (!form) @@ -111,7 +111,7 @@ } void FormData::append(const String& name, const String& value) { - entries_.push_back(new Entry(name, value)); + entries_.push_back(MakeGarbageCollected<Entry>(name, value)); } void FormData::append(ScriptState* script_state, @@ -177,11 +177,11 @@ } void FormData::set(const String& name, const String& value) { - SetEntry(new Entry(name, value)); + SetEntry(MakeGarbageCollected<Entry>(name, value)); } void FormData::set(const String& name, Blob* blob, const String& filename) { - SetEntry(new Entry(name, blob, filename)); + SetEntry(MakeGarbageCollected<Entry>(name, blob, filename)); } void FormData::SetEntry(const Entry* entry) { @@ -204,7 +204,7 @@ } void FormData::append(const String& name, Blob* blob, const String& filename) { - entries_.push_back(new Entry(name, blob, filename)); + entries_.push_back(MakeGarbageCollected<Entry>(name, blob, filename)); } void FormData::AppendFromElement(const String& name, int value) { @@ -212,11 +212,13 @@ } void FormData::AppendFromElement(const String& name, File* file) { - entries_.push_back(new Entry(Normalize(name), file, String())); + entries_.push_back( + MakeGarbageCollected<Entry>(Normalize(name), file, String())); } void FormData::AppendFromElement(const String& name, const String& value) { - entries_.push_back(new Entry(Normalize(name), Normalize(value))); + entries_.push_back( + MakeGarbageCollected<Entry>(Normalize(name), Normalize(value))); } CString FormData::Encode(const String& string) const {
diff --git a/third_party/blink/renderer/core/html/forms/form_data.h b/third_party/blink/renderer/core/html/forms/form_data.h index 9ae5eb58..21fd7f1 100644 --- a/third_party/blink/renderer/core/html/forms/form_data.h +++ b/third_party/blink/renderer/core/html/forms/form_data.h
@@ -54,16 +54,19 @@ DEFINE_WRAPPERTYPEINFO(); public: - static FormData* Create() { return new FormData(); } + static FormData* Create() { return MakeGarbageCollected<FormData>(); } static FormData* Create(ExceptionState& exception_state) { - return new FormData(); + return MakeGarbageCollected<FormData>(); } static FormData* Create(HTMLFormElement* form, ExceptionState& exception_state); static FormData* Create(const WTF::TextEncoding& encoding) { - return new FormData(encoding); + return MakeGarbageCollected<FormData>(encoding); } + + explicit FormData(const WTF::TextEncoding&); + FormData(); void Trace(blink::Visitor*) override; // FormData IDL interface. @@ -101,8 +104,6 @@ scoped_refptr<EncodedFormData> EncodeMultiPartFormData(); private: - explicit FormData(const WTF::TextEncoding&); - FormData(); void SetEntry(const Entry*); IterationSource* StartIteration(ScriptState*, ExceptionState&) override;
diff --git a/third_party/blink/renderer/core/html/forms/form_data_event.cc b/third_party/blink/renderer/core/html/forms/form_data_event.cc index 895bda747..86cb684 100644 --- a/third_party/blink/renderer/core/html/forms/form_data_event.cc +++ b/third_party/blink/renderer/core/html/forms/form_data_event.cc
@@ -14,7 +14,7 @@ form_data_(form_data) {} FormDataEvent* FormDataEvent::Create(FormData& form_data) { - return new FormDataEvent(form_data); + return MakeGarbageCollected<FormDataEvent>(form_data); } void FormDataEvent::Trace(Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/html/forms/form_data_event.h b/third_party/blink/renderer/core/html/forms/form_data_event.h index a3a31a5..8b94cb06 100644 --- a/third_party/blink/renderer/core/html/forms/form_data_event.h +++ b/third_party/blink/renderer/core/html/forms/form_data_event.h
@@ -16,6 +16,9 @@ public: static FormDataEvent* Create(FormData& form_data); + + FormDataEvent(FormData& form_data); + void Trace(Visitor* visitor) override; FormData* formData() const { return form_data_; }; @@ -23,8 +26,6 @@ const AtomicString& InterfaceName() const override; private: - FormDataEvent(FormData& form_data); - Member<FormData> form_data_; };
diff --git a/third_party/blink/renderer/core/html/forms/hidden_input_type.cc b/third_party/blink/renderer/core/html/forms/hidden_input_type.cc index 8da157d..c4c2c1a 100644 --- a/third_party/blink/renderer/core/html/forms/hidden_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/hidden_input_type.cc
@@ -42,7 +42,7 @@ using namespace html_names; InputType* HiddenInputType::Create(HTMLInputElement& element) { - return new HiddenInputType(element); + return MakeGarbageCollected<HiddenInputType>(element); } void HiddenInputType::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/html/forms/hidden_input_type.h b/third_party/blink/renderer/core/html/forms/hidden_input_type.h index ba7b9fc22..dfcc310 100644 --- a/third_party/blink/renderer/core/html/forms/hidden_input_type.h +++ b/third_party/blink/renderer/core/html/forms/hidden_input_type.h
@@ -41,12 +41,14 @@ public: static InputType* Create(HTMLInputElement&); + + HiddenInputType(HTMLInputElement& element) + : InputType(element), InputTypeView(element) {} + void Trace(blink::Visitor*) override; using InputType::GetElement; private: - HiddenInputType(HTMLInputElement& element) - : InputType(element), InputTypeView(element) {} InputTypeView* CreateView() override; const AtomicString& FormControlType() const override; bool ShouldSaveAndRestoreFormControlState() const override;
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element.cc b/third_party/blink/renderer/core/html/forms/html_input_element.cc index ecc0cccc..9922ca55 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element.cc +++ b/third_party/blink/renderer/core/html/forms/html_input_element.cc
@@ -84,12 +84,13 @@ public: static ListAttributeTargetObserver* Create(const AtomicString& id, HTMLInputElement*); + + ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); + void Trace(blink::Visitor*) override; void IdTargetChanged() override; private: - ListAttributeTargetObserver(const AtomicString& id, HTMLInputElement*); - Member<HTMLInputElement> element_; }; @@ -1799,7 +1800,7 @@ ListAttributeTargetObserver* ListAttributeTargetObserver::Create( const AtomicString& id, HTMLInputElement* element) { - return new ListAttributeTargetObserver(id, element); + return MakeGarbageCollected<ListAttributeTargetObserver>(id, element); } ListAttributeTargetObserver::ListAttributeTargetObserver(
diff --git a/third_party/blink/renderer/core/html/forms/html_input_element_test.cc b/third_party/blink/renderer/core/html/forms/html_input_element_test.cc index 1a82955..967bdeb 100644 --- a/third_party/blink/renderer/core/html/forms/html_input_element_test.cc +++ b/third_party/blink/renderer/core/html/forms/html_input_element_test.cc
@@ -160,7 +160,8 @@ radio2.setAttribute(html_names::kStyleAttr, "position:fixed"); KeyboardEventInit* init = KeyboardEventInit::Create(); init->setKey("ArrowRight"); - radio1.DefaultEventHandler(*new KeyboardEvent("keydown", init)); + radio1.DefaultEventHandler( + *MakeGarbageCollected<KeyboardEvent>("keydown", init)); EXPECT_EQ(GetDocument().ActiveElement(), &radio2); }
diff --git a/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc b/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc index 1ff71ac..214bb72c 100644 --- a/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc +++ b/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc
@@ -209,7 +209,7 @@ InternalPopupMenu* InternalPopupMenu::Create(ChromeClient* chrome_client, HTMLSelectElement& owner_element) { - return new InternalPopupMenu(chrome_client, owner_element); + return MakeGarbageCollected<InternalPopupMenu>(chrome_client, owner_element); } InternalPopupMenu::InternalPopupMenu(ChromeClient* chrome_client,
diff --git a/third_party/blink/renderer/core/html/forms/internal_popup_menu.h b/third_party/blink/renderer/core/html/forms/internal_popup_menu.h index e3e7a69d..d44f353b8 100644 --- a/third_party/blink/renderer/core/html/forms/internal_popup_menu.h +++ b/third_party/blink/renderer/core/html/forms/internal_popup_menu.h
@@ -25,6 +25,8 @@ public PagePopupClient { public: static InternalPopupMenu* Create(ChromeClient*, HTMLSelectElement&); + + InternalPopupMenu(ChromeClient*, HTMLSelectElement&); ~InternalPopupMenu() override; void Trace(blink::Visitor*) override; @@ -33,8 +35,6 @@ void Dispose(); private: - InternalPopupMenu(ChromeClient*, HTMLSelectElement&); - class ItemIterationContext; void AddOption(ItemIterationContext&, HTMLOptionElement&); void AddOptGroup(ItemIterationContext&, HTMLOptGroupElement&);
diff --git a/third_party/blink/renderer/core/html/forms/labels_node_list.h b/third_party/blink/renderer/core/html/forms/labels_node_list.h index fa5b339..432e7f8 100644 --- a/third_party/blink/renderer/core/html/forms/labels_node_list.h +++ b/third_party/blink/renderer/core/html/forms/labels_node_list.h
@@ -35,14 +35,13 @@ static LabelsNodeList* Create(ContainerNode& owner_node, CollectionType type) { DCHECK_EQ(type, kLabelsNodeListType); - return new LabelsNodeList(owner_node); + return MakeGarbageCollected<LabelsNodeList>(owner_node); } + explicit LabelsNodeList(ContainerNode&); ~LabelsNodeList() override; protected: - explicit LabelsNodeList(ContainerNode&); - bool ElementMatches(const Element&) const override; };
diff --git a/third_party/blink/renderer/core/html/forms/listed_element.cc b/third_party/blink/renderer/core/html/forms/listed_element.cc index 6382a75..fc4b319 100644 --- a/third_party/blink/renderer/core/html/forms/listed_element.cc +++ b/third_party/blink/renderer/core/html/forms/listed_element.cc
@@ -41,12 +41,13 @@ public: static FormAttributeTargetObserver* Create(const AtomicString& id, ListedElement*); + + FormAttributeTargetObserver(const AtomicString& id, ListedElement*); + void Trace(blink::Visitor*) override; void IdTargetChanged() override; private: - FormAttributeTargetObserver(const AtomicString& id, ListedElement*); - Member<ListedElement> element_; }; @@ -311,7 +312,7 @@ FormAttributeTargetObserver* FormAttributeTargetObserver::Create( const AtomicString& id, ListedElement* element) { - return new FormAttributeTargetObserver(id, element); + return MakeGarbageCollected<FormAttributeTargetObserver>(id, element); } FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id,
diff --git a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc index 7c265967..4d89137 100644 --- a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc +++ b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc
@@ -63,7 +63,8 @@ } EditingViewPortElement* EditingViewPortElement::Create(Document& document) { - EditingViewPortElement* element = new EditingViewPortElement(document); + EditingViewPortElement* element = + MakeGarbageCollected<EditingViewPortElement>(document); element->setAttribute(kIdAttr, shadow_element_names::EditingViewPort()); return element; }
diff --git a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.h b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.h index a80f6e9..aeb19c47 100644 --- a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.h +++ b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.h
@@ -45,8 +45,9 @@ public: static EditingViewPortElement* Create(Document&); - protected: explicit EditingViewPortElement(Document&); + + protected: scoped_refptr<ComputedStyle> CustomStyleForLayoutObject() override; private:
diff --git a/third_party/blink/renderer/core/html/forms/text_field_input_type.cc b/third_party/blink/renderer/core/html/forms/text_field_input_type.cc index e4e2af9..0968da45 100644 --- a/third_party/blink/renderer/core/html/forms/text_field_input_type.cc +++ b/third_party/blink/renderer/core/html/forms/text_field_input_type.cc
@@ -60,8 +60,6 @@ class DataListIndicatorElement final : public HTMLDivElement { private: - inline DataListIndicatorElement(Document& document) - : HTMLDivElement(document) {} inline HTMLInputElement* HostInput() const { return ToHTMLInputElement(OwnerShadowHost()); } @@ -98,12 +96,16 @@ public: static DataListIndicatorElement* Create(Document& document) { - DataListIndicatorElement* element = new DataListIndicatorElement(document); + DataListIndicatorElement* element = + MakeGarbageCollected<DataListIndicatorElement>(document); element->SetShadowPseudoId( AtomicString("-webkit-calendar-picker-indicator")); element->setAttribute(kIdAttr, shadow_element_names::PickerIndicator()); return element; } + + inline DataListIndicatorElement(Document& document) + : HTMLDivElement(document) {} }; TextFieldInputType::TextFieldInputType(HTMLInputElement& element)
diff --git a/third_party/blink/renderer/core/html/html_frame_owner_element.cc b/third_party/blink/renderer/core/html/html_frame_owner_element.cc index 26bdc001..7e6fb1e 100644 --- a/third_party/blink/renderer/core/html/html_frame_owner_element.cc +++ b/third_party/blink/renderer/core/html/html_frame_owner_element.cc
@@ -428,7 +428,8 @@ // near the viewport or visible. should_lazy_load_children_ = false; - lazy_load_frame_observer_ = new LazyLoadFrameObserver(*this); + lazy_load_frame_observer_ = + MakeGarbageCollected<LazyLoadFrameObserver>(*this); if (RuntimeEnabledFeatures::LazyFrameVisibleLoadTimeMetricsEnabled()) lazy_load_frame_observer_->StartTrackingVisibilityMetrics();
diff --git a/third_party/blink/renderer/core/html/html_iframe_element.cc b/third_party/blink/renderer/core/html/html_iframe_element.cc index e6ecce4..cc14614 100644 --- a/third_party/blink/renderer/core/html/html_iframe_element.cc +++ b/third_party/blink/renderer/core/html/html_iframe_element.cc
@@ -84,8 +84,8 @@ Policy* HTMLIFrameElement::policy() { if (!policy_) { - policy_ = new IFramePolicy(&GetDocument(), ContainerPolicy(), - GetOriginForFeaturePolicy()); + policy_ = MakeGarbageCollected<IFramePolicy>( + &GetDocument(), ContainerPolicy(), GetOriginForFeaturePolicy()); } return policy_.Get(); }
diff --git a/third_party/blink/renderer/core/html/imports/link_import.cc b/third_party/blink/renderer/core/html/imports/link_import.cc index 5341a51..5920d39 100644 --- a/third_party/blink/renderer/core/html/imports/link_import.cc +++ b/third_party/blink/renderer/core/html/imports/link_import.cc
@@ -48,7 +48,7 @@ namespace blink { LinkImport* LinkImport::Create(HTMLLinkElement* owner) { - return new LinkImport(owner); + return MakeGarbageCollected<LinkImport>(owner); } LinkImport::LinkImport(HTMLLinkElement* owner)
diff --git a/third_party/blink/renderer/core/html/link_manifest.cc b/third_party/blink/renderer/core/html/link_manifest.cc index 41f4b80..74f63211 100644 --- a/third_party/blink/renderer/core/html/link_manifest.cc +++ b/third_party/blink/renderer/core/html/link_manifest.cc
@@ -12,7 +12,7 @@ namespace blink { LinkManifest* LinkManifest::Create(HTMLLinkElement* owner) { - return new LinkManifest(owner); + return MakeGarbageCollected<LinkManifest>(owner); } LinkManifest::LinkManifest(HTMLLinkElement* owner) : LinkResource(owner) {}
diff --git a/third_party/blink/renderer/core/html/link_manifest.h b/third_party/blink/renderer/core/html/link_manifest.h index b1128e4c..92d1143 100644 --- a/third_party/blink/renderer/core/html/link_manifest.h +++ b/third_party/blink/renderer/core/html/link_manifest.h
@@ -17,6 +17,7 @@ public: static LinkManifest* Create(HTMLLinkElement* owner); + explicit LinkManifest(HTMLLinkElement* owner); ~LinkManifest() override; // LinkResource @@ -24,9 +25,6 @@ LinkResourceType GetType() const override { return kManifest; } bool HasLoaded() const override; void OwnerRemoved() override; - - private: - explicit LinkManifest(HTMLLinkElement* owner); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/html/link_style.cc b/third_party/blink/renderer/core/html/link_style.cc index 2e56c4f..1587086 100644 --- a/third_party/blink/renderer/core/html/link_style.cc +++ b/third_party/blink/renderer/core/html/link_style.cc
@@ -36,7 +36,7 @@ } LinkStyle* LinkStyle::Create(HTMLLinkElement* owner) { - return new LinkStyle(owner); + return MakeGarbageCollected<LinkStyle>(owner); } LinkStyle::LinkStyle(HTMLLinkElement* owner)
diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.cc b/third_party/blink/renderer/core/html/media/autoplay_policy.cc index 12a45b9a..c48fa73a 100644 --- a/third_party/blink/renderer/core/html/media/autoplay_policy.cc +++ b/third_party/blink/renderer/core/html/media/autoplay_policy.cc
@@ -228,10 +228,11 @@ if (autoplay_visibility_observer_) return; - autoplay_visibility_observer_ = new ElementVisibilityObserver( - element_, - WTF::BindRepeating(&AutoplayPolicy::OnVisibilityChangedForAutoplay, - WrapWeakPersistent(this))); + autoplay_visibility_observer_ = + MakeGarbageCollected<ElementVisibilityObserver>( + element_, + WTF::BindRepeating(&AutoplayPolicy::OnVisibilityChangedForAutoplay, + WrapWeakPersistent(this))); autoplay_visibility_observer_->Start(); }
diff --git a/third_party/blink/renderer/core/html/media/autoplay_uma_helper.cc b/third_party/blink/renderer/core/html/media/autoplay_uma_helper.cc index eb97ea2..4fa1e11 100644 --- a/third_party/blink/renderer/core/html/media/autoplay_uma_helper.cc +++ b/third_party/blink/renderer/core/html/media/autoplay_uma_helper.cc
@@ -394,11 +394,13 @@ !element_->IsHTMLVideoElement() || !element_->muted()) return; - muted_video_play_method_visibility_observer_ = new ElementVisibilityObserver( - element_, WTF::BindRepeating( - &AutoplayUmaHelper:: - OnVisibilityChangedForMutedVideoPlayMethodBecomeVisible, - WrapWeakPersistent(this))); + muted_video_play_method_visibility_observer_ = + MakeGarbageCollected<ElementVisibilityObserver>( + element_, + WTF::BindRepeating( + &AutoplayUmaHelper:: + OnVisibilityChangedForMutedVideoPlayMethodBecomeVisible, + WrapWeakPersistent(this))); muted_video_play_method_visibility_observer_->Start(); SetContext(&element_->GetDocument()); } @@ -425,12 +427,12 @@ // Start recording muted video playing offscreen duration. muted_video_autoplay_offscreen_start_time_ = CurrentTimeTicks(); is_visible_ = false; - muted_video_offscreen_duration_visibility_observer_ = - new ElementVisibilityObserver( - element_, WTF::BindRepeating( - &AutoplayUmaHelper:: - OnVisibilityChangedForMutedVideoOffscreenDuration, - WrapWeakPersistent(this))); + muted_video_offscreen_duration_visibility_observer_ = MakeGarbageCollected< + ElementVisibilityObserver>( + element_, + WTF::BindRepeating( + &AutoplayUmaHelper::OnVisibilityChangedForMutedVideoOffscreenDuration, + WrapWeakPersistent(this))); muted_video_offscreen_duration_visibility_observer_->Start(); element_->addEventListener(event_type_names::kPause, this, false); SetContext(&element_->GetDocument());
diff --git a/third_party/blink/renderer/core/html/media/html_media_element.cc b/third_party/blink/renderer/core/html/media/html_media_element.cc index 1e86f0c..5f9ad24f 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element.cc
@@ -1873,10 +1873,11 @@ // element actually becomes visible to complete the load. if (IsHTMLVideoElement() && web_media_player_->DidLazyLoad() && !is_potentially_playing) { - lazy_load_visibility_observer_ = new ElementVisibilityObserver( - this, - WTF::BindRepeating(&HTMLMediaElement::OnVisibilityChangedForLazyLoad, - WrapWeakPersistent(this))); + lazy_load_visibility_observer_ = + MakeGarbageCollected<ElementVisibilityObserver>( + this, WTF::BindRepeating( + &HTMLMediaElement::OnVisibilityChangedForLazyLoad, + WrapWeakPersistent(this))); lazy_load_visibility_observer_->Start(); } }
diff --git a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc index 77a4626..e09c9282 100644 --- a/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc +++ b/third_party/blink/renderer/core/html/media/html_media_element_event_listeners_test.cc
@@ -239,16 +239,17 @@ class MockEventListener final : public EventListener { public: - static MockEventListener* Create() { return new MockEventListener(); } + static MockEventListener* Create() { + return MakeGarbageCollected<MockEventListener>(); + } + + MockEventListener() : EventListener(kCPPEventListenerType) {} bool operator==(const EventListener& other) const final { return this == &other; } MOCK_METHOD2(Invoke, void(ExecutionContext* executionContext, Event*)); - - private: - MockEventListener() : EventListener(kCPPEventListenerType) {} }; class HTMLMediaElementWithMockSchedulerTest
diff --git a/third_party/blink/renderer/core/html/shadow/details_marker_control.h b/third_party/blink/renderer/core/html/shadow/details_marker_control.h index 4a4740a..95f42761 100644 --- a/third_party/blink/renderer/core/html/shadow/details_marker_control.h +++ b/third_party/blink/renderer/core/html/shadow/details_marker_control.h
@@ -51,7 +51,8 @@ }; inline DetailsMarkerControl* DetailsMarkerControl::Create(Document& document) { - DetailsMarkerControl* element = new DetailsMarkerControl(document); + DetailsMarkerControl* element = + MakeGarbageCollected<DetailsMarkerControl>(document); element->SetShadowPseudoId(AtomicString("-webkit-details-marker")); return element; }
diff --git a/third_party/blink/renderer/core/html/track/inband_text_track.cc b/third_party/blink/renderer/core/html/track/inband_text_track.cc index 454642c..3c0f256 100644 --- a/third_party/blink/renderer/core/html/track/inband_text_track.cc +++ b/third_party/blink/renderer/core/html/track/inband_text_track.cc
@@ -60,7 +60,7 @@ } // namespace InbandTextTrack* InbandTextTrack::Create(WebInbandTextTrack* web_track) { - return new InbandTextTrack(web_track); + return MakeGarbageCollected<InbandTextTrack>(web_track); } InbandTextTrack::InbandTextTrack(WebInbandTextTrack* web_track)
diff --git a/third_party/blink/renderer/core/html/track/inband_text_track.h b/third_party/blink/renderer/core/html/track/inband_text_track.h index 6d4c15ff..819df92f 100644 --- a/third_party/blink/renderer/core/html/track/inband_text_track.h +++ b/third_party/blink/renderer/core/html/track/inband_text_track.h
@@ -42,13 +42,13 @@ public WebInbandTextTrackClient { public: static InbandTextTrack* Create(WebInbandTextTrack*); + + explicit InbandTextTrack(WebInbandTextTrack*); ~InbandTextTrack() override; void SetTrackList(TextTrackList*) override; private: - explicit InbandTextTrack(WebInbandTextTrack*); - void AddWebVTTCue(double, double, const WebString&,
diff --git a/third_party/blink/renderer/core/html/track/loadable_text_track.h b/third_party/blink/renderer/core/html/track/loadable_text_track.h index fd35fee0..2a5f44c7 100644 --- a/third_party/blink/renderer/core/html/track/loadable_text_track.h +++ b/third_party/blink/renderer/core/html/track/loadable_text_track.h
@@ -37,8 +37,10 @@ class LoadableTextTrack final : public TextTrack { public: static LoadableTextTrack* Create(HTMLTrackElement* track) { - return new LoadableTextTrack(track); + return MakeGarbageCollected<LoadableTextTrack>(track); } + + explicit LoadableTextTrack(HTMLTrackElement*); ~LoadableTextTrack() override; // TextTrack method. @@ -54,8 +56,6 @@ void Trace(blink::Visitor*) override; private: - explicit LoadableTextTrack(HTMLTrackElement*); - Member<HTMLTrackElement> track_element_; };
diff --git a/third_party/blink/renderer/core/input/event_handler.cc b/third_party/blink/renderer/core/input/event_handler.cc index 73d9bbb..264de0f6 100644 --- a/third_party/blink/renderer/core/input/event_handler.cc +++ b/third_party/blink/renderer/core/input/event_handler.cc
@@ -159,14 +159,15 @@ mouse_event_manager_(new MouseEventManager(frame, *scroll_manager_)), mouse_wheel_event_manager_(new MouseWheelEventManager(frame)), keyboard_event_manager_( - new KeyboardEventManager(frame, *scroll_manager_)), + MakeGarbageCollected<KeyboardEventManager>(frame, *scroll_manager_)), pointer_event_manager_( new PointerEventManager(frame, *mouse_event_manager_)), - gesture_manager_(new GestureManager(frame, - *scroll_manager_, - *mouse_event_manager_, - *pointer_event_manager_, - *selection_controller_)), + gesture_manager_( + MakeGarbageCollected<GestureManager>(frame, + *scroll_manager_, + *mouse_event_manager_, + *pointer_event_manager_, + *selection_controller_)), active_interval_timer_(frame.GetTaskRunner(TaskType::kUserInteraction), this, &EventHandler::ActiveIntervalTimerFired) {}
diff --git a/third_party/blink/renderer/core/input/input_device_capabilities.h b/third_party/blink/renderer/core/input/input_device_capabilities.h index b2d13b4..21cf5e4b 100644 --- a/third_party/blink/renderer/core/input/input_device_capabilities.h +++ b/third_party/blink/renderer/core/input/input_device_capabilities.h
@@ -16,20 +16,20 @@ public: static InputDeviceCapabilities* Create(bool fires_touch_events) { - return new InputDeviceCapabilities(fires_touch_events); + return MakeGarbageCollected<InputDeviceCapabilities>(fires_touch_events); } static InputDeviceCapabilities* Create( const InputDeviceCapabilitiesInit* initializer) { - return new InputDeviceCapabilities(initializer); + return MakeGarbageCollected<InputDeviceCapabilities>(initializer); } + InputDeviceCapabilities(bool fires_touch_events); + InputDeviceCapabilities(const InputDeviceCapabilitiesInit*); + bool firesTouchEvents() const { return fires_touch_events_; } private: - InputDeviceCapabilities(bool fires_touch_events); - InputDeviceCapabilities(const InputDeviceCapabilitiesInit*); - // Whether this device dispatches touch events. This mainly lets developers // avoid handling both touch and mouse events dispatched for a single user // action.
diff --git a/third_party/blink/renderer/core/inspector/browser_protocol.pdl b/third_party/blink/renderer/core/inspector/browser_protocol.pdl index 7bb88ae..704c6b7 100644 --- a/third_party/blink/renderer/core/inspector/browser_protocol.pdl +++ b/third_party/blink/renderer/core/inspector/browser_protocol.pdl
@@ -4158,7 +4158,7 @@ # Identifier of the network request to get content for. RequestId requestId returns - # Base64-encoded request body. + # Request body string, omitting files from multipart requests string postData # Returns content served for the given currently intercepted request.
diff --git a/third_party/blink/renderer/core/inspector/dev_tools_emulator.cc b/third_party/blink/renderer/core/inspector/dev_tools_emulator.cc index 77d1fd8..c0f40a7 100644 --- a/third_party/blink/renderer/core/inspector/dev_tools_emulator.cc +++ b/third_party/blink/renderer/core/inspector/dev_tools_emulator.cc
@@ -111,7 +111,7 @@ DevToolsEmulator::~DevToolsEmulator() = default; DevToolsEmulator* DevToolsEmulator::Create(WebViewImpl* web_view_base) { - return new DevToolsEmulator(web_view_base); + return MakeGarbageCollected<DevToolsEmulator>(web_view_base); } void DevToolsEmulator::Trace(blink::Visitor* visitor) {}
diff --git a/third_party/blink/renderer/core/inspector/dev_tools_emulator.h b/third_party/blink/renderer/core/inspector/dev_tools_emulator.h index e860b7b2..0d3d98f 100644 --- a/third_party/blink/renderer/core/inspector/dev_tools_emulator.h +++ b/third_party/blink/renderer/core/inspector/dev_tools_emulator.h
@@ -24,6 +24,7 @@ class CORE_EXPORT DevToolsEmulator final : public GarbageCollectedFinalized<DevToolsEmulator> { public: + explicit DevToolsEmulator(WebViewImpl*); ~DevToolsEmulator(); static DevToolsEmulator* Create(WebViewImpl*); void Trace(blink::Visitor*); @@ -66,8 +67,6 @@ base::Optional<IntRect> VisibleContentRectForPainting() const; private: - explicit DevToolsEmulator(WebViewImpl*); - void EnableMobileEmulation(); void DisableMobileEmulation();
diff --git a/third_party/blink/renderer/core/inspector/dev_tools_host.cc b/third_party/blink/renderer/core/inspector/dev_tools_host.cc index c7c1687..64c10cbf 100644 --- a/third_party/blink/renderer/core/inspector/dev_tools_host.cc +++ b/third_party/blink/renderer/core/inspector/dev_tools_host.cc
@@ -65,9 +65,13 @@ public: static FrontendMenuProvider* Create(DevToolsHost* devtools_host, WebVector<WebMenuItemInfo> items) { - return new FrontendMenuProvider(devtools_host, std::move(items)); + return MakeGarbageCollected<FrontendMenuProvider>(devtools_host, + std::move(items)); } + FrontendMenuProvider(DevToolsHost* devtools_host, + WebVector<WebMenuItemInfo> items) + : devtools_host_(devtools_host), items_(std::move(items)) {} ~FrontendMenuProvider() override { // Verify that this menu provider has been detached. DCHECK(!devtools_host_); @@ -101,10 +105,6 @@ } private: - FrontendMenuProvider(DevToolsHost* devtools_host, - WebVector<WebMenuItemInfo> items) - : devtools_host_(devtools_host), items_(std::move(items)) {} - Member<DevToolsHost> devtools_host_; WebVector<WebMenuItemInfo> items_; };
diff --git a/third_party/blink/renderer/core/inspector/dev_tools_host.h b/third_party/blink/renderer/core/inspector/dev_tools_host.h index 32279eb..7e47396 100644 --- a/third_party/blink/renderer/core/inspector/dev_tools_host.h +++ b/third_party/blink/renderer/core/inspector/dev_tools_host.h
@@ -48,10 +48,12 @@ public: static DevToolsHost* Create(InspectorFrontendClient* client, LocalFrame* frontend_frame) { - return new DevToolsHost(client, frontend_frame); + return MakeGarbageCollected<DevToolsHost>(client, frontend_frame); } + DevToolsHost(InspectorFrontendClient*, LocalFrame* frontend_frame); ~DevToolsHost() override; + void Trace(blink::Visitor*) override; void DisconnectClient(); @@ -85,7 +87,6 @@ private: friend class FrontendMenuProvider; - DevToolsHost(InspectorFrontendClient*, LocalFrame* frontend_frame); void EvaluateScript(const String&); Member<InspectorFrontendClient> client_;
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 627cef2..42874d1 100644 --- a/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_overlay_agent.cc
@@ -169,9 +169,13 @@ public: static InspectorOverlayChromeClient* Create(ChromeClient& client, InspectorOverlayAgent& overlay) { - return new InspectorOverlayChromeClient(client, overlay); + return MakeGarbageCollected<InspectorOverlayChromeClient>(client, overlay); } + InspectorOverlayChromeClient(ChromeClient& client, + InspectorOverlayAgent& overlay) + : client_(&client), overlay_(&overlay) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(client_); visitor->Trace(overlay_); @@ -194,10 +198,6 @@ void InvalidateRect(const IntRect&) override { overlay_->Invalidate(); } private: - InspectorOverlayChromeClient(ChromeClient& client, - InspectorOverlayAgent& overlay) - : client_(&client), overlay_(&overlay) {} - Member<ChromeClient> client_; Member<InspectorOverlayAgent> overlay_; };
diff --git a/third_party/blink/renderer/core/inspector/inspector_resource_content_loader.cc b/third_party/blink/renderer/core/inspector/inspector_resource_content_loader.cc index 55a66c1..dfaef897 100644 --- a/third_party/blink/renderer/core/inspector/inspector_resource_content_loader.cc +++ b/third_party/blink/renderer/core/inspector/inspector_resource_content_loader.cc
@@ -68,7 +68,8 @@ void InspectorResourceContentLoader::Start() { started_ = true; HeapVector<Member<Document>> documents; - InspectedFrames* inspected_frames = new InspectedFrames(inspected_frame_); + InspectedFrames* inspected_frames = + MakeGarbageCollected<InspectedFrames>(inspected_frame_); for (LocalFrame* frame : *inspected_frames) { documents.push_back(frame->GetDocument()); documents.AppendVector(InspectorPageAgent::ImportsForFrame(frame)); @@ -93,7 +94,8 @@ ResourceLoaderOptions options; options.initiator_info.name = fetch_initiator_type_names::kInternal; FetchParameters params(resource_request, options); - ResourceClient* resource_client = new ResourceClient(this); + ResourceClient* resource_client = + MakeGarbageCollected<ResourceClient>(this); // Prevent garbage collection by holding a reference to this resource. resources_.push_back( RawResource::Fetch(params, document->Fetcher(), resource_client)); @@ -114,7 +116,8 @@ ResourceLoaderOptions options; options.initiator_info.name = fetch_initiator_type_names::kInternal; FetchParameters params(resource_request, options); - ResourceClient* resource_client = new ResourceClient(this); + ResourceClient* resource_client = + MakeGarbageCollected<ResourceClient>(this); // Prevent garbage collection by holding a reference to this resource. resources_.push_back(CSSStyleSheetResource::Fetch( params, document->Fetcher(), resource_client));
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc b/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc index 1de156b1..0d2bd92 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc
@@ -123,10 +123,12 @@ FloatRect root_bounds(geometry.UnZoomedRootRect()); FloatRect* root_bounds_pointer = report_root_bounds ? &root_bounds : nullptr; - IntersectionObserverEntry* new_entry = new IntersectionObserverEntry( - timestamp, new_visible_ratio, FloatRect(geometry.UnZoomedTargetRect()), - root_bounds_pointer, FloatRect(geometry.UnZoomedIntersectionRect()), - new_threshold_index > 0, is_visible, Target()); + IntersectionObserverEntry* new_entry = + MakeGarbageCollected<IntersectionObserverEntry>( + timestamp, new_visible_ratio, + FloatRect(geometry.UnZoomedTargetRect()), root_bounds_pointer, + FloatRect(geometry.UnZoomedIntersectionRect()), + new_threshold_index > 0, is_visible, Target()); entries_.push_back(new_entry); To<Document>(Observer()->GetExecutionContext()) ->EnsureIntersectionObserverController()
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc b/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc index c499a8e..4ad473fd 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc
@@ -175,8 +175,8 @@ if (exception_state.HadException()) return nullptr; - return new IntersectionObserver(delegate, root, root_margin, thresholds, - delay, track_visibility); + return MakeGarbageCollected<IntersectionObserver>( + delegate, root, root_margin, thresholds, delay, track_visibility); } IntersectionObserver* IntersectionObserver::Create( @@ -199,9 +199,9 @@ ExceptionState& exception_state) { IntersectionObserverDelegateImpl* intersection_observer_delegate = new IntersectionObserverDelegateImpl(document, std::move(callback)); - return new IntersectionObserver(*intersection_observer_delegate, nullptr, - root_margin, thresholds, delay, - track_visibility); + return MakeGarbageCollected<IntersectionObserver>( + *intersection_observer_delegate, nullptr, root_margin, thresholds, delay, + track_visibility); } IntersectionObserver::IntersectionObserver( @@ -278,7 +278,7 @@ return; IntersectionObservation* observation = - new IntersectionObservation(*this, *target); + MakeGarbageCollected<IntersectionObservation>(*this, *target); target->EnsureIntersectionObserverData().AddObservation(*observation); observations_.insert(observation); if (target->isConnected()) {
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 dc46fd0a..395e53d 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observer.h +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observer.h
@@ -55,6 +55,13 @@ ExceptionState& = ASSERT_NO_EXCEPTION); static void ResumeSuspendedObservers(); + explicit IntersectionObserver(IntersectionObserverDelegate&, + Element*, + const Vector<Length>& root_margin, + const Vector<float>& thresholds, + DOMHighResTimeStamp delay, + bool track_visibility); + // API methods. void observe(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); void unobserve(Element*, ExceptionState& = ASSERT_NO_EXCEPTION); @@ -98,12 +105,6 @@ static void SetThrottleDelayEnabledForTesting(bool); private: - explicit IntersectionObserver(IntersectionObserverDelegate&, - Element*, - const Vector<Length>& root_margin, - const Vector<float>& thresholds, - DOMHighResTimeStamp delay, - bool track_visibility); void ClearWeakMembers(Visitor*); const TraceWrapperMember<IntersectionObserverDelegate> delegate_;
diff --git a/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc b/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc index afd22255..4e39a33 100644 --- a/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc +++ b/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc
@@ -18,7 +18,7 @@ IntersectionObserverController* IntersectionObserverController::Create( Document* document) { IntersectionObserverController* result = - new IntersectionObserverController(document); + MakeGarbageCollected<IntersectionObserverController>(document); result->PauseIfNeeded(); return result; }
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 acd4112f..9bafb39b 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
@@ -27,6 +27,8 @@ public: static IntersectionObserverController* Create(Document*); + + explicit IntersectionObserverController(Document*); ~IntersectionObserverController() override; void Unpause() override; @@ -43,7 +45,6 @@ } private: - explicit IntersectionObserverController(Document*); void PostTaskToDeliverObservations(); private:
diff --git a/third_party/blink/renderer/core/layout/BUILD.gn b/third_party/blink/renderer/core/layout/BUILD.gn index e2563eeb..c3d109d 100644 --- a/third_party/blink/renderer/core/layout/BUILD.gn +++ b/third_party/blink/renderer/core/layout/BUILD.gn
@@ -94,6 +94,8 @@ "intersection_geometry.cc", "intersection_geometry.h", "intrinsic_sizing_info.h", + "jank_region.cc", + "jank_region.h", "jank_tracker.cc", "jank_tracker.h", "layout_analyzer.cc",
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet.cc b/third_party/blink/renderer/core/layout/custom/layout_worklet.cc index 13080b4..7457bd7 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet.cc +++ b/third_party/blink/renderer/core/layout/custom/layout_worklet.cc
@@ -30,7 +30,7 @@ // static LayoutWorklet* LayoutWorklet::Create(LocalFrame* frame) { - return new LayoutWorklet(frame); + return MakeGarbageCollected<LayoutWorklet>(frame); } LayoutWorklet::LayoutWorklet(LocalFrame* frame) @@ -63,7 +63,7 @@ WorkletGlobalScopeProxy* LayoutWorklet::CreateGlobalScope() { DCHECK(NeedsToCreateGlobalScope()); - return new LayoutWorkletGlobalScopeProxy( + return MakeGarbageCollected<LayoutWorkletGlobalScopeProxy>( To<Document>(GetExecutionContext())->GetFrame(), ModuleResponsesMap(), pending_layout_registry_, GetNumberOfGlobalScopes() + 1); }
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet.h b/third_party/blink/renderer/core/layout/custom/layout_worklet.h index b2a8d36..0641237 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet.h +++ b/third_party/blink/renderer/core/layout/custom/layout_worklet.h
@@ -35,6 +35,7 @@ static LayoutWorklet* From(LocalDOMWindow&); static LayoutWorklet* Create(LocalFrame*); + explicit LayoutWorklet(LocalFrame*); ~LayoutWorklet() override; typedef HeapHashMap<String, Member<DocumentLayoutDefinition>> @@ -49,8 +50,6 @@ void Trace(blink::Visitor*) override; protected: - explicit LayoutWorklet(LocalFrame*); - // TODO(ikilpatrick): Make selection of the global scope non-deterministic. wtf_size_t SelectGlobalScope() final { return 0u; }
diff --git a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.cc b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.cc index 1147dce..8121738 100644 --- a/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.cc +++ b/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.cc
@@ -26,9 +26,9 @@ WorkerReportingProxy& reporting_proxy, PendingLayoutRegistry* pending_layout_registry, size_t global_scope_number) { - auto* global_scope = - new LayoutWorkletGlobalScope(frame, std::move(creation_params), - reporting_proxy, pending_layout_registry); + auto* global_scope = MakeGarbageCollected<LayoutWorkletGlobalScope>( + frame, std::move(creation_params), reporting_proxy, + pending_layout_registry); String context_name("LayoutWorklet #"); context_name.append(String::Number(global_scope_number)); global_scope->ScriptController()->InitializeContextIfNeeded(context_name,
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 c3319abc..69c2f99 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
@@ -29,6 +29,11 @@ WorkerReportingProxy&, PendingLayoutRegistry*, size_t global_scope_number); + + LayoutWorkletGlobalScope(LocalFrame*, + std::unique_ptr<GlobalScopeCreationParams>, + WorkerReportingProxy&, + PendingLayoutRegistry*); ~LayoutWorkletGlobalScope() override; void Dispose() final; @@ -44,11 +49,6 @@ void Trace(blink::Visitor*) override; private: - LayoutWorkletGlobalScope(LocalFrame*, - std::unique_ptr<GlobalScopeCreationParams>, - WorkerReportingProxy&, - PendingLayoutRegistry*); - // https://drafts.css-houdini.org/css-layout-api/#layout-definitions typedef HeapHashMap<String, TraceWrapperMember<CSSLayoutDefinition>> DefinitionMap;
diff --git a/third_party/blink/renderer/core/layout/hit_test_cache.h b/third_party/blink/renderer/core/layout/hit_test_cache.h index d7eff08..4cd439c 100644 --- a/third_party/blink/renderer/core/layout/hit_test_cache.h +++ b/third_party/blink/renderer/core/layout/hit_test_cache.h
@@ -47,7 +47,9 @@ class CORE_EXPORT HitTestCache final : public GarbageCollectedFinalized<HitTestCache> { public: - static HitTestCache* Create() { return new HitTestCache; } + static HitTestCache* Create() { return MakeGarbageCollected<HitTestCache>(); } + + HitTestCache() : update_index_(0), dom_tree_version_(0) {} // Check the cache for a possible hit and update |result| if // hit encountered; returning true. Otherwise false. @@ -65,8 +67,6 @@ void Trace(blink::Visitor*); private: - HitTestCache() : update_index_(0), dom_tree_version_(0) {} - // The below UMA values reference a validity region. This code has not // been written yet; and exact matches are only supported but the // UMA enumerations have been added for future support.
diff --git a/third_party/blink/renderer/core/layout/hit_test_canvas_result.h b/third_party/blink/renderer/core/layout/hit_test_canvas_result.h index a37c95a..7e77a0f 100644 --- a/third_party/blink/renderer/core/layout/hit_test_canvas_result.h +++ b/third_party/blink/renderer/core/layout/hit_test_canvas_result.h
@@ -13,17 +13,17 @@ : public GarbageCollectedFinalized<HitTestCanvasResult> { public: static HitTestCanvasResult* Create(String id, Member<Element> control) { - return new HitTestCanvasResult(id, control); + return MakeGarbageCollected<HitTestCanvasResult>(id, control); } + HitTestCanvasResult(String id, Member<Element> control); + String GetId() const; Element* GetControl() const; void Trace(blink::Visitor*); private: - HitTestCanvasResult(String id, Member<Element> control); - String id_; Member<Element> control_; };
diff --git a/third_party/blink/renderer/core/layout/jank_region.cc b/third_party/blink/renderer/core/layout/jank_region.cc new file mode 100644 index 0000000..8a0b580 --- /dev/null +++ b/third_party/blink/renderer/core/layout/jank_region.cc
@@ -0,0 +1,317 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/layout/jank_region.h" + +namespace blink { + +namespace { + +// A segment is a contiguous range of one or more basic intervals. +struct Segment { + // These are the 0-based indexes into the basic intervals, of the first and + // last basic interval in the segment. + unsigned first_interval; + unsigned last_interval; +}; + +// An "event" occurs when a rectangle starts intersecting the sweep line +// (START), or when it ceases to intersect the sweep line (END). +enum class EventType { START, END }; +struct SweepEvent { + // X-coordinate at which the event occurs. + int x; + // Whether the sweep line is entering or exiting the generating rect. + EventType type; + // The generating rect's intersection with the sweep line. + Segment y_segment; +}; + +// The sequence of adjacent intervals on the y-axis whose endpoints are the +// extents (IntRect::Y and IntRect::MaxY) of all the rectangles in the input. +class BasicIntervals { + public: + // Add all the endpoints before creating the index. + void AddEndpoint(int endpoint); + void CreateIndex(); + + // Create the index before querying these. + unsigned NumIntervals() const; + Segment SegmentFromEndpoints(int start, int end) const; + unsigned SegmentLength(Segment) const; + + private: + Vector<int> endpoints_; + std::map<int, unsigned> endpoint_to_index_; + +#if DCHECK_IS_ON() + bool has_index_ = false; +#endif +}; + +#if DCHECK_IS_ON() +#define DCHECK_HAS_INDEX(expected) DCHECK(has_index_ == expected) +#else +#define DCHECK_HAS_INDEX(expected) +#endif + +inline void BasicIntervals::AddEndpoint(int endpoint) { + DCHECK_HAS_INDEX(false); + + // We can't index yet, but use the map to de-dupe. + auto ret = endpoint_to_index_.insert(std::make_pair(endpoint, 0u)); + if (ret.second) + endpoints_.push_back(endpoint); +} + +void BasicIntervals::CreateIndex() { + DCHECK_HAS_INDEX(false); + std::sort(endpoints_.begin(), endpoints_.end()); + unsigned i = 0; + for (const int& e : endpoints_) + endpoint_to_index_[e] = i++; + +#if DCHECK_IS_ON() + has_index_ = true; +#endif +} + +inline unsigned BasicIntervals::NumIntervals() const { + DCHECK_HAS_INDEX(true); + return endpoints_.size() - 1; +} + +inline Segment BasicIntervals::SegmentFromEndpoints(int start, int end) const { + DCHECK_HAS_INDEX(true); + return Segment{endpoint_to_index_.at(start), endpoint_to_index_.at(end) - 1}; +} + +inline unsigned BasicIntervals::SegmentLength(Segment segment) const { + DCHECK_HAS_INDEX(true); + return endpoints_[segment.last_interval + 1] - + endpoints_[segment.first_interval]; +} + +#undef DCHECK_HAS_INDEX + +// An array-backed, weight-balanced binary tree whose leaves represent the basic +// intervals. Non-leaf nodes represent the union of their children's intervals. +class SegmentTree { + public: + SegmentTree(const BasicIntervals&); + + // The RefSegment and DerefSegment methods mark nodes corresponding to a + // segment by touching the minimal set of nodes that comprise the segment, + // i.e. every node that is fully within the segment, but whose parent isn't. + // There are only O(log N) nodes in this set. + void RefSegment(Segment); + void DerefSegment(Segment); + + // Combined length of all active segments. + unsigned ActiveLength() const; + + private: + static unsigned ComputeCapacity(unsigned leaf_count); + + static unsigned LeftChild(unsigned node_index); + static unsigned RightChild(unsigned node_index); + + Segment RootSegment() const; + unsigned ComputeActiveLength(unsigned node_index, Segment node_segment) const; + + // Visit implements the recursive descent through the tree to update nodes for + // a RefSegment or DerefSegment operation. + void Visit(unsigned node_index, + Segment node_segment, + Segment query_segment, + int refcount_delta); + + struct Node { + // The ref count for a node tells the number of active segments (rectangles + // intersecting the sweep line) that fully contain this node but not its + // parent. It's updated by RefSegment and DerefSegment. + unsigned ref_count = 0; + + // Length-contribution of the intervals in this node's subtree that have + // non-zero ref counts. + unsigned active_length = 0; + }; + + const BasicIntervals& intervals_; + Vector<Node> nodes_; +}; + +SegmentTree::SegmentTree(const BasicIntervals& intervals) + : intervals_(intervals) { + nodes_.resize(ComputeCapacity(intervals.NumIntervals())); +} + +inline void SegmentTree::RefSegment(Segment segment) { + Visit(0, RootSegment(), segment, 1); +} + +inline void SegmentTree::DerefSegment(Segment segment) { + Visit(0, RootSegment(), segment, -1); +} + +inline unsigned SegmentTree::ActiveLength() const { + return nodes_.front().active_length; +} + +unsigned SegmentTree::ComputeCapacity(unsigned leaf_count) { + unsigned cap = 1; + while (cap < leaf_count) + cap = cap << 1; + return (cap << 1) - 1; +} + +inline unsigned SegmentTree::LeftChild(unsigned node_index) { + return (node_index << 1) + 1; +} + +inline unsigned SegmentTree::RightChild(unsigned node_index) { + return (node_index << 1) + 2; +} + +inline Segment SegmentTree::RootSegment() const { + return {0, intervals_.NumIntervals() - 1}; +} + +inline unsigned SegmentTree::ComputeActiveLength(unsigned node_index, + Segment node_segment) const { + // If any segment fully covers the interval represented by this node, + // then its active length contribution is the entire interval. + if (nodes_[node_index].ref_count > 0) + return intervals_.SegmentLength(node_segment); + + // Otherwise, it contributes only the active lengths of its children. + if (node_segment.last_interval > node_segment.first_interval) { + return nodes_[LeftChild(node_index)].active_length + + nodes_[RightChild(node_index)].active_length; + } + return 0; +} + +void SegmentTree::Visit(unsigned node_index, + Segment node_segment, + Segment query_segment, + int refcount_delta) { + Node& node = nodes_[node_index]; + + // node_segment is the interval represented by this node. (We save some space + // by computing it as we descend instead of storing it in the Node.) + unsigned node_low = node_segment.first_interval; + unsigned node_high = node_segment.last_interval; + + // query_segment is the interval we want to update within the node. + unsigned query_low = query_segment.first_interval; + unsigned query_high = query_segment.last_interval; + + DCHECK(query_low >= node_low && query_high <= node_high); + + if (node_low == query_low && node_high == query_high) { + // The entire node is covered. + node.ref_count += refcount_delta; + } else { + // Last interval in left subtree. + unsigned lower_mid = (node_low + node_high) >> 1; + // First interval in right subtree. + unsigned upper_mid = lower_mid + 1; + + if (query_low <= lower_mid) { + Visit(LeftChild(node_index), {node_low, lower_mid}, + {query_low, std::min(query_high, lower_mid)}, refcount_delta); + } + if (query_high >= upper_mid) { + Visit(RightChild(node_index), {upper_mid, node_high}, + {std::max(query_low, upper_mid), query_high}, refcount_delta); + } + } + node.active_length = ComputeActiveLength(node_index, node_segment); +} + +// Runs the sweep line algorithm to compute the area of a set of rects. +class Sweeper { + public: + Sweeper(const Vector<IntRect>&); + + // Returns the area. + uint64_t Sweep() const; + + private: + void InitIntervals(BasicIntervals&) const; + void InitEventQueue(Vector<SweepEvent>&, const BasicIntervals&) const; + uint64_t SweepImpl(SegmentTree&, const Vector<SweepEvent>&) const; + + // The input. + const Vector<IntRect>& rects_; +}; + +Sweeper::Sweeper(const Vector<IntRect>& rects) : rects_(rects) {} + +uint64_t Sweeper::Sweep() const { + BasicIntervals y_vals; + InitIntervals(y_vals); + SegmentTree tree(y_vals); + + Vector<SweepEvent> events; + InitEventQueue(events, y_vals); + return SweepImpl(tree, events); +} + +void Sweeper::InitIntervals(BasicIntervals& y_vals) const { + for (const IntRect& rect : rects_) { + y_vals.AddEndpoint(rect.Y()); + y_vals.AddEndpoint(rect.MaxY()); + } + y_vals.CreateIndex(); +} + +void Sweeper::InitEventQueue(Vector<SweepEvent>& events, + const BasicIntervals& y_vals) const { + events.ReserveInitialCapacity(rects_.size() << 1); + for (const IntRect& rect : rects_) { + Segment segment = y_vals.SegmentFromEndpoints(rect.Y(), rect.MaxY()); + events.push_back(SweepEvent{rect.X(), EventType::START, segment}); + events.push_back(SweepEvent{rect.MaxX(), EventType::END, segment}); + } + std::sort(events.begin(), events.end(), + [](const SweepEvent& e1, const SweepEvent& e2) -> bool { + return e1.x < e2.x; + }); +} + +uint64_t Sweeper::SweepImpl(SegmentTree& tree, + const Vector<SweepEvent>& events) const { + uint64_t area = 0; + int sweep_x = events.front().x; + + for (const SweepEvent& e : events) { + if (e.x > sweep_x) { + area += (uint64_t)(e.x - sweep_x) * (uint64_t)tree.ActiveLength(); + sweep_x = e.x; + } + if (e.type == EventType::START) + tree.RefSegment(e.y_segment); + else + tree.DerefSegment(e.y_segment); + } + return area; +} + +} // namespace + +uint64_t JankRegion::Area() const { + if (rects_.IsEmpty()) + return 0; + + // Optimization: for a single rect, we don't need Sweeper. + if (rects_.size() == 1) { + const IntRect& rect = rects_.front(); + return rect.Width() * rect.Height(); + } + return Sweeper(rects_).Sweep(); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/layout/jank_region.h b/third_party/blink/renderer/core/layout/jank_region.h new file mode 100644 index 0000000..6e19fcd --- /dev/null +++ b/third_party/blink/renderer/core/layout/jank_region.h
@@ -0,0 +1,54 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_JANK_REGION_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_JANK_REGION_H_ + +#include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/platform/geometry/int_rect.h" +#include "third_party/blink/renderer/platform/wtf/vector.h" + +namespace blink { + +// Represents a per-frame jank region for JankTracker. Only used when the +// JankTrackingSweepLine feature is enabled. +// +// This class uses a sweep line algorithm to compute the area in O(n log n) time +// where n is the number of rects recorded by AddRect. For complex jank regions, +// this is more efficient than using blink::Region, which is worst-case O(n^2) +// from the repeated calls to Region::Unite. +// +// The high-level approach is described here: +// http://jeffe.cs.illinois.edu/open/klee.html +// +// The sweep line moves from left to right. (TODO: compare performance against a +// top-to-bottom sweep.) +// +// The sweep line's current intersection with the jank region ("active length") +// is tracked by a segment tree, similar to what is described at: +// https://en.wikipedia.org/wiki/Segment_tree +// +// There are some subtleties to the segment tree, which are described by the +// comments in the implementation. + +class CORE_EXPORT JankRegion { + public: + void AddRect(const IntRect& rect) { + if (!rect.IsEmpty()) + rects_.push_back(rect); + } + + const Vector<IntRect>& GetRects() const { return rects_; } + bool IsEmpty() const { return rects_.IsEmpty(); } + void Reset() { rects_.clear(); } + + uint64_t Area() const; + + private: + Vector<IntRect> rects_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_JANK_REGION_H_
diff --git a/third_party/blink/renderer/core/layout/jank_region_test.cc b/third_party/blink/renderer/core/layout/jank_region_test.cc new file mode 100644 index 0000000..a688fec --- /dev/null +++ b/third_party/blink/renderer/core/layout/jank_region_test.cc
@@ -0,0 +1,122 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/core/layout/jank_region.h" + +#include <gtest/gtest.h> +#include "third_party/blink/renderer/platform/geometry/region.h" + +namespace blink { + +class JankRegionTest : public testing::Test {}; + +TEST_F(JankRegionTest, Basic) { + JankRegion region; + EXPECT_EQ(0u, region.Area()); + + region.AddRect(IntRect(2, 1, 1, 3)); + EXPECT_EQ(3u, region.Area()); + + region.AddRect(IntRect(1, 2, 3, 1)); + EXPECT_EQ(5u, region.Area()); + + region.AddRect(IntRect(1, 2, 1, 1)); + region.AddRect(IntRect(3, 2, 1, 1)); + region.AddRect(IntRect(2, 1, 1, 1)); + region.AddRect(IntRect(2, 3, 1, 1)); + EXPECT_EQ(5u, region.Area()); + + region.AddRect(IntRect(1, 1, 1, 1)); + EXPECT_EQ(6u, region.Area()); + + region.AddRect(IntRect(1, 1, 3, 3)); + EXPECT_EQ(9u, region.Area()); + + region.AddRect(IntRect(0, 0, 2, 2)); + EXPECT_EQ(12u, region.Area()); + + region.AddRect(IntRect(-1, -1, 2, 2)); + EXPECT_EQ(15u, region.Area()); + + region.Reset(); + EXPECT_EQ(0u, region.Area()); +} + +TEST_F(JankRegionTest, LargeRandom) { + JankRegion region; + Region naive_region; + static const int data[] = { + 52613, 38528, 20785, 40550, 29734, 48229, 37113, 3520, 66776, 26746, + 20527, 11398, 27951, 50399, 37139, 17597, 20593, 57272, 12528, 5907, + 18369, 6955, 50779, 41129, 66685, 46725, 30708, 32429, 140, 55034, + 14770, 40886, 54560, 53666, 15350, 12692, 29354, 47388, 47542, 15474, + 17770, 70300, 27992, 6731, 47459, 42205, 45231, 9398, 15606, 2238, + 8387, 44579, 45222, 35626, 53932, 2907, 14899, 18234, 60609, 34125, + 23985, 48145, 40247, 25215, 64427, 41207, 29742, 35282, 21390, 12640, + 14653, 71326, 41293, 4593, 54114, 55398, 17797, 55637, 64133, 25985, + 45213, 6428, 6496, 37832, 31291, 27955, 32967, 4134, 35992, 3226, + 43190, 31310, 49828, 6737, 31847, 65511, 52287, 41393, 33728, 29813, + 32425, 74095, 41857, 2537, 14073, 16177, 23053, 75553, 3570, 76482, + 49801, 17920, 45628, 59408, 44788, 18020, 11607, 21027, 27095, 52992, + 37770, 51722, 15857, 38088, 22031, 68391, 66615, 2592, 91, 16324, + 64393, 51544, 3848, 1924, 90673, 16461, 97524, 42603, 122, 55027, + 7945, 10493, 89602, 38306, 73269, 72165, 15014, 23160, 10208, 66632, + 78104, 22252, 52910, 7870, 293, 61338, 54913, 48813, 3949, 6507, + 82176, 60067, 13639, 13096, 71024, 52767, 20514, 4716, 15125, 14158, + 24315, 46986, 62316, 95391, 8390, 1007, 9520, 67532, 69963, 20117, + 51649, 42999, 1441, 34966, 17616, 16544, 51218, 72116, 1780, 12254, + 52065, 67026, 88250, 39824, 1786, 22090, 14884, 41933, 46081, 25596, + 89968, 51346, 2479, 36409, 11513, 36037, 19481, 4287, 33831, 28199, + 56514, 52659, 54910, 14740, 43540, 45912, 44651, 4232, 15199, 45442, + 45856, 19374, 17597, 50923, 24227, 17000, 47585, 61718, 48390, 37848, + 23677, 2669, 49142, 37207, 30794, 11373, 41719, 40002, 39749, 39146, + 39144, 59801, 23772, 17552, 26731, 7802, 29291, 40281, 82706, 9370, + 7006, 75864, 94618, 75409, 5267, 5222, 47927, 19430, 4425, 14295, + 16662, 22094, 33027, 48759, 42250, 5205, 5424, 70064, 36751, 60688, + 45415, 24027, 37665, 88085, 16011, 8785, 12656, 1662, 68336, 62175, + 2132, 66236, 5301, 5174, 9575, 42509, 41511, 44451, 59069, 43296, + 3246, 11251, 37176, 25619, 60728, 36030, 40982, 33756, 46296, 4407, + 84886, 59809, 8127, 34846, 44433, 4366, 4823, 52452, 4594, 69662, + 59199, 18623, 29345, 36375, 20166, 12254, 30879, 84106, 29786, 7838, + 35875, 32227, 34871, 31142, 71453, 74402, 3243, 4475, 1974, 62754, + 80498, 26875, 22957, 25916, 74769, 66343, 18666, 28537, 41799, 54598, + 32617, 73615, 51275, 20602, 10642, 57506, 72158, 38152, 12552, 36601, + 29638, 28894, 67153, 27560, 1577, 67248, 65745, 53338, 4220, 20883, + 72059, 33747, 11195, 47783, 21251, 92912, 25, 4257, 17625, 29683, + 32964, 31019, 37510, 2205, 47755, 15187, 9769, 28377, 28890, 6955, + 31621, 21088, 54431, 30372, 14567, 47483, 80553, 4324, 10574, 870, + 59862, 86272, 8682, 49237, 85735, 10570, 21034, 50807, 47647, 37221, + }; + uint64_t expected_area = 9201862875ul; + for (unsigned i = 0; i < 100; i++) { + const int* d = data + (i * 4); + IntRect r(d[0], d[1], d[2], d[3]); + region.AddRect(r); + naive_region.Unite(Region(r)); + } + EXPECT_EQ(expected_area, region.Area()); + EXPECT_EQ(expected_area, naive_region.Area()); +} + +// Creates a region like this: +// █ █ █ +// ███████ +// █ █ █ +// ███████ +// █ █ █ +// ███████ +// █ █ █ +TEST_F(JankRegionTest, Waffle) { + JankRegion region; + unsigned n = 250000; + for (unsigned i = 2; i <= n; i += 2) { + region.AddRect(IntRect(i, 1, 1, n + 1)); + region.AddRect(IntRect(1, i, n + 1, 1)); + } + uint64_t half = n >> 1; + uint64_t area = n * (half + 1) + half * half; + EXPECT_EQ(area, region.Area()); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/core/layout/jank_tracker.cc b/third_party/blink/renderer/core/layout/jank_tracker.cc index 362ac8c..cbd97b74 100644 --- a/third_party/blink/renderer/core/layout/jank_tracker.cc +++ b/third_party/blink/renderer/core/layout/jank_tracker.cc
@@ -81,6 +81,15 @@ value.EndArray(); } +static void RegionToTracedValue(const JankRegion& region, + double granularity_scale, + TracedValue& value) { + Region old_region; + for (IntRect rect : region.GetRects()) + old_region.Unite(Region(rect)); + RegionToTracedValue(old_region, granularity_scale, value); +} + JankTracker::JankTracker(LocalFrameView* frame_view) : frame_view_(frame_view), score_(0.0), @@ -131,8 +140,13 @@ visible_old_rect.Scale(scale); visible_new_rect.Scale(scale); - region_.Unite(Region(visible_old_rect)); - region_.Unite(Region(visible_new_rect)); + if (RuntimeEnabledFeatures::JankTrackingSweepLineEnabled()) { + region_experimental_.AddRect(visible_old_rect); + region_experimental_.AddRect(visible_new_rect); + } else { + region_.Unite(Region(visible_old_rect)); + region_.Unite(Region(visible_new_rect)); + } } void JankTracker::NotifyObjectPrePaint(const LayoutObject& object, @@ -166,7 +180,12 @@ } void JankTracker::NotifyPrePaintFinished() { - if (!IsActive() || region_.IsEmpty()) + if (!IsActive()) + return; + bool use_sweep_line = RuntimeEnabledFeatures::JankTrackingSweepLineEnabled(); + bool region_is_empty = + use_sweep_line ? region_experimental_.IsEmpty() : region_.IsEmpty(); + if (region_is_empty) return; IntRect viewport = frame_view_->GetScrollableArea()->VisibleContentRect(); @@ -177,7 +196,9 @@ return; double viewport_area = double(viewport.Width()) * double(viewport.Height()); - double jank_fraction = region_.Area() / viewport_area; + uint64_t region_area = + use_sweep_line ? region_experimental_.Area() : region_.Area(); + double jank_fraction = region_area / viewport_area; DCHECK_GT(jank_fraction, 0); score_ += jank_fraction; @@ -202,7 +223,10 @@ } } - region_ = Region(); + if (use_sweep_line) + region_experimental_.Reset(); + else + region_ = Region(); } void JankTracker::NotifyInput(const WebInputEvent& event) { @@ -242,7 +266,10 @@ value->SetDouble("jank_fraction", jank_fraction); value->SetDouble("cumulative_score", score_); value->SetDouble("max_distance", max_distance_); - RegionToTracedValue(region_, granularity_scale, *value); + if (RuntimeEnabledFeatures::JankTrackingSweepLineEnabled()) + RegionToTracedValue(region_experimental_, granularity_scale, *value); + else + RegionToTracedValue(region_, granularity_scale, *value); value->SetBoolean("is_main_frame", frame_view_->GetFrame().IsMainFrame()); return value; }
diff --git a/third_party/blink/renderer/core/layout/jank_tracker.h b/third_party/blink/renderer/core/layout/jank_tracker.h index 5d496d8..6c3e2f13 100644 --- a/third_party/blink/renderer/core/layout/jank_tracker.h +++ b/third_party/blink/renderer/core/layout/jank_tracker.h
@@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_JANK_TRACKER_H_ #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/layout/jank_region.h" #include "third_party/blink/renderer/platform/geometry/region.h" #include "third_party/blink/renderer/platform/timer.h" #include "third_party/blink/renderer/platform/wtf/allocator.h" @@ -59,6 +60,9 @@ // The per-frame jank region. Region region_; + // Experimental jank region implementation using sweep-line algorithm. + JankRegion region_experimental_; + // Tracks the short period after an input event during which we ignore jank. TaskRunnerTimer<JankTracker> timer_;
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource.h b/third_party/blink/renderer/core/layout/layout_image_resource.h index 4d2776a..ffd214d 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource.h
@@ -39,9 +39,12 @@ class CORE_EXPORT LayoutImageResource : public GarbageCollectedFinalized<LayoutImageResource> { public: + LayoutImageResource(); virtual ~LayoutImageResource(); - static LayoutImageResource* Create() { return new LayoutImageResource; } + static LayoutImageResource* Create() { + return MakeGarbageCollected<LayoutImageResource>(); + } virtual void Initialize(LayoutObject*); virtual void Shutdown(); @@ -73,8 +76,6 @@ virtual void Trace(blink::Visitor* visitor) { visitor->Trace(cached_image_); } protected: - LayoutImageResource(); - // Device scale factor for the associated LayoutObject. float DeviceScaleFactor() const; // Returns an image based on the passed device scale factor.
diff --git a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h index 644d3e77a..bdc4d0d 100644 --- a/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h +++ b/third_party/blink/renderer/core/layout/layout_image_resource_style_image.h
@@ -37,10 +37,11 @@ class LayoutImageResourceStyleImage final : public LayoutImageResource { public: + explicit LayoutImageResourceStyleImage(StyleImage*); ~LayoutImageResourceStyleImage() override; static LayoutImageResource* Create(StyleImage* style_image) { - return new LayoutImageResourceStyleImage(style_image); + return MakeGarbageCollected<LayoutImageResourceStyleImage>(style_image); } void Initialize(LayoutObject*) override; void Shutdown() override; @@ -60,7 +61,6 @@ void Trace(blink::Visitor*) override; private: - explicit LayoutImageResourceStyleImage(StyleImage*); Member<StyleImage> style_image_; };
diff --git a/third_party/blink/renderer/core/layout/layout_scrollbar.cc b/third_party/blink/renderer/core/layout/layout_scrollbar.cc index 33ce179..39ecd15 100644 --- a/third_party/blink/renderer/core/layout/layout_scrollbar.cc +++ b/third_party/blink/renderer/core/layout/layout_scrollbar.cc
@@ -40,7 +40,8 @@ ScrollableArea* scrollable_area, ScrollbarOrientation orientation, Element* style_source) { - return new LayoutScrollbar(scrollable_area, orientation, style_source); + return MakeGarbageCollected<LayoutScrollbar>(scrollable_area, orientation, + style_source); } LayoutScrollbar::LayoutScrollbar(ScrollableArea* scrollable_area,
diff --git a/third_party/blink/renderer/core/layout/layout_scrollbar.h b/third_party/blink/renderer/core/layout/layout_scrollbar.h index 1350555..da7effa 100644 --- a/third_party/blink/renderer/core/layout/layout_scrollbar.h +++ b/third_party/blink/renderer/core/layout/layout_scrollbar.h
@@ -44,6 +44,8 @@ static Scrollbar* CreateCustomScrollbar(ScrollableArea*, ScrollbarOrientation, Element*); + + LayoutScrollbar(ScrollableArea*, ScrollbarOrientation, Element*); ~LayoutScrollbar() override; // Return the thickness that a custom scrollbar would have, without actually @@ -78,9 +80,6 @@ void Trace(blink::Visitor*) override; - protected: - LayoutScrollbar(ScrollableArea*, ScrollbarOrientation, Element*); - private: friend class Scrollbar;
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h index c93abbf6..265c6b3d 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_resource_filter.h
@@ -52,7 +52,9 @@ kPaintingFilterCycleDetected }; - static FilterData* Create() { return new FilterData(); } + static FilterData* Create() { return MakeGarbageCollected<FilterData>(); } + + FilterData() : state_(kInitial) {} void Dispose(); @@ -61,9 +63,6 @@ Member<FilterEffect> last_effect; Member<SVGFilterGraphNodeMap> node_map; FilterDataState state_; - - private: - FilterData() : state_(kInitial) {} }; class LayoutSVGResourceFilter final : public LayoutSVGResourceContainer {
diff --git a/third_party/blink/renderer/core/loader/base_fetch_context_test.cc b/third_party/blink/renderer/core/loader/base_fetch_context_test.cc index 38df02a8f..46d875b 100644 --- a/third_party/blink/renderer/core/loader/base_fetch_context_test.cc +++ b/third_party/blink/renderer/core/loader/base_fetch_context_test.cc
@@ -47,7 +47,8 @@ execution_context->GetTaskRunner(blink::TaskType::kInternalTest)), execution_context_(execution_context), fetch_client_settings_object_( - new FetchClientSettingsObjectImpl(*execution_context)) {} + MakeGarbageCollected<FetchClientSettingsObjectImpl>( + *execution_context)) {} ~MockBaseFetchContext() override = default; // BaseFetchContext overrides:
diff --git a/third_party/blink/renderer/core/loader/empty_clients.cc b/third_party/blink/renderer/core/loader/empty_clients.cc index 4f0aa06..8791594 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.cc +++ b/third_party/blink/renderer/core/loader/empty_clients.cc
@@ -59,7 +59,7 @@ }; PopupMenu* EmptyChromeClient::OpenPopupMenu(LocalFrame&, HTMLSelectElement&) { - return new EmptyPopupMenu(); + return MakeGarbageCollected<EmptyPopupMenu>(); } ColorChooser* EmptyChromeClient::OpenColorChooser(LocalFrame*,
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h index cd0a2a3f..a0592da6 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -76,7 +76,9 @@ class CORE_EXPORT EmptyChromeClient : public ChromeClient { public: - static EmptyChromeClient* Create() { return new EmptyChromeClient; } + static EmptyChromeClient* Create() { + return MakeGarbageCollected<EmptyChromeClient>(); + } ~EmptyChromeClient() override = default; void ChromeDestroyed() override {} @@ -224,7 +226,11 @@ class CORE_EXPORT EmptyLocalFrameClient : public LocalFrameClient { public: - static EmptyLocalFrameClient* Create() { return new EmptyLocalFrameClient; } + static EmptyLocalFrameClient* Create() { + return MakeGarbageCollected<EmptyLocalFrameClient>(); + } + + EmptyLocalFrameClient() = default; ~EmptyLocalFrameClient() override = default; bool HasWebView() const override { return true; } // mainly for assertions @@ -389,8 +395,6 @@ Frame* FindFrame(const AtomicString& name) const override; protected: - EmptyLocalFrameClient() = default; - // Not owned WebTextCheckClient* text_check_client_;
diff --git a/third_party/blink/renderer/core/loader/form_submission.cc b/third_party/blink/renderer/core/loader/form_submission.cc index 5b682d8..77e931a 100644 --- a/third_party/blink/renderer/core/loader/form_submission.cc +++ b/third_party/blink/renderer/core/loader/form_submission.cc
@@ -196,9 +196,11 @@ } if (copied_attributes.Method() == kDialogMethod) { - if (submit_button) - return new FormSubmission(submit_button->ResultForDialogSubmit()); - return new FormSubmission(""); + if (submit_button) { + return MakeGarbageCollected<FormSubmission>( + submit_button->ResultForDialogSubmit()); + } + return MakeGarbageCollected<FormSubmission>(""); } Document& document = form->GetDocument(); @@ -261,9 +263,9 @@ AtomicString target_or_base_target = copied_attributes.Target().IsEmpty() ? document.BaseTarget() : copied_attributes.Target(); - return new FormSubmission(copied_attributes.Method(), action_url, - target_or_base_target, encoding_type, form, - std::move(form_data), boundary, event); + return MakeGarbageCollected<FormSubmission>( + copied_attributes.Method(), action_url, target_or_base_target, + encoding_type, form, std::move(form_data), boundary, event); } void FormSubmission::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/core/loader/form_submission.h b/third_party/blink/renderer/core/loader/form_submission.h index 14ddd3b..3f9e3b8 100644 --- a/third_party/blink/renderer/core/loader/form_submission.h +++ b/third_party/blink/renderer/core/loader/form_submission.h
@@ -98,6 +98,18 @@ const Attributes&, Event*, HTMLFormControlElement* submit_button); + + FormSubmission(SubmitMethod, + const KURL& action, + const AtomicString& target, + const AtomicString& content_type, + HTMLFormElement*, + scoped_refptr<EncodedFormData>, + const String& boundary, + Event*); + // FormSubmission for DialogMethod + explicit FormSubmission(const String& result); + void Trace(blink::Visitor*); FrameLoadRequest CreateFrameLoadRequest(Document* origin_document); @@ -115,17 +127,6 @@ const String& Result() const { return result_; } private: - FormSubmission(SubmitMethod, - const KURL& action, - const AtomicString& target, - const AtomicString& content_type, - HTMLFormElement*, - scoped_refptr<EncodedFormData>, - const String& boundary, - Event*); - // FormSubmission for DialogMethod - explicit FormSubmission(const String& result); - // FIXME: Hold an instance of Attributes instead of individual members. SubmitMethod method_; KURL action_;
diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context.cc b/third_party/blink/renderer/core/loader/frame_fetch_context.cc index ca3fe91..a3386bd 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context.cc +++ b/third_party/blink/renderer/core/loader/frame_fetch_context.cc
@@ -266,7 +266,8 @@ ResourceFetcher* FrameFetchContext::CreateFetcher(DocumentLoader* loader, Document* document) { - FrameFetchContext* context = new FrameFetchContext(loader, document); + FrameFetchContext* context = + MakeGarbageCollected<FrameFetchContext>(loader, document); ResourceFetcher* fetcher = ResourceFetcher::Create(context); if (loader && context->GetSettings()->GetSavePreviousDocumentResources() != @@ -293,7 +294,7 @@ !GetSettings()->GetDataSaverHoldbackWebApi()) { if (document_) { fetch_client_settings_object_ = - new FetchClientSettingsObjectImpl(*document_); + MakeGarbageCollected<FetchClientSettingsObjectImpl>(*document_); } DCHECK(GetFrame()); } @@ -304,7 +305,7 @@ CHECK(context.IsFrameFetchContext()); static_cast<FrameFetchContext&>(context).document_ = document; static_cast<FrameFetchContext&>(context).fetch_client_settings_object_ = - new FetchClientSettingsObjectImpl(*document); + MakeGarbageCollected<FetchClientSettingsObjectImpl>(*document); } FrameFetchContext::~FrameFetchContext() { @@ -1445,7 +1446,7 @@ return this; if (document_) { - frozen_state_ = new FrozenState( + frozen_state_ = MakeGarbageCollected<FrozenState>( Url(), GetParentSecurityOrigin(), GetAddressSpace(), GetContentSecurityPolicy(), GetSiteForCookies(), GetClientHintsPreferences(), GetDevicePixelRatio(), GetUserAgent(), @@ -1454,14 +1455,15 @@ document_->CreateFetchClientSettingsObjectSnapshot(); } else { // Some getters are unavailable in this case. - frozen_state_ = new FrozenState( + frozen_state_ = MakeGarbageCollected<FrozenState>( NullURL(), GetParentSecurityOrigin(), GetAddressSpace(), GetContentSecurityPolicy(), GetSiteForCookies(), GetClientHintsPreferences(), GetDevicePixelRatio(), GetUserAgent(), IsMainFrame(), IsSVGImageChromeClient()); - fetch_client_settings_object_ = new FetchClientSettingsObjectSnapshot( - NullURL(), nullptr, kReferrerPolicyDefault, String(), - HttpsState::kNone); + fetch_client_settings_object_ = + MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + NullURL(), nullptr, kReferrerPolicyDefault, String(), + HttpsState::kNone); } // This is needed to break a reference cycle in which off-heap
diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context.h b/third_party/blink/renderer/core/loader/frame_fetch_context.h index 8dff221..42e367d 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context.h +++ b/third_party/blink/renderer/core/loader/frame_fetch_context.h
@@ -74,6 +74,7 @@ static void ProvideDocumentToContext(FetchContext&, Document*); + FrameFetchContext(DocumentLoader*, Document*); ~FrameFetchContext() override; bool IsFrameFetchContext() override { return true; } @@ -192,8 +193,6 @@ static ResourceFetcher* CreateFetcher(DocumentLoader*, Document*); - FrameFetchContext(DocumentLoader*, Document*); - // Convenient accessors below can be used to transparently access the // relevant document loader or frame in either cases without null-checks. //
diff --git a/third_party/blink/renderer/core/loader/history_item.h b/third_party/blink/renderer/core/loader/history_item.h index 89bb9165..e0de5d0 100644 --- a/third_party/blink/renderer/core/loader/history_item.h +++ b/third_party/blink/renderer/core/loader/history_item.h
@@ -50,7 +50,9 @@ class CORE_EXPORT HistoryItem final : public GarbageCollectedFinalized<HistoryItem> { public: - static HistoryItem* Create() { return new HistoryItem; } + static HistoryItem* Create() { return MakeGarbageCollected<HistoryItem>(); } + + HistoryItem(); ~HistoryItem(); const String& UrlString() const; @@ -126,8 +128,6 @@ void Trace(blink::Visitor*); private: - HistoryItem(); - String url_string_; Referrer referrer_;
diff --git a/third_party/blink/renderer/core/loader/interactive_detector.cc b/third_party/blink/renderer/core/loader/interactive_detector.cc index f70b9be..f5f99f49 100644 --- a/third_party/blink/renderer/core/loader/interactive_detector.cc +++ b/third_party/blink/renderer/core/loader/interactive_detector.cc
@@ -33,8 +33,8 @@ InteractiveDetector* detector = Supplement<Document>::From<InteractiveDetector>(document); if (!detector) { - detector = new InteractiveDetector(document, - new NetworkActivityChecker(&document)); + detector = MakeGarbageCollected<InteractiveDetector>( + document, new NetworkActivityChecker(&document)); Supplement<Document>::ProvideTo(document, detector); } return detector;
diff --git a/third_party/blink/renderer/core/loader/interactive_detector.h b/third_party/blink/renderer/core/loader/interactive_detector.h index ce88419..d13ce52 100644 --- a/third_party/blink/renderer/core/loader/interactive_detector.h +++ b/third_party/blink/renderer/core/loader/interactive_detector.h
@@ -58,6 +58,8 @@ // Exposed for tests. See crbug.com/810381. We must use a consistent address // for the supplement name. static const char* SupplementName(); + + explicit InteractiveDetector(Document&, NetworkActivityChecker*); ~InteractiveDetector() override = default; // Calls to CurrentTimeTicksInSeconds is expensive, so we try not to call it @@ -115,8 +117,6 @@ private: friend class InteractiveDetectorTest; - explicit InteractiveDetector(Document&, NetworkActivityChecker*); - TimeTicks interactive_time_; TimeTicks interactive_detection_time_;
diff --git a/third_party/blink/renderer/core/loader/interactive_detector_test.cc b/third_party/blink/renderer/core/loader/interactive_detector_test.cc index 3887754..6aff06f 100644 --- a/third_party/blink/renderer/core/loader/interactive_detector_test.cc +++ b/third_party/blink/renderer/core/loader/interactive_detector_test.cc
@@ -42,7 +42,7 @@ Document* document = &dummy_page_holder_->GetDocument(); - detector_ = new InteractiveDetector( + detector_ = MakeGarbageCollected<InteractiveDetector>( *document, new NetworkActivityCheckerForTest(document)); // By this time, the DummyPageHolder has created an InteractiveDetector, and
diff --git a/third_party/blink/renderer/core/loader/link_loader.cc b/third_party/blink/renderer/core/loader/link_loader.cc index e0395f5..01df700 100644 --- a/third_party/blink/renderer/core/loader/link_loader.cc +++ b/third_party/blink/renderer/core/loader/link_loader.cc
@@ -664,7 +664,7 @@ resource = PrefetchIfNeeded(params, document); } if (resource) - finish_observer_ = new FinishObserver(this, resource); + finish_observer_ = MakeGarbageCollected<FinishObserver>(this, resource); ModulePreloadIfNeeded(params, document, nullptr, this);
diff --git a/third_party/blink/renderer/core/loader/link_loader.h b/third_party/blink/renderer/core/loader/link_loader.h index 30d226e5..a896ad6 100644 --- a/third_party/blink/renderer/core/loader/link_loader.h +++ b/third_party/blink/renderer/core/loader/link_loader.h
@@ -103,8 +103,11 @@ public: static LinkLoader* Create(LinkLoaderClient* client) { - return new LinkLoader(client, client->GetLoadingTaskRunner()); + return MakeGarbageCollected<LinkLoader>(client, + client->GetLoadingTaskRunner()); } + + LinkLoader(LinkLoaderClient*, scoped_refptr<base::SingleThreadTaskRunner>); ~LinkLoader() override; // from PrerenderClient @@ -150,7 +153,6 @@ private: class FinishObserver; - LinkLoader(LinkLoaderClient*, scoped_refptr<base::SingleThreadTaskRunner>); void NotifyFinished(); // SingleModuleClient implementation
diff --git a/third_party/blink/renderer/core/loader/resource/font_resource.h b/third_party/blink/renderer/core/loader/resource/font_resource.h index 3f147ba..e04f861c 100644 --- a/third_party/blink/renderer/core/loader/resource/font_resource.h +++ b/third_party/blink/renderer/core/loader/resource/font_resource.h
@@ -47,6 +47,8 @@ static FontResource* Fetch(FetchParameters&, ResourceFetcher*, FontResourceClient*); + + FontResource(const ResourceRequest&, const ResourceLoaderOptions&); ~FontResource() override; void DidAddClient(ResourceClient*) override; @@ -77,10 +79,9 @@ Resource* Create(const ResourceRequest& request, const ResourceLoaderOptions& options) const override { - return new FontResource(request, options); + return MakeGarbageCollected<FontResource>(request, options); } }; - FontResource(const ResourceRequest&, const ResourceLoaderOptions&); void NotifyFinished() override; void FontLoadShortLimitCallback();
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 510be9592..ca251db 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
@@ -1851,7 +1851,7 @@ ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> platform; - EmptyChromeClient* chrome_client = new EmptyChromeClient(); + EmptyChromeClient* chrome_client = MakeGarbageCollected<EmptyChromeClient>(); Page::PageClients clients; FillWithEmptyClients(clients); clients.chrome_client = chrome_client;
diff --git a/third_party/blink/renderer/core/loader/resource/link_fetch_resource.h b/third_party/blink/renderer/core/loader/resource/link_fetch_resource.h index c126818..0b190ff4 100644 --- a/third_party/blink/renderer/core/loader/resource/link_fetch_resource.h +++ b/third_party/blink/renderer/core/loader/resource/link_fetch_resource.h
@@ -16,6 +16,10 @@ class LinkFetchResource final : public Resource { public: static Resource* Fetch(ResourceType, FetchParameters&, ResourceFetcher*); + + LinkFetchResource(const ResourceRequest&, + ResourceType, + const ResourceLoaderOptions&); ~LinkFetchResource() override; private: @@ -26,12 +30,10 @@ Resource* Create(const ResourceRequest& request, const ResourceLoaderOptions& options) const override { - return new LinkFetchResource(request, GetType(), options); + return MakeGarbageCollected<LinkFetchResource>(request, GetType(), + options); } }; - LinkFetchResource(const ResourceRequest&, - ResourceType, - const ResourceLoaderOptions&); }; } // namespace blink
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index 76213af6..72f40ed9 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc
@@ -798,7 +798,7 @@ HTMLSelectElement& select) { NotifyPopupOpeningObservers(); if (WebViewImpl::UseExternalPopupMenus()) - return new ExternalPopupMenu(frame, select, *web_view_); + return MakeGarbageCollected<ExternalPopupMenu>(frame, select, *web_view_); DCHECK(RuntimeEnabledFeatures::PagePopupEnabled()); return InternalPopupMenu::Create(this, select);
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl_test.cc b/third_party/blink/renderer/core/page/chrome_client_impl_test.cc index e55eb1cd..828c5834 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl_test.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl_test.cc
@@ -199,10 +199,10 @@ chrome_client_impl_ = ToChromeClientImpl(&web_view_->GetPage()->GetChromeClient()); LocalFrame* frame = helper_.LocalMainFrame()->GetFrame(); - color_chooser_client_ = - new FakeColorChooserClient(frame->GetDocument()->documentElement()); - date_time_chooser_client_ = - new FakeDateTimeChooserClient(frame->GetDocument()->documentElement()); + color_chooser_client_ = MakeGarbageCollected<FakeColorChooserClient>( + frame->GetDocument()->documentElement()); + date_time_chooser_client_ = MakeGarbageCollected<FakeDateTimeChooserClient>( + frame->GetDocument()->documentElement()); select_ = HTMLSelectElement::Create(*(frame->GetDocument())); }
diff --git a/third_party/blink/renderer/core/page/drag_controller.cc b/third_party/blink/renderer/core/page/drag_controller.cc index 39e625fe..d270103 100644 --- a/third_party/blink/renderer/core/page/drag_controller.cc +++ b/third_party/blink/renderer/core/page/drag_controller.cc
@@ -150,7 +150,7 @@ did_initiate_drag_(false) {} DragController* DragController::Create(Page* page) { - return new DragController(page); + return MakeGarbageCollected<DragController>(page); } static DocumentFragment* DocumentFragmentFromDragData( @@ -1344,7 +1344,7 @@ DragState& DragController::GetDragState() { if (!drag_state_) - drag_state_ = new DragState; + drag_state_ = MakeGarbageCollected<DragState>(); return *drag_state_; }
diff --git a/third_party/blink/renderer/core/page/drag_controller.h b/third_party/blink/renderer/core/page/drag_controller.h index 6775816..2a99d90 100644 --- a/third_party/blink/renderer/core/page/drag_controller.h +++ b/third_party/blink/renderer/core/page/drag_controller.h
@@ -55,6 +55,8 @@ public: static DragController* Create(Page*); + explicit DragController(Page*); + DragOperation DragEnteredOrUpdated(DragData*, LocalFrame& local_root); void DragExited(DragData*, LocalFrame& local_root); void PerformDrag(DragData*, LocalFrame& local_root); @@ -90,8 +92,6 @@ void Trace(blink::Visitor*); private: - explicit DragController(Page*); - DispatchEventResult DispatchTextInputEventFor(LocalFrame*, DragData*); bool CanProcessDrag(DragData*, LocalFrame& local_root); bool ConcludeEditDrag(DragData*);
diff --git a/third_party/blink/renderer/core/page/focus_controller.cc b/third_party/blink/renderer/core/page/focus_controller.cc index d30f345..94b7a200 100644 --- a/third_party/blink/renderer/core/page/focus_controller.cc +++ b/third_party/blink/renderer/core/page/focus_controller.cc
@@ -767,7 +767,7 @@ is_emulating_focus_(false) {} FocusController* FocusController::Create(Page* page) { - return new FocusController(page); + return MakeGarbageCollected<FocusController>(page); } void FocusController::SetFocusedFrame(Frame* frame, bool notify_embedder) {
diff --git a/third_party/blink/renderer/core/page/focus_controller.h b/third_party/blink/renderer/core/page/focus_controller.h index ceceb13..ab26339 100644 --- a/third_party/blink/renderer/core/page/focus_controller.h +++ b/third_party/blink/renderer/core/page/focus_controller.h
@@ -57,6 +57,8 @@ static FocusController* Create(Page*); + explicit FocusController(Page*); + void SetFocusedFrame(Frame*, bool notify_embedder = true); void FocusDocumentView(Frame*, bool notify_embedder = true); LocalFrame* FocusedFrame() const; @@ -108,8 +110,6 @@ private: using SkipList = HeapHashSet<Member<Node>>; - explicit FocusController(Page*); - Element* FindFocusableElement(WebFocusType, Element&, OwnerMap&); bool AdvanceFocus(WebFocusType,
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc b/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc index 5d62696..a2be5808 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector.cc
@@ -134,33 +134,6 @@ IdentifiersFactory::FrameId(&frame_view_->GetFrame())); } -IntRect ImagePaintTimingDetector::CalculateTransformedRect( - LayoutRect& invalidated_rect, - const PaintLayer& painting_layer) const { - const auto* local_transform = painting_layer.GetLayoutObject() - .FirstFragment() - .LocalBorderBoxProperties() - .Transform(); - const auto* ancestor_transform = painting_layer.GetLayoutObject() - .View() - ->FirstFragment() - .LocalBorderBoxProperties() - .Transform(); - FloatRect invalidated_rect_abs = FloatRect(invalidated_rect); - if (invalidated_rect_abs.IsEmpty() || invalidated_rect_abs.IsZero()) - return IntRect(); - DCHECK(local_transform); - DCHECK(ancestor_transform); - GeometryMapper::SourceToDestinationRect(local_transform, ancestor_transform, - invalidated_rect_abs); - IntRect invalidated_rect_in_viewport = RoundedIntRect(invalidated_rect_abs); - ScrollableArea* scrollable_area = frame_view_->GetScrollableArea(); - DCHECK(scrollable_area); - IntRect viewport = scrollable_area->VisibleContentRect(); - invalidated_rect_in_viewport.Intersect(viewport); - return invalidated_rect_in_viewport; -} - void ImagePaintTimingDetector::OnLargestImagePaintDetected( const ImageRecord& largest_image_record) { largest_image_paint_ = largest_image_record.first_paint_time_after_loaded; @@ -357,14 +330,14 @@ recorded_node_count_++; if (recorded_node_count_ < kImageNodeNumberLimit) { LayoutRect invalidated_rect = object.FirstFragment().VisualRect(); - // Do not record first size until invalidated_rect's size becomes + // Before the image resource is loaded, <img> has size 0, so we do not + // record the first size until the invalidated rect's size becomes // non-empty. if (invalidated_rect.IsEmpty()) return; - IntRect invalidated_rect_in_viewport = - CalculateTransformedRect(invalidated_rect, painting_layer); - int rect_size = invalidated_rect_in_viewport.Height() * - invalidated_rect_in_viewport.Width(); + unsigned rect_size = + frame_view_->GetPaintTimingDetector().CalculateVisualSize( + invalidated_rect, painting_layer); if (rect_size == 0) { // When rect_size == 0, it either means the image is size 0 or the image // is out of viewport. Either way, we don't track this image anymore, to
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector.h b/third_party/blink/renderer/core/paint/image_paint_timing_detector.h index 918bb1f..c7bab672 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector.h +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector.h
@@ -17,7 +17,6 @@ namespace blink { class PaintLayer; -class IntRect; class LayoutObject; class TracedValue; class LocalFrameView; @@ -78,8 +77,6 @@ void PopulateTraceValue(TracedValue&, const ImageRecord& first_image_paint, unsigned report_count) const; - IntRect CalculateTransformedRect(LayoutRect& visual_rect, - const PaintLayer&) const; // This is provided for unit test to force invoking swap promise callback. void ReportSwapTime(unsigned max_frame_index_to_time, WebLayerTreeView::SwapResult,
diff --git a/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc b/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc index 0f09329..d4844247 100644 --- a/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc +++ b/third_party/blink/renderer/core/paint/image_paint_timing_detector_test.cc
@@ -163,6 +163,20 @@ EXPECT_TRUE(record->loaded); } +TEST_F(ImagePaintTimingDetectorTest, + IgnoreImageUntilInvalidatedRectSizeNonZero) { + SetBodyInnerHTML(R"HTML( + <img id="target"></img> + )HTML"); + UpdateAllLifecyclePhasesAndInvokeCallbackIfAny(); + EXPECT_EQ(CountRecords(), 0u); + SetImageAndPaint("target", 5, 5); + UpdateAllLifecyclePhasesAndInvokeCallbackIfAny(); + ImageRecord* record = FindLargestPaintCandidate(); + EXPECT_TRUE(record); + EXPECT_EQ(CountRecords(), 1u); +} + TEST_F(ImagePaintTimingDetectorTest, LargestImagePaint_Largest) { SetBodyInnerHTML(R"HTML( <img id="smaller"></img>
diff --git a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc index 8e0479a3..0365059f 100644 --- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc +++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc
@@ -512,6 +512,11 @@ box->SetSubtreeShouldCheckForPaintInvalidation(); } + // TODO(chrishtr): remove this slow path once crbug.com/906885 is fixed. + // See also https://bugs.chromium.org/p/chromium/issues/detail?id=903287#c10. + if (Layer()->EnclosingPaginationLayer()) + box->SetSubtreeShouldCheckForPaintInvalidation(); + // If not composited, background always paints into the main graphics layer. bool background_paint_in_graphics_layer = true; bool background_paint_in_scrolling_contents = false;
diff --git a/third_party/blink/renderer/core/paint/paint_timing.cc b/third_party/blink/renderer/core/paint/paint_timing.cc index b9963652..fc43dde 100644 --- a/third_party/blink/renderer/core/paint/paint_timing.cc +++ b/third_party/blink/renderer/core/paint/paint_timing.cc
@@ -157,7 +157,7 @@ PaintTiming::PaintTiming(Document& document) : Supplement<Document>(document), - fmp_detector_(new FirstMeaningfulPaintDetector(this)) {} + fmp_detector_(MakeGarbageCollected<FirstMeaningfulPaintDetector>(this)) {} LocalFrame* PaintTiming::GetFrame() const { return GetSupplementable()->GetFrame();
diff --git a/third_party/blink/renderer/core/paint/paint_timing_detector.cc b/third_party/blink/renderer/core/paint/paint_timing_detector.cc index 30ae6f3..d1e5744 100644 --- a/third_party/blink/renderer/core/paint/paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/paint_timing_detector.cc
@@ -6,6 +6,7 @@ #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/layout/layout_object.h" +#include "third_party/blink/renderer/core/layout/layout_view.h" #include "third_party/blink/renderer/core/loader/document_loader.h" #include "third_party/blink/renderer/core/paint/image_paint_timing_detector.h" #include "third_party/blink/renderer/core/paint/paint_layer.h" @@ -59,6 +60,27 @@ loader->DidChangePerformanceTiming(); } +unsigned PaintTimingDetector::CalculateVisualSize( + const LayoutRect& invalidated_rect, + const PaintLayer& painting_layer) const { + // This case should be dealt with outside the function. + DCHECK(!invalidated_rect.IsEmpty()); + + // As Layout objects live in different transform spaces, the object's rect + // should be projected to the viewport's transform space. + IntRect visual_rect = EnclosedIntRect(invalidated_rect); + painting_layer.GetLayoutObject().FirstFragment().MapRectToFragment( + painting_layer.GetLayoutObject().View()->FirstFragment(), visual_rect); + + // A visual rect means the part of the rect that's visible within + // the viewport. We define the size of it as visual size. + ScrollableArea* scrollable_area = frame_view_->GetScrollableArea(); + DCHECK(scrollable_area); + IntRect viewport = scrollable_area->VisibleContentRect(); + visual_rect.Intersect(viewport); + return visual_rect.Height() * visual_rect.Width(); +} + void PaintTimingDetector::Dispose() { text_paint_timing_detector_->Dispose(); }
diff --git a/third_party/blink/renderer/core/paint/paint_timing_detector.h b/third_party/blink/renderer/core/paint/paint_timing_detector.h index d645417..53a7bf9 100644 --- a/third_party/blink/renderer/core/paint/paint_timing_detector.h +++ b/third_party/blink/renderer/core/paint/paint_timing_detector.h
@@ -13,6 +13,7 @@ class LayoutObject; class LocalFrameView; class PaintLayer; +class LayoutRect; class TextPaintTimingDetector; class ImagePaintTimingDetector; @@ -32,6 +33,8 @@ void NotifyNodeRemoved(const LayoutObject& object); void NotifyPrePaintFinished(); void DidChangePerformanceTiming(); + unsigned CalculateVisualSize(const LayoutRect& invalidated_rect, + const PaintLayer& painting_layer) const; void Dispose(); TextPaintTimingDetector& GetTextPaintTimingDetector() {
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc b/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc index ef282a3..d415aff 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector.cc
@@ -53,29 +53,6 @@ IdentifiersFactory::FrameId(&frame_view_->GetFrame())); } -IntRect TextPaintTimingDetector::CalculateTransformedRect( - LayoutRect& invalidated_rect, - const PaintLayer& painting_layer) const { - const auto* local_transform = painting_layer.GetLayoutObject() - .FirstFragment() - .LocalBorderBoxProperties() - .Transform(); - const auto* ancestor_transform = painting_layer.GetLayoutObject() - .View() - ->FirstFragment() - .LocalBorderBoxProperties() - .Transform(); - FloatRect invalidated_rect_abs = FloatRect(invalidated_rect); - if (invalidated_rect_abs.IsEmpty() || invalidated_rect_abs.IsZero()) - return IntRect(); - GeometryMapper::SourceToDestinationRect(local_transform, ancestor_transform, - invalidated_rect_abs); - IntRect invalidated_rect_in_viewport = RoundedIntRect(invalidated_rect_abs); - invalidated_rect_in_viewport.Intersect( - frame_view_->GetScrollableArea()->VisibleContentRect()); - return invalidated_rect_in_viewport; -} - void TextPaintTimingDetector::OnLargestTextDetected( const TextRecord& largest_text_record) { largest_text_paint_ = largest_text_record.first_paint_time; @@ -217,14 +194,13 @@ recorded_node_count_); return; } + unsigned rect_size = 0; LayoutRect invalidated_rect = object.FirstFragment().VisualRect(); - int rect_size = 0; if (!invalidated_rect.IsEmpty()) { - IntRect invalidated_rect_in_viewport = - CalculateTransformedRect(invalidated_rect, painting_layer); - rect_size = invalidated_rect_in_viewport.Height() * - invalidated_rect_in_viewport.Width(); + rect_size = frame_view_->GetPaintTimingDetector().CalculateVisualSize( + invalidated_rect, painting_layer); } + // When rect_size == 0, it either means invalidated_rect.IsEmpty() or // the text is size 0 or the text is out of viewport. Either way, we don't // record their time, to reduce computation.
diff --git a/third_party/blink/renderer/core/paint/text_paint_timing_detector.h b/third_party/blink/renderer/core/paint/text_paint_timing_detector.h index 4cbf0e5..66cbfd3 100644 --- a/third_party/blink/renderer/core/paint/text_paint_timing_detector.h +++ b/third_party/blink/renderer/core/paint/text_paint_timing_detector.h
@@ -14,7 +14,6 @@ namespace blink { class PaintLayer; -class IntRect; class LayoutObject; class TracedValue; class LocalFrameView; @@ -70,8 +69,6 @@ void PopulateTraceValue(TracedValue& value, const TextRecord& first_text_paint, unsigned candidate_index) const; - IntRect CalculateTransformedRect(LayoutRect& visual_rect, - const PaintLayer& painting_layer) const; void TimerFired(TimerBase*); void Analyze();
diff --git a/third_party/blink/renderer/core/script/dynamic_module_resolver.h b/third_party/blink/renderer/core/script/dynamic_module_resolver.h index 56a6567e8..a7878210 100644 --- a/third_party/blink/renderer/core/script/dynamic_module_resolver.h +++ b/third_party/blink/renderer/core/script/dynamic_module_resolver.h
@@ -26,9 +26,12 @@ void Trace(blink::Visitor*); static DynamicModuleResolver* Create(Modulator* modulator) { - return new DynamicModuleResolver(modulator); + return MakeGarbageCollected<DynamicModuleResolver>(modulator); } + explicit DynamicModuleResolver(Modulator* modulator) + : modulator_(modulator) {} + // Implements "HostImportModuleDynamically" semantics. // Should be called w/ a valid V8 context. void ResolveDynamically(const String& specifier, @@ -37,9 +40,6 @@ ScriptPromiseResolver*); private: - explicit DynamicModuleResolver(Modulator* modulator) - : modulator_(modulator) {} - Member<Modulator> modulator_; };
diff --git a/third_party/blink/renderer/core/script/module_map.cc b/third_party/blink/renderer/core/script/module_map.cc index 9f7deb1bd..4399cb89 100644 --- a/third_party/blink/renderer/core/script/module_map.cc +++ b/third_party/blink/renderer/core/script/module_map.cc
@@ -22,7 +22,11 @@ USING_GARBAGE_COLLECTED_MIXIN(ModuleMap::Entry); public: - static Entry* Create(ModuleMap* map) { return new Entry(map); } + static Entry* Create(ModuleMap* map) { + return MakeGarbageCollected<Entry>(map); + } + + explicit Entry(ModuleMap*); ~Entry() override {} void Trace(blink::Visitor*) override; @@ -35,8 +39,6 @@ ModuleScript* GetModuleScript() const; private: - explicit Entry(ModuleMap*); - void DispatchFinishedNotificationAsync(SingleModuleClient*); // Implements ModuleScriptLoaderClient
diff --git a/third_party/blink/renderer/core/style/filter_operation.h b/third_party/blink/renderer/core/style/filter_operation.h index 9e0dc81..5ea6f1c7 100644 --- a/third_party/blink/renderer/core/style/filter_operation.h +++ b/third_party/blink/renderer/core/style/filter_operation.h
@@ -290,9 +290,12 @@ class CORE_EXPORT DropShadowFilterOperation : public FilterOperation { public: static DropShadowFilterOperation* Create(const ShadowData& shadow) { - return new DropShadowFilterOperation(shadow); + return MakeGarbageCollected<DropShadowFilterOperation>(shadow); } + DropShadowFilterOperation(const ShadowData& shadow) + : FilterOperation(DROP_SHADOW), shadow_(shadow) {} + const ShadowData& Shadow() const { return shadow_; } bool AffectsOpacity() const override { return true; } @@ -310,9 +313,6 @@ return shadow_ == other->shadow_; } - DropShadowFilterOperation(const ShadowData& shadow) - : FilterOperation(DROP_SHADOW), shadow_(shadow) {} - ShadowData shadow_; };
diff --git a/third_party/blink/renderer/core/style/filter_operations.h b/third_party/blink/renderer/core/style/filter_operations.h index 171c1c8..157ab4e 100644 --- a/third_party/blink/renderer/core/style/filter_operations.h +++ b/third_party/blink/renderer/core/style/filter_operations.h
@@ -86,23 +86,22 @@ : public GarbageCollected<FilterOperationsWrapper> { public: static FilterOperationsWrapper* Create() { - return new FilterOperationsWrapper(); + return MakeGarbageCollected<FilterOperationsWrapper>(); } static FilterOperationsWrapper* Create(const FilterOperations& operations) { - return new FilterOperationsWrapper(operations); + return MakeGarbageCollected<FilterOperationsWrapper>(operations); } + FilterOperationsWrapper() = default; + explicit FilterOperationsWrapper(const FilterOperations& operations) + : operations_(operations) {} + const FilterOperations& Operations() const { return operations_; } void Trace(blink::Visitor* visitor) { visitor->Trace(operations_); } private: - FilterOperationsWrapper() = default; - - explicit FilterOperationsWrapper(const FilterOperations& operations) - : operations_(operations) {} - FilterOperations operations_; };
diff --git a/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc b/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc index 5464eb8..73d1f564 100644 --- a/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc +++ b/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.cc
@@ -69,7 +69,8 @@ Filter* filter, scoped_refptr<Image> image, SVGPreserveAspectRatio* preserve_aspect_ratio) { - return new FEImage(filter, std::move(image), preserve_aspect_ratio); + return MakeGarbageCollected<FEImage>(filter, std::move(image), + preserve_aspect_ratio); } FEImage* FEImage::CreateWithIRIReference( @@ -77,7 +78,8 @@ TreeScope& tree_scope, const String& href, SVGPreserveAspectRatio* preserve_aspect_ratio) { - return new FEImage(filter, tree_scope, href, preserve_aspect_ratio); + return MakeGarbageCollected<FEImage>(filter, tree_scope, href, + preserve_aspect_ratio); } static FloatRect GetLayoutObjectRepaintRect(LayoutObject* layout_object) {
diff --git a/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.h b/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.h index 9628569..7e318ce 100644 --- a/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.h +++ b/third_party/blink/renderer/core/svg/graphics/filters/svg_fe_image.h
@@ -43,6 +43,9 @@ const String&, SVGPreserveAspectRatio*); + FEImage(Filter*, scoped_refptr<Image>, SVGPreserveAspectRatio*); + FEImage(Filter*, TreeScope&, const String&, SVGPreserveAspectRatio*); + // feImage does not perform color interpolation of any kind, so doesn't // depend on the value of color-interpolation-filters. void SetOperatingInterpolationSpace(InterpolationSpace) override {} @@ -54,8 +57,6 @@ private: ~FEImage() override = default; - FEImage(Filter*, scoped_refptr<Image>, SVGPreserveAspectRatio*); - FEImage(Filter*, TreeScope&, const String&, SVGPreserveAspectRatio*); LayoutObject* ReferencedLayoutObject() const; FilterEffectType GetFilterEffectType() const override {
diff --git a/third_party/blink/renderer/core/svg/linear_gradient_attributes.h b/third_party/blink/renderer/core/svg/linear_gradient_attributes.h index 775fffab..a4de407 100644 --- a/third_party/blink/renderer/core/svg/linear_gradient_attributes.h +++ b/third_party/blink/renderer/core/svg/linear_gradient_attributes.h
@@ -95,9 +95,11 @@ : public GarbageCollectedFinalized<LinearGradientAttributesWrapper> { public: static LinearGradientAttributesWrapper* Create() { - return new LinearGradientAttributesWrapper; + return MakeGarbageCollected<LinearGradientAttributesWrapper>(); } + LinearGradientAttributesWrapper() = default; + LinearGradientAttributes& Attributes() { return attributes_; } void Set(const LinearGradientAttributes& attributes) { attributes_ = attributes; @@ -105,8 +107,6 @@ void Trace(blink::Visitor* visitor) { visitor->Trace(attributes_); } private: - LinearGradientAttributesWrapper() = default; - LinearGradientAttributes attributes_; };
diff --git a/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc b/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc index 4fbdf63..f4f4d4b 100644 --- a/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc +++ b/third_party/blink/renderer/core/svg/svg_tree_scope_resources.cc
@@ -21,7 +21,7 @@ return nullptr; auto& entry = resources_.insert(id, nullptr).stored_value->value; if (!entry) - entry = new LocalSVGResource(*tree_scope_, id); + entry = MakeGarbageCollected<LocalSVGResource>(*tree_scope_, id); return entry; }
diff --git a/third_party/blink/renderer/core/testing/core_unit_test_helper.h b/third_party/blink/renderer/core/testing/core_unit_test_helper.h index ced60f5..2cda229 100644 --- a/third_party/blink/renderer/core/testing/core_unit_test_helper.h +++ b/third_party/blink/renderer/core/testing/core_unit_test_helper.h
@@ -52,9 +52,11 @@ class LocalFrameClientWithParent final : public EmptyLocalFrameClient { public: static LocalFrameClientWithParent* Create(LocalFrame* parent) { - return new LocalFrameClientWithParent(parent); + return MakeGarbageCollected<LocalFrameClientWithParent>(parent); } + explicit LocalFrameClientWithParent(LocalFrame* parent) : parent_(parent) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(parent_); EmptyLocalFrameClient::Trace(visitor); @@ -66,8 +68,6 @@ LocalFrame* Top() const override { return parent_.Get(); } private: - explicit LocalFrameClientWithParent(LocalFrame* parent) : parent_(parent) {} - Member<LocalFrame> parent_; };
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 266d350..4105e8f 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
@@ -45,7 +45,7 @@ typedef TraceWrapperMember<DeathAwareScriptWrappable> Wrapper; static DeathAwareScriptWrappable* Create() { - return new DeathAwareScriptWrappable(); + return MakeGarbageCollected<DeathAwareScriptWrappable>(); } static bool HasDied() { return has_died_; } @@ -54,6 +54,7 @@ instance_ = instance; } + DeathAwareScriptWrappable() = default; ~DeathAwareScriptWrappable() override { if (this == instance_) { has_died_ = true; @@ -86,8 +87,6 @@ } private: - DeathAwareScriptWrappable() = default; - Wrapper wrapped_dependency_; HeapVector<Wrapper> wrapped_vector_dependency_; HeapHashMap<Wrapper, Wrapper> wrapped_hash_map_dependency_;
diff --git a/third_party/blink/renderer/core/testing/dictionary_test.h b/third_party/blink/renderer/core/testing/dictionary_test.h index 5b98c79..12e47ef 100644 --- a/third_party/blink/renderer/core/testing/dictionary_test.h +++ b/third_party/blink/renderer/core/testing/dictionary_test.h
@@ -27,7 +27,11 @@ DEFINE_WRAPPERTYPEINFO(); public: - static DictionaryTest* Create() { return new DictionaryTest(); } + static DictionaryTest* Create() { + return MakeGarbageCollected<DictionaryTest>(); + } + + DictionaryTest(); ~DictionaryTest() override; // Stores all members into corresponding fields @@ -51,8 +55,6 @@ void Trace(blink::Visitor*) override; private: - DictionaryTest(); - void Reset(); void GetInternals(InternalDictionary*);
diff --git a/third_party/blink/renderer/core/testing/gc_observation.h b/third_party/blink/renderer/core/testing/gc_observation.h index 1594eec..63454ee 100644 --- a/third_party/blink/renderer/core/testing/gc_observation.h +++ b/third_party/blink/renderer/core/testing/gc_observation.h
@@ -43,9 +43,11 @@ public: static GCObservation* Create(v8::Local<v8::Value> observed_value) { - return new GCObservation(observed_value); + return MakeGarbageCollected<GCObservation>(observed_value); } + explicit GCObservation(v8::Local<v8::Value>); + // Caution: It is only feasible to determine whether an object was // "near death"; it may have been kept alive through a weak // handle. After reaching near-death, having been collected is the @@ -53,8 +55,6 @@ bool wasCollected() const { return observed_.IsEmpty(); } private: - explicit GCObservation(v8::Local<v8::Value>); - ScopedPersistent<v8::Value> observed_; };
diff --git a/third_party/blink/renderer/core/testing/internal_settings.cc b/third_party/blink/renderer/core/testing/internal_settings.cc index 568aa56..d25a98c 100644 --- a/third_party/blink/renderer/core/testing/internal_settings.cc +++ b/third_party/blink/renderer/core/testing/internal_settings.cc
@@ -110,7 +110,7 @@ InternalSettings* InternalSettings::From(Page& page) { InternalSettings* supplement = Supplement<Page>::From<InternalSettings>(page); if (!supplement) { - supplement = new InternalSettings(page); + supplement = MakeGarbageCollected<InternalSettings>(page); ProvideTo(page, supplement); } return supplement;
diff --git a/third_party/blink/renderer/core/testing/internal_settings.h b/third_party/blink/renderer/core/testing/internal_settings.h index a1bef29..84a6b17 100644 --- a/third_party/blink/renderer/core/testing/internal_settings.h +++ b/third_party/blink/renderer/core/testing/internal_settings.h
@@ -76,11 +76,13 @@ }; static InternalSettings* Create(Page& page) { - return new InternalSettings(page); + return MakeGarbageCollected<InternalSettings>(page); } static InternalSettings* From(Page&); + explicit InternalSettings(Page&); ~InternalSettings() override; + void ResetToConsistentState(); void setStandardFontFamily(const AtomicString& family, @@ -145,8 +147,6 @@ void SetPreloadLogging(bool, ExceptionState&); private: - explicit InternalSettings(Page&); - Settings* GetSettings() const; Page* GetPage() const { return GetSupplementable(); }
diff --git a/third_party/blink/renderer/core/testing/internals.h b/third_party/blink/renderer/core/testing/internals.h index 090fb67..67f9564 100644 --- a/third_party/blink/renderer/core/testing/internals.h +++ b/third_party/blink/renderer/core/testing/internals.h
@@ -89,11 +89,13 @@ public: static Internals* Create(ExecutionContext* context) { - return new Internals(context); + return MakeGarbageCollected<Internals>(context); } static void ResetToConsistentState(Page*); + explicit Internals(ExecutionContext*); + String elementLayoutTreeAsText(Element*, ExceptionState&); GCObservation* observeGC(ScriptValue); @@ -596,7 +598,6 @@ void addEmbedderCustomElementName(const AtomicString& name, ExceptionState&); private: - explicit Internals(ExecutionContext*); Document* ContextDocument() const; LocalFrame* GetFrame() const; Vector<String> IconURLs(Document*, int icon_types_mask) const;
diff --git a/third_party/blink/renderer/core/testing/layer_rect.h b/third_party/blink/renderer/core/testing/layer_rect.h index e112ccf7..528f3c8 100644 --- a/third_party/blink/renderer/core/testing/layer_rect.h +++ b/third_party/blink/renderer/core/testing/layer_rect.h
@@ -48,9 +48,21 @@ int node_offset_x, int node_offset_y, DOMRectReadOnly* rect) { - return new LayerRect(node, layer_type, node_offset_x, node_offset_y, rect); + return MakeGarbageCollected<LayerRect>(node, layer_type, node_offset_x, + node_offset_y, rect); } + LayerRect(Node* node, + const String& layer_name, + int node_offset_x, + int node_offset_y, + DOMRectReadOnly* rect) + : layer_associated_node_(node), + layer_type_(layer_name), + associated_node_offset_x_(node_offset_x), + associated_node_offset_y_(node_offset_y), + rect_(rect) {} + Node* layerAssociatedNode() const { return layer_associated_node_.Get(); } String layerType() const { return layer_type_; } int associatedNodeOffsetX() const { return associated_node_offset_x_; } @@ -64,17 +76,6 @@ } private: - LayerRect(Node* node, - const String& layer_name, - int node_offset_x, - int node_offset_y, - DOMRectReadOnly* rect) - : layer_associated_node_(node), - layer_type_(layer_name), - associated_node_offset_x_(node_offset_x), - associated_node_offset_y_(node_offset_y), - rect_(rect) {} - Member<Node> layer_associated_node_; String layer_type_; int associated_node_offset_x_;
diff --git a/third_party/blink/renderer/core/testing/layer_rect_list.h b/third_party/blink/renderer/core/testing/layer_rect_list.h index 3625a7e..6b23e16 100644 --- a/third_party/blink/renderer/core/testing/layer_rect_list.h +++ b/third_party/blink/renderer/core/testing/layer_rect_list.h
@@ -46,7 +46,11 @@ DEFINE_WRAPPERTYPEINFO(); public: - static LayerRectList* Create() { return new LayerRectList; } + static LayerRectList* Create() { + return MakeGarbageCollected<LayerRectList>(); + } + + LayerRectList(); unsigned length() const; LayerRect* item(unsigned index); @@ -59,8 +63,6 @@ void Trace(blink::Visitor*) override; private: - LayerRectList(); - HeapVector<Member<LayerRect>> list_; };
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker.cc b/third_party/blink/renderer/core/workers/dedicated_worker.cc index d3ae9a1..91ef9334 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker.cc
@@ -89,8 +89,8 @@ if (context->IsWorkerGlobalScope()) UseCounter::Count(context, WebFeature::kNestedDedicatedWorker); - DedicatedWorker* worker = - new DedicatedWorker(context, script_request_url, options); + DedicatedWorker* worker = MakeGarbageCollected<DedicatedWorker>( + context, script_request_url, options); worker->Start(); return worker; } @@ -101,7 +101,8 @@ : AbstractWorker(context), script_request_url_(script_request_url), options_(options), - context_proxy_(new DedicatedWorkerMessagingProxy(context, this)) { + context_proxy_( + MakeGarbageCollected<DedicatedWorkerMessagingProxy>(context, this)) { DCHECK(context->IsContextThread()); DCHECK(script_request_url_.IsValid()); DCHECK(context_proxy_);
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker.h b/third_party/blink/renderer/core/workers/dedicated_worker.h index 23dbf3fd..0a34cea4 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker.h +++ b/third_party/blink/renderer/core/workers/dedicated_worker.h
@@ -53,6 +53,9 @@ const WorkerOptions*, ExceptionState&); + DedicatedWorker(ExecutionContext*, + const KURL& script_request_url, + const WorkerOptions*); ~DedicatedWorker() override; void postMessage(ScriptState*, @@ -81,10 +84,6 @@ void Trace(blink::Visitor*) override; private: - DedicatedWorker(ExecutionContext*, - const KURL& script_request_url, - const WorkerOptions*); - // Starts the worker. void Start();
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_test.cc b/third_party/blink/renderer/core/workers/dedicated_worker_test.cc index 75bf375c..1c11ac7 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_test.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_test.cc
@@ -41,7 +41,7 @@ WorkerOrWorkletGlobalScope* CreateWorkerGlobalScope( std::unique_ptr<GlobalScopeCreationParams> creation_params) override { - auto* global_scope = new DedicatedWorkerGlobalScope( + auto* global_scope = MakeGarbageCollected<DedicatedWorkerGlobalScope>( "fake worker name", std::move(creation_params), this, time_origin_); // Initializing a global scope with a dummy creation params may emit warning // messages (e.g., invalid CSP directives). Clear them here for tests that @@ -175,7 +175,8 @@ void SetUp() override { PageTestBase::SetUp(IntSize()); worker_messaging_proxy_ = - new DedicatedWorkerMessagingProxyForTest(&GetDocument()); + MakeGarbageCollected<DedicatedWorkerMessagingProxyForTest>( + &GetDocument()); } void TearDown() override {
diff --git a/third_party/blink/renderer/core/workers/dedicated_worker_thread.cc b/third_party/blink/renderer/core/workers/dedicated_worker_thread.cc index fb037ae..273c6da1 100644 --- a/third_party/blink/renderer/core/workers/dedicated_worker_thread.cc +++ b/third_party/blink/renderer/core/workers/dedicated_worker_thread.cc
@@ -77,8 +77,8 @@ WorkerOrWorkletGlobalScope* DedicatedWorkerThread::CreateWorkerGlobalScope( std::unique_ptr<GlobalScopeCreationParams> creation_params) { - return new DedicatedWorkerGlobalScope(name_, std::move(creation_params), this, - time_origin_); + return MakeGarbageCollected<DedicatedWorkerGlobalScope>( + name_, std::move(creation_params), this, time_origin_); } } // namespace blink
diff --git a/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc b/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc index ae9450b0..3a70d19a 100644 --- a/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc +++ b/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc
@@ -36,7 +36,8 @@ auto* global_scope = To<WorkletGlobalScope>(worker_thread->GlobalScope()); global_scope->FetchAndInvokeScript( module_url_record, credentials_mode, - new FetchClientSettingsObjectSnapshot(std::move(outside_settings_object)), + MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + std::move(outside_settings_object)), std::move(outside_settings_task_runner), pending_tasks); }
diff --git a/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc b/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.cc index 9d81f12..7a179131 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
@@ -120,8 +120,8 @@ DCHECK(IsContextThread()); if (inside_settings_resource_fetcher_) return inside_settings_resource_fetcher_; - inside_settings_resource_fetcher_ = - CreateFetcherInternal(new FetchClientSettingsObjectImpl(*this)); + inside_settings_resource_fetcher_ = CreateFetcherInternal( + MakeGarbageCollected<FetchClientSettingsObjectImpl>(*this)); return inside_settings_resource_fetcher_; }
diff --git a/third_party/blink/renderer/core/workers/worker_thread.cc b/third_party/blink/renderer/core/workers/worker_thread.cc index 0be0583b..dfe382c 100644 --- a/third_party/blink/renderer/core/workers/worker_thread.cc +++ b/third_party/blink/renderer/core/workers/worker_thread.cc
@@ -510,10 +510,11 @@ outside_settings_object, const v8_inspector::V8StackTraceId& stack_id) { To<WorkerGlobalScope>(GlobalScope()) - ->ImportClassicScriptPausable(script_url, - new FetchClientSettingsObjectSnapshot( - std::move(outside_settings_object)), - stack_id); + ->ImportClassicScriptPausable( + script_url, + MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + std::move(outside_settings_object)), + stack_id); } void WorkerThread::ImportModuleScriptOnWorkerThread( @@ -525,10 +526,11 @@ // TODO(nhiroki): Consider excluding this code path from WorkerThread like // Worklets. To<WorkerGlobalScope>(GlobalScope()) - ->ImportModuleScriptPausable(script_url, - new FetchClientSettingsObjectSnapshot( - std::move(outside_settings_object)), - credentials_mode); + ->ImportModuleScriptPausable( + script_url, + MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + std::move(outside_settings_object)), + credentials_mode); } void WorkerThread::PrepareForShutdownOnWorkerThread() {
diff --git a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h index 043edbb..3fca021e 100644 --- a/third_party/blink/renderer/core/workers/worker_thread_test_helper.h +++ b/third_party/blink/renderer/core/workers/worker_thread_test_helper.h
@@ -119,7 +119,8 @@ protected: WorkerOrWorkletGlobalScope* CreateWorkerGlobalScope( std::unique_ptr<GlobalScopeCreationParams> creation_params) override { - return new FakeWorkerGlobalScope(std::move(creation_params), this); + return MakeGarbageCollected<FakeWorkerGlobalScope>( + std::move(creation_params), this); } private:
diff --git a/third_party/blink/renderer/devtools/front_end/Runtime.js b/third_party/blink/renderer/devtools/front_end/Runtime.js index 11093b8..46698e7 100644 --- a/third_party/blink/renderer/devtools/front_end/Runtime.js +++ b/third_party/blink/renderer/devtools/front_end/Runtime.js
@@ -66,8 +66,6 @@ for (let i = 0; i < descriptors.length; ++i) this._registerModule(descriptors[i]); - - Runtime._runtimeReadyPromiseCallback(); } /** @@ -237,8 +235,8 @@ /** * @return {!Promise} */ - static async runtimeReady() { - return Runtime._runtimeReadyPromise; + static async appStarted() { + return Runtime._appStartedPromise; } /** @@ -289,7 +287,8 @@ } self.runtime = new Runtime(moduleDescriptors); if (coreModuleNames) - return /** @type {!Promise<undefined>} */ (self.runtime._loadAutoStartModules(coreModuleNames)); + await self.runtime._loadAutoStartModules(coreModuleNames); + Runtime._appStartedPromiseCallback(); } /** @@ -1069,8 +1068,8 @@ Runtime.experiments = new Runtime.ExperimentsSupport(); /** @type {Function} */ -Runtime._runtimeReadyPromiseCallback; -Runtime._runtimeReadyPromise = new Promise(fulfil => Runtime._runtimeReadyPromiseCallback = fulfil); +Runtime._appStartedPromiseCallback; +Runtime._appStartedPromise = new Promise(fulfil => Runtime._appStartedPromiseCallback = fulfil); /** * @type {?string} */
diff --git a/third_party/blink/renderer/devtools/front_end/main/Main.js b/third_party/blink/renderer/devtools/front_end/main/Main.js index 297b32b..646164f 100644 --- a/third_party/blink/renderer/devtools/front_end/main/Main.js +++ b/third_party/blink/renderer/devtools/front_end/main/Main.js
@@ -60,7 +60,7 @@ async _loaded() { console.timeStamp('Main._loaded'); - await Runtime.runtimeReady(); + await Runtime.appStarted(); Runtime.setPlatform(Host.platform()); InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); }
diff --git a/third_party/blink/renderer/devtools/front_end/network/NetworkItemView.js b/third_party/blink/renderer/devtools/front_end/network/NetworkItemView.js index 37dd4d4..fce1e91 100644 --- a/third_party/blink/renderer/devtools/front_end/network/NetworkItemView.js +++ b/third_party/blink/renderer/devtools/front_end/network/NetworkItemView.js
@@ -40,13 +40,17 @@ this._resourceViewTabSetting = Common.settings.createSetting('resourceViewTab', 'preview'); this._headersView = new Network.RequestHeadersView(request); - this.appendTab(Network.NetworkItemView.Tabs.Headers, Common.UIString('Headers'), this._headersView); + this.appendTab( + Network.NetworkItemView.Tabs.Headers, Common.UIString('Headers'), this._headersView, + Common.UIString('Headers and request body')); this.addEventListener(UI.TabbedPane.Events.TabSelected, this._tabSelected, this); if (request.resourceType() === Common.resourceTypes.WebSocket) { const frameView = new Network.ResourceWebSocketFrameView(request); - this.appendTab(Network.NetworkItemView.Tabs.WsFrames, Common.UIString('Frames'), frameView); + this.appendTab( + Network.NetworkItemView.Tabs.WsFrames, Common.UIString('Frames'), frameView, + Common.UIString('WebSocket frames')); } else if (request.mimeType === 'text/event-stream') { this.appendTab( Network.NetworkItemView.Tabs.EventSource, Common.UIString('EventStream'), @@ -54,24 +58,30 @@ } else { this._responseView = new Network.RequestResponseView(request); const previewView = new Network.RequestPreviewView(request); - this.appendTab(Network.NetworkItemView.Tabs.Preview, Common.UIString('Preview'), previewView); + this.appendTab( + Network.NetworkItemView.Tabs.Preview, Common.UIString('Preview'), previewView, + Common.UIString('Response preview')); if (request.signedExchangeInfo() && request.signedExchangeInfo().errors && request.signedExchangeInfo().errors.length) { const icon = UI.Icon.create('smallicon-error'); icon.title = Common.UIString('SignedExchange error'); this.setTabIcon(Network.NetworkItemView.Tabs.Preview, icon); } - this.appendTab(Network.NetworkItemView.Tabs.Response, Common.UIString('Response'), this._responseView); + this.appendTab( + Network.NetworkItemView.Tabs.Response, Common.UIString('Response'), this._responseView, + Common.UIString('Raw response data')); } if (request.requestCookies || request.responseCookies) { this._cookiesView = new Network.RequestCookiesView(request); - this.appendTab(Network.NetworkItemView.Tabs.Cookies, Common.UIString('Cookies'), this._cookiesView); + this.appendTab( + Network.NetworkItemView.Tabs.Cookies, Common.UIString('Cookies'), this._cookiesView, + Common.UIString('Request and response cookies')); } this.appendTab( Network.NetworkItemView.Tabs.Timing, Common.UIString('Timing'), - new Network.RequestTimingView(request, calculator)); + new Network.RequestTimingView(request, calculator), Common.UIString('Request and response timeline')); this._request = request; }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object.cc b/third_party/blink/renderer/modules/accessibility/ax_object.cc index ec95e60..ea9a758 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object.cc
@@ -440,16 +440,17 @@ static Vector<AtomicString>* CreateRoleNameVector() { Vector<AtomicString>* role_name_vector = new Vector<AtomicString>(base::size(kInternalRoles)); - for (size_t i = 0; i < base::size(kInternalRoles); i++) + for (wtf_size_t i = 0; i < base::size(kInternalRoles); i++) (*role_name_vector)[i] = g_null_atom; - for (size_t i = 0; i < base::size(kRoles); ++i) { - (*role_name_vector)[static_cast<size_t>(kRoles[i].webcore_role)] = + for (wtf_size_t i = 0; i < base::size(kRoles); ++i) { + (*role_name_vector)[static_cast<wtf_size_t>(kRoles[i].webcore_role)] = AtomicString(kRoles[i].aria_role); } - for (size_t i = 0; i < base::size(kReverseRoles); ++i) { - (*role_name_vector)[static_cast<size_t>(kReverseRoles[i].webcore_role)] = + for (wtf_size_t i = 0; i < base::size(kReverseRoles); ++i) { + (*role_name_vector)[static_cast<wtf_size_t>( + kReverseRoles[i].webcore_role)] = AtomicString(kReverseRoles[i].aria_role); } @@ -459,8 +460,8 @@ static Vector<AtomicString>* CreateInternalRoleNameVector() { Vector<AtomicString>* internal_role_name_vector = new Vector<AtomicString>(base::size(kInternalRoles)); - for (size_t i = 0; i < base::size(kInternalRoles); i++) { - (*internal_role_name_vector)[static_cast<size_t>( + for (wtf_size_t i = 0; i < base::size(kInternalRoles); i++) { + (*internal_role_name_vector)[static_cast<wtf_size_t>( kInternalRoles[i].webcore_role)] = AtomicString(kInternalRoles[i].internal_role_name); } @@ -1907,7 +1908,7 @@ return 0; const AXObjectVector& siblings = ParentObjectUnignored()->Children(); - size_t index = siblings.Find(this); + wtf_size_t index = siblings.Find(this); return (index == kNotFound) ? 0 : static_cast<int>(index); } @@ -3464,7 +3465,7 @@ const AtomicString& AXObject::RoleName(ax::mojom::Role role) { static const Vector<AtomicString>* role_name_vector = CreateRoleNameVector(); - return role_name_vector->at(static_cast<size_t>(role)); + return role_name_vector->at(static_cast<wtf_size_t>(role)); } // static @@ -3472,7 +3473,7 @@ static const Vector<AtomicString>* internal_role_name_vector = CreateInternalRoleNameVector(); - return internal_role_name_vector->at(static_cast<size_t>(role)); + return internal_role_name_vector->at(static_cast<wtf_size_t>(role)); } // static
diff --git a/third_party/blink/renderer/modules/accessibility/ax_position.cc b/third_party/blink/renderer/modules/accessibility/ax_position.cc index da54330..c3d9cafb 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_position.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_position.cc
@@ -348,6 +348,15 @@ return TextIterator::RangeLength(first_position, last_position); } +TextAffinity AXPosition::Affinity() const { + if (!IsTextPosition()) { + NOTREACHED() << *this << " should be a text position."; + return TextAffinity::kDownstream; + } + + return affinity_; +} + bool AXPosition::IsValid() const { if (!container_object_ || container_object_->IsDetached()) return false;
diff --git a/third_party/blink/renderer/modules/accessibility/ax_position.h b/third_party/blink/renderer/modules/accessibility/ax_position.h index 4cd52f8..d1861e2 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_position.h +++ b/third_party/blink/renderer/modules/accessibility/ax_position.h
@@ -109,7 +109,8 @@ // When the same character offset could correspond to two possible caret // positions, upstream means it's on the previous line rather than the next // line. - TextAffinity Affinity() const { return affinity_; } + // Only valid for text positions. + TextAffinity Affinity() const; // Verifies if the anchor is present and if it's set to a live object with a // connected node.
diff --git a/third_party/blink/renderer/modules/accessibility/ax_selection.cc b/third_party/blink/renderer/modules/accessibility/ax_selection.cc index dded6016..6ceee25 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_selection.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_selection.cc
@@ -4,7 +4,7 @@ #include "third_party/blink/renderer/modules/accessibility/ax_selection.h" -#include "third_party/blink/renderer/core/dom/document.h" +#include "third_party/blink/renderer/core/dom/range.h" #include "third_party/blink/renderer/core/editing/frame_selection.h" #include "third_party/blink/renderer/core/editing/position_with_affinity.h" #include "third_party/blink/renderer/core/editing/selection_template.h" @@ -15,6 +15,10 @@ namespace blink { +// +// AXSelection::Builder +// + AXSelection::Builder& AXSelection::Builder::SetBase(const AXPosition& base) { DCHECK(base.IsValid()); selection_.base_ = base; @@ -71,8 +75,41 @@ return selection_; } +// +// AXSelection +// + // static -const AXSelection AXSelection::FromSelection( +void AXSelection::ClearCurrentSelection(const Document& document) { + LocalFrame* frame = document.GetFrame(); + if (!frame) + return; + + FrameSelection& frame_selection = frame->Selection(); + if (!frame_selection.IsAvailable()) + return; + + frame_selection.Clear(); +} + +// static +AXSelection AXSelection::FromCurrentSelection( + const Document& document, + const AXSelectionBehavior selection_behavior) { + LocalFrame* frame = document.GetFrame(); + if (!frame) + return {}; + + FrameSelection& frame_selection = frame->Selection(); + if (!frame_selection.IsAvailable()) + return {}; + + return FromSelection(frame_selection.GetSelectionInDOMTree(), + selection_behavior); +} + +// static +AXSelection AXSelection::FromSelection( const SelectionInDOMTree& selection, const AXSelectionBehavior selection_behavior) { if (selection.IsNone()) @@ -181,7 +218,8 @@ SelectionInDOMTree::Builder selection_builder; selection_builder.SetBaseAndExtent(dom_base.GetPosition(), dom_extent.GetPosition()); - selection_builder.SetAffinity(extent_.Affinity()); + if (extent_.IsTextPosition()) + selection_builder.SetAffinity(extent_.Affinity()); return selection_builder.Build(); } @@ -198,13 +236,51 @@ NOTREACHED(); return; } + LocalFrame* frame = document->GetFrame(); if (!frame) { NOTREACHED(); return; } + FrameSelection& frame_selection = frame->Selection(); - frame_selection.SetSelection(selection, SetSelectionOptions()); + if (!frame_selection.IsAvailable()) + return; + + SetSelectionOptions::Builder options_builder; + options_builder.SetIsDirectional(true) + .SetShouldCloseTyping(true) + .SetShouldClearTypingStyle(true); + frame_selection.ClearDocumentCachedRange(); + frame_selection.SetSelection(selection, options_builder.Build()); + + // Cache the newly created document range. This doesn't affect the already + // applied selection. Note that DOM's |Range| object has a start and an end + // container that need to be in DOM order. See the DOM specification for more + // information: https://dom.spec.whatwg.org/#interface-range + Range* range = Range::Create(*document); + if (selection.Extent().IsNull()) { + DCHECK(selection.Base().IsNotNull()) + << "AX selections converted to DOM selections should have at least one " + "endpoint non-null.\n" + << *this << '\n' + << selection; + range->setStart(selection.Base().ComputeContainerNode(), + selection.Base().ComputeOffsetInContainerNode()); + range->setEnd(selection.Base().ComputeContainerNode(), + selection.Base().ComputeOffsetInContainerNode()); + } else if (selection.Base() < selection.Extent()) { + range->setStart(selection.Base().ComputeContainerNode(), + selection.Base().ComputeOffsetInContainerNode()); + range->setEnd(selection.Extent().ComputeContainerNode(), + selection.Extent().ComputeOffsetInContainerNode()); + } else { + range->setStart(selection.Extent().ComputeContainerNode(), + selection.Extent().ComputeOffsetInContainerNode()); + range->setEnd(selection.Base().ComputeContainerNode(), + selection.Base().ComputeOffsetInContainerNode()); + } + frame_selection.CacheRangeOfDocument(range); } String AXSelection::ToString() const {
diff --git a/third_party/blink/renderer/modules/accessibility/ax_selection.h b/third_party/blink/renderer/modules/accessibility/ax_selection.h index dcf65a4..482ef25 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_selection.h +++ b/third_party/blink/renderer/modules/accessibility/ax_selection.h
@@ -10,6 +10,7 @@ #include <ostream> #include <base/logging.h> +#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/editing/forward.h" #include "third_party/blink/renderer/modules/accessibility/ax_position.h" #include "third_party/blink/renderer/modules/modules_export.h" @@ -38,7 +39,13 @@ public: class Builder; - static const AXSelection FromSelection( + static void ClearCurrentSelection(const Document&); + + static AXSelection FromCurrentSelection( + const Document&, + const AXSelectionBehavior = AXSelectionBehavior::kExtendToValidDOMRange); + + static AXSelection FromSelection( const SelectionInDOMTree&, const AXSelectionBehavior = AXSelectionBehavior::kExtendToValidDOMRange);
diff --git a/third_party/blink/renderer/modules/animationworklet/worklet_animation.cc b/third_party/blink/renderer/modules/animationworklet/worklet_animation.cc index 068e502f..e623bcb1 100644 --- a/third_party/blink/renderer/modules/animationworklet/worklet_animation.cc +++ b/third_party/blink/renderer/modules/animationworklet/worklet_animation.cc
@@ -438,7 +438,7 @@ return; DCHECK_EQ(effects_.size(), local_times_.size()); - for (size_t i = 0; i < effects_.size(); ++i) { + for (wtf_size_t i = 0; i < effects_.size(); ++i) { effects_[i]->UpdateInheritedTime( local_times_[i] ? local_times_[i]->InSecondsF() : NullValue(), reason); } @@ -667,7 +667,7 @@ // peeking state.local_times will be empty. DCHECK(local_times_.size() == state.local_times.size() || !running_on_main_thread_); - for (size_t i = 0; i < state.local_times.size(); ++i) + for (wtf_size_t i = 0; i < state.local_times.size(); ++i) local_times_[i] = state.local_times[i]; }
diff --git a/third_party/blink/renderer/modules/animationworklet/worklet_group_effect_proxy.cc b/third_party/blink/renderer/modules/animationworklet/worklet_group_effect_proxy.cc index eeb27d8..65b1e04 100644 --- a/third_party/blink/renderer/modules/animationworklet/worklet_group_effect_proxy.cc +++ b/third_party/blink/renderer/modules/animationworklet/worklet_group_effect_proxy.cc
@@ -9,7 +9,7 @@ WorkletGroupEffectProxy::WorkletGroupEffectProxy(int num_effects) : effects_(num_effects) { for (int i = 0; i < num_effects; ++i) - effects_[i] = new EffectProxy(); + effects_[i] = MakeGarbageCollected<EffectProxy>(); } void WorkletGroupEffectProxy::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_record.cc b/third_party/blink/renderer/modules/background_fetch/background_fetch_record.cc index 3f6ce68..7f28106 100644 --- a/third_party/blink/renderer/modules/background_fetch/background_fetch_record.cc +++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_record.cc
@@ -14,6 +14,9 @@ : request_(request), script_state_(script_state) { DCHECK(request_); DCHECK(script_state_); + response_ready_property_ = + new ResponseReadyProperty(ExecutionContext::From(script_state), this, + ResponseReadyProperty::kResponseReady); } BackgroundFetchRecord::~BackgroundFetchRecord() = default; @@ -54,14 +57,6 @@ } ScriptPromise BackgroundFetchRecord::responseReady(ScriptState* script_state) { - if (!response_ready_property_) { - response_ready_property_ = - new ResponseReadyProperty(ExecutionContext::From(script_state), this, - ResponseReadyProperty::kResponseReady); - } - - ResolveResponseReadyProperty(); - return response_ready_property_->Promise(script_state->World()); }
diff --git a/third_party/blink/renderer/modules/cache_storage/cache_test.cc b/third_party/blink/renderer/modules/cache_storage/cache_test.cc index fb5cc6f..349032c 100644 --- a/third_party/blink/renderer/modules/cache_storage/cache_test.cc +++ b/third_party/blink/renderer/modules/cache_storage/cache_test.cc
@@ -767,7 +767,8 @@ Request* request = NewRequestFromUrl(url); Response* response = Response::Create( GetScriptState(), - new BodyStreamBuffer(GetScriptState(), new FormDataBytesConsumer(content), + new BodyStreamBuffer(GetScriptState(), + MakeGarbageCollected<FormDataBytesConsumer>(content), nullptr), content_type, ResponseInit::Create(), exception_state); fetcher->SetResponse(response);
diff --git a/third_party/blink/renderer/modules/canvas/canvas2d/hit_region.h b/third_party/blink/renderer/modules/canvas/canvas2d/hit_region.h index 06264a4d0..5ee1df4c 100644 --- a/third_party/blink/renderer/modules/canvas/canvas2d/hit_region.h +++ b/third_party/blink/renderer/modules/canvas/canvas2d/hit_region.h
@@ -17,9 +17,10 @@ class HitRegion final : public GarbageCollectedFinalized<HitRegion> { public: static HitRegion* Create(const Path& path, const HitRegionOptions* options) { - return new HitRegion(path, options); + return MakeGarbageCollected<HitRegion>(path, options); } + HitRegion(const Path&, const HitRegionOptions*); virtual ~HitRegion() = default; void RemovePixels(const Path&); @@ -33,8 +34,6 @@ void Trace(blink::Visitor*); private: - HitRegion(const Path&, const HitRegionOptions*); - String id_; Member<Element> control_; Path path_; @@ -45,7 +44,11 @@ WTF_MAKE_NONCOPYABLE(HitRegionManager); public: - static HitRegionManager* Create() { return new HitRegionManager; } + static HitRegionManager* Create() { + return MakeGarbageCollected<HitRegionManager>(); + } + + HitRegionManager() = default; void AddHitRegion(HitRegion*); @@ -64,8 +67,6 @@ void Trace(blink::Visitor*); private: - HitRegionManager() = default; - typedef HeapListHashSet<Member<HitRegion>> HitRegionList; typedef HitRegionList::const_reverse_iterator HitRegionIterator; typedef HeapHashMap<String, Member<HitRegion>> HitRegionIdMap;
diff --git a/third_party/blink/renderer/modules/cookie_store/extendable_cookie_change_event.h b/third_party/blink/renderer/modules/cookie_store/extendable_cookie_change_event.h index 2e028bff..2fe4733 100644 --- a/third_party/blink/renderer/modules/cookie_store/extendable_cookie_change_event.h +++ b/third_party/blink/renderer/modules/cookie_store/extendable_cookie_change_event.h
@@ -30,7 +30,7 @@ HeapVector<Member<CookieListItem>> changed, HeapVector<Member<CookieListItem>> deleted, WaitUntilObserver* wait_until_observer) { - return new ExtendableCookieChangeEvent( + return MakeGarbageCollected<ExtendableCookieChangeEvent>( type, std::move(changed), std::move(deleted), wait_until_observer); } @@ -38,9 +38,16 @@ static ExtendableCookieChangeEvent* Create( const AtomicString& type, const ExtendableCookieChangeEventInit* initializer) { - return new ExtendableCookieChangeEvent(type, initializer); + return MakeGarbageCollected<ExtendableCookieChangeEvent>(type, initializer); } + ExtendableCookieChangeEvent(const AtomicString& type, + HeapVector<Member<CookieListItem>> changed, + HeapVector<Member<CookieListItem>> deleted, + WaitUntilObserver*); + ExtendableCookieChangeEvent( + const AtomicString& type, + const ExtendableCookieChangeEventInit* initializer); ~ExtendableCookieChangeEvent() override; const HeapVector<Member<CookieListItem>>& changed() const { return changed_; } @@ -53,13 +60,6 @@ void Trace(blink::Visitor*) override; private: - ExtendableCookieChangeEvent(const AtomicString& type, - HeapVector<Member<CookieListItem>> changed, - HeapVector<Member<CookieListItem>> deleted, - WaitUntilObserver*); - ExtendableCookieChangeEvent( - const AtomicString& type, - const ExtendableCookieChangeEventInit* initializer); HeapVector<Member<CookieListItem>> changed_; HeapVector<Member<CookieListItem>> deleted_;
diff --git a/third_party/blink/renderer/modules/cookie_store/global_cookie_store_impl.h b/third_party/blink/renderer/modules/cookie_store/global_cookie_store_impl.h index fa8c46e..ec85f11 100644 --- a/third_party/blink/renderer/modules/cookie_store/global_cookie_store_impl.h +++ b/third_party/blink/renderer/modules/cookie_store/global_cookie_store_impl.h
@@ -27,12 +27,15 @@ GlobalCookieStoreImpl* supplement = Supplement<T>::template From<GlobalCookieStoreImpl>(supplementable); if (!supplement) { - supplement = new GlobalCookieStoreImpl(supplementable); + supplement = MakeGarbageCollected<GlobalCookieStoreImpl>(supplementable); Supplement<T>::ProvideTo(supplementable, supplement); } return *supplement; } + explicit GlobalCookieStoreImpl(T& supplementable) + : Supplement<T>(supplementable) {} + CookieStore* GetCookieStore(T& scope) { if (!cookie_store_) { ExecutionContext* execution_context = scope.GetExecutionContext(); @@ -55,9 +58,6 @@ } private: - explicit GlobalCookieStoreImpl(T& supplementable) - : Supplement<T>(supplementable) {} - Member<CookieStore> cookie_store_; };
diff --git a/third_party/blink/renderer/modules/credentialmanager/federated_credential.cc b/third_party/blink/renderer/modules/credentialmanager/federated_credential.cc index 3477285..f6443fa 100644 --- a/third_party/blink/renderer/modules/credentialmanager/federated_credential.cc +++ b/third_party/blink/renderer/modules/credentialmanager/federated_credential.cc
@@ -28,7 +28,7 @@ if (exception_state.HadException()) return nullptr; - return new FederatedCredential( + return MakeGarbageCollected<FederatedCredential>( data->id(), SecurityOrigin::Create(provider_url), data->name(), icon_url); } @@ -37,7 +37,8 @@ scoped_refptr<const SecurityOrigin> provider, const String& name, const KURL& icon_url) { - return new FederatedCredential(id, provider, name, icon_url); + return MakeGarbageCollected<FederatedCredential>(id, provider, name, + icon_url); } FederatedCredential::FederatedCredential(
diff --git a/third_party/blink/renderer/modules/credentialmanager/federated_credential.h b/third_party/blink/renderer/modules/credentialmanager/federated_credential.h index 80a2908..9ef5820db 100644 --- a/third_party/blink/renderer/modules/credentialmanager/federated_credential.h +++ b/third_party/blink/renderer/modules/credentialmanager/federated_credential.h
@@ -28,6 +28,11 @@ const String& name, const KURL& icon_url); + FederatedCredential(const String& id, + scoped_refptr<const SecurityOrigin> provider, + const String& name, + const KURL& icon_url); + scoped_refptr<const SecurityOrigin> GetProviderAsOrigin() const { return provider_; } @@ -49,11 +54,6 @@ } private: - FederatedCredential(const String& id, - scoped_refptr<const SecurityOrigin> provider, - const String& name, - const KURL& icon_url); - const scoped_refptr<const SecurityOrigin> provider_; const String name_; const KURL icon_url_;
diff --git a/third_party/blink/renderer/modules/device_orientation/device_acceleration.cc b/third_party/blink/renderer/modules/device_orientation/device_acceleration.cc index d92dd7c..8d66a6deb6c 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_acceleration.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_acceleration.cc
@@ -29,7 +29,7 @@ namespace blink { DeviceAcceleration* DeviceAcceleration::Create(double x, double y, double z) { - return new DeviceAcceleration(x, y, z); + return MakeGarbageCollected<DeviceAcceleration>(x, y, z); } DeviceAcceleration* DeviceAcceleration::Create(
diff --git a/third_party/blink/renderer/modules/device_orientation/device_acceleration.h b/third_party/blink/renderer/modules/device_orientation/device_acceleration.h index 7f99a82d..e24568a0 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_acceleration.h +++ b/third_party/blink/renderer/modules/device_orientation/device_acceleration.h
@@ -42,6 +42,8 @@ static DeviceAcceleration* Create(double x, double y, double z); static DeviceAcceleration* Create(const DeviceAccelerationInit*); + DeviceAcceleration(double x, double y, double z); + bool HasAccelerationData() const; double x(bool& is_null) const; @@ -49,8 +51,6 @@ double z(bool& is_null) const; private: - DeviceAcceleration(double x, double y, double z); - const double x_; const double y_; const double z_;
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc b/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc index 27902416..02db4eb 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_controller.cc
@@ -30,7 +30,7 @@ DeviceMotionController* controller = Supplement<Document>::From<DeviceMotionController>(document); if (!controller) { - controller = new DeviceMotionController(document); + controller = MakeGarbageCollected<DeviceMotionController>(document); ProvideTo(document, controller); } return *controller; @@ -90,7 +90,8 @@ return; scoped_refptr<base::SingleThreadTaskRunner> task_runner = frame->GetTaskRunner(TaskType::kSensor); - motion_event_pump_ = new DeviceMotionEventPump(task_runner); + motion_event_pump_ = + MakeGarbageCollected<DeviceMotionEventPump>(task_runner); } motion_event_pump_->SetController(this); }
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_controller.h b/third_party/blink/renderer/modules/device_orientation/device_motion_controller.h index e8b62cca1e..003d47e3 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_controller.h +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_controller.h
@@ -22,6 +22,7 @@ public: static const char kSupplementName[]; + explicit DeviceMotionController(Document&); ~DeviceMotionController() override; static DeviceMotionController& From(Document&); @@ -33,8 +34,6 @@ void Trace(blink::Visitor*) override; private: - explicit DeviceMotionController(Document&); - // Inherited from PlatformEventController. void RegisterWithDispatcher() override; void UnregisterWithDispatcher() override;
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_data.cc b/third_party/blink/renderer/modules/device_orientation/device_motion_data.cc index 07a0a8e..b44ce0f 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_data.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_data.cc
@@ -37,8 +37,8 @@ DeviceAcceleration* acceleration_including_gravity, DeviceRotationRate* rotation_rate, double interval) { - return new DeviceMotionData(acceleration, acceleration_including_gravity, - rotation_rate, interval); + return MakeGarbageCollected<DeviceMotionData>( + acceleration, acceleration_including_gravity, rotation_rate, interval); } DeviceMotionData* DeviceMotionData::Create(const DeviceMotionEventInit* init) { @@ -54,7 +54,7 @@ } DeviceMotionData* DeviceMotionData::Create() { - return new DeviceMotionData; + return MakeGarbageCollected<DeviceMotionData>(); } DeviceMotionData::DeviceMotionData() : interval_(0) {}
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_data.h b/third_party/blink/renderer/modules/device_orientation/device_motion_data.h index 7c9c32f..57e8453 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_data.h +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_data.h
@@ -45,6 +45,13 @@ DeviceRotationRate*, double interval); static DeviceMotionData* Create(const DeviceMotionEventInit*); + + DeviceMotionData(); + DeviceMotionData(DeviceAcceleration*, + DeviceAcceleration* acceleration_including_gravity, + DeviceRotationRate*, + double interval); + void Trace(blink::Visitor*); DeviceAcceleration* GetAcceleration() const { return acceleration_.Get(); } @@ -58,12 +65,6 @@ bool CanProvideEventData() const; private: - DeviceMotionData(); - DeviceMotionData(DeviceAcceleration*, - DeviceAcceleration* acceleration_including_gravity, - DeviceRotationRate*, - double interval); - Member<DeviceAcceleration> acceleration_; Member<DeviceAcceleration> acceleration_including_gravity_; Member<DeviceRotationRate> rotation_rate_;
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_event.h b/third_party/blink/renderer/modules/device_orientation/device_motion_event.h index 4b9ed58a..adcc872 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_event.h +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_event.h
@@ -40,15 +40,22 @@ DEFINE_WRAPPERTYPEINFO(); public: + DeviceMotionEvent(); + DeviceMotionEvent(const AtomicString&, const DeviceMotionEventInit*); + DeviceMotionEvent(const AtomicString& event_type, const DeviceMotionData*); ~DeviceMotionEvent() override; - static DeviceMotionEvent* Create() { return new DeviceMotionEvent; } + + static DeviceMotionEvent* Create() { + return MakeGarbageCollected<DeviceMotionEvent>(); + } static DeviceMotionEvent* Create(const AtomicString& event_type, const DeviceMotionEventInit* initializer) { - return new DeviceMotionEvent(event_type, initializer); + return MakeGarbageCollected<DeviceMotionEvent>(event_type, initializer); } static DeviceMotionEvent* Create(const AtomicString& event_type, const DeviceMotionData* device_motion_data) { - return new DeviceMotionEvent(event_type, device_motion_data); + return MakeGarbageCollected<DeviceMotionEvent>(event_type, + device_motion_data); } const DeviceMotionData* GetDeviceMotionData() const { @@ -65,10 +72,6 @@ void Trace(blink::Visitor*) override; private: - DeviceMotionEvent(); - DeviceMotionEvent(const AtomicString&, const DeviceMotionEventInit*); - DeviceMotionEvent(const AtomicString& event_type, const DeviceMotionData*); - Member<const DeviceMotionData> device_motion_data_; };
diff --git a/third_party/blink/renderer/modules/device_orientation/device_motion_event_pump_unittest.cc b/third_party/blink/renderer/modules/device_orientation/device_motion_event_pump_unittest.cc index b8c44df..14f5315d 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_motion_event_pump_unittest.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_motion_event_pump_unittest.cc
@@ -76,8 +76,8 @@ void SetUp() override { device::mojom::SensorProviderPtrInfo sensor_provider_ptr_info; sensor_provider_.Bind(mojo::MakeRequest(&sensor_provider_ptr_info)); - auto* motion_pump = - new DeviceMotionEventPump(base::ThreadTaskRunnerHandle::Get()); + auto* motion_pump = MakeGarbageCollected<DeviceMotionEventPump>( + base::ThreadTaskRunnerHandle::Get()); motion_pump->SetSensorProviderForTesting( device::mojom::blink::SensorProviderPtr( device::mojom::blink::SensorProviderPtrInfo(
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.cc b/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.cc index d0bf368..da94bcb 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.cc
@@ -25,7 +25,8 @@ DeviceOrientationAbsoluteController* controller = Supplement<Document>::From<DeviceOrientationAbsoluteController>(document); if (!controller) { - controller = new DeviceOrientationAbsoluteController(document); + controller = + MakeGarbageCollected<DeviceOrientationAbsoluteController>(document); Supplement<Document>::ProvideTo(document, controller); } return *controller;
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.h b/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.h index e8e2e28..a717cc6d 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.h +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_absolute_controller.h
@@ -15,6 +15,7 @@ public: static const char kSupplementName[]; + explicit DeviceOrientationAbsoluteController(Document&); ~DeviceOrientationAbsoluteController() override; static DeviceOrientationAbsoluteController& From(Document&); @@ -29,8 +30,6 @@ // Inherited from PlatformEventController. void RegisterWithDispatcher() override; - explicit DeviceOrientationAbsoluteController(Document&); - // Inherited from DeviceOrientationController. const AtomicString& EventTypeName() const override; };
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc b/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc index 0bb669b..739f01a 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.cc
@@ -41,7 +41,7 @@ DeviceOrientationController* controller = Supplement<Document>::From<DeviceOrientationController>(document); if (!controller) { - controller = new DeviceOrientationController(document); + controller = MakeGarbageCollected<DeviceOrientationController>(document); ProvideTo(document, controller); } return *controller; @@ -156,7 +156,7 @@ scoped_refptr<base::SingleThreadTaskRunner> task_runner = frame->GetTaskRunner(TaskType::kSensor); orientation_event_pump_ = - new DeviceOrientationEventPump(task_runner, absolute); + MakeGarbageCollected<DeviceOrientationEventPump>(task_runner, absolute); } orientation_event_pump_->AddController(this); }
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.h b/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.h index 3985fdec..33384b2 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.h +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_controller.h
@@ -23,6 +23,7 @@ public: static const char kSupplementName[]; + explicit DeviceOrientationController(Document&); ~DeviceOrientationController() override; static DeviceOrientationController& From(Document&); @@ -42,7 +43,6 @@ const AtomicString& event_name); protected: - explicit DeviceOrientationController(Document&); void RegisterWithOrientationEventPump(bool absolute); Member<DeviceOrientationEventPump> orientation_event_pump_;
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_data.cc b/third_party/blink/renderer/modules/device_orientation/device_orientation_data.cc index d6418ca2..0040a58a 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_data.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_data.cc
@@ -30,7 +30,7 @@ namespace blink { DeviceOrientationData* DeviceOrientationData::Create() { - return new DeviceOrientationData; + return MakeGarbageCollected<DeviceOrientationData>(); } DeviceOrientationData* DeviceOrientationData::Create( @@ -38,7 +38,8 @@ const base::Optional<double>& beta, const base::Optional<double>& gamma, bool absolute) { - return new DeviceOrientationData(alpha, beta, gamma, absolute); + return MakeGarbageCollected<DeviceOrientationData>(alpha, beta, gamma, + absolute); } DeviceOrientationData* DeviceOrientationData::Create(
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_data.h b/third_party/blink/renderer/modules/device_orientation/device_orientation_data.h index a8db31f..bb591ef 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_data.h +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_data.h
@@ -43,6 +43,13 @@ const base::Optional<double>& gamma, bool absolute); static DeviceOrientationData* Create(const DeviceOrientationEventInit*); + + DeviceOrientationData(); + DeviceOrientationData(const base::Optional<double>& alpha, + const base::Optional<double>& beta, + const base::Optional<double>& gamma, + bool absolute); + void Trace(blink::Visitor* visitor) {} double Alpha() const; @@ -56,12 +63,6 @@ bool CanProvideEventData() const; private: - DeviceOrientationData(); - DeviceOrientationData(const base::Optional<double>& alpha, - const base::Optional<double>& beta, - const base::Optional<double>& gamma, - bool absolute); - base::Optional<double> alpha_; base::Optional<double> beta_; base::Optional<double> gamma_;
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h b/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h index c50ac05..43a95fd 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_event.h
@@ -38,16 +38,26 @@ DEFINE_WRAPPERTYPEINFO(); public: + DeviceOrientationEvent(); + DeviceOrientationEvent(const AtomicString&, + const DeviceOrientationEventInit*); + DeviceOrientationEvent(const AtomicString& event_type, + DeviceOrientationData*); ~DeviceOrientationEvent() override; - static DeviceOrientationEvent* Create() { return new DeviceOrientationEvent; } + + static DeviceOrientationEvent* Create() { + return MakeGarbageCollected<DeviceOrientationEvent>(); + } static DeviceOrientationEvent* Create( const AtomicString& event_type, const DeviceOrientationEventInit* initializer) { - return new DeviceOrientationEvent(event_type, initializer); + return MakeGarbageCollected<DeviceOrientationEvent>(event_type, + initializer); } static DeviceOrientationEvent* Create(const AtomicString& event_type, DeviceOrientationData* orientation) { - return new DeviceOrientationEvent(event_type, orientation); + return MakeGarbageCollected<DeviceOrientationEvent>(event_type, + orientation); } DeviceOrientationData* Orientation() const { return orientation_.Get(); } @@ -62,12 +72,6 @@ void Trace(blink::Visitor*) override; private: - DeviceOrientationEvent(); - DeviceOrientationEvent(const AtomicString&, - const DeviceOrientationEventInit*); - DeviceOrientationEvent(const AtomicString& event_type, - DeviceOrientationData*); - Member<DeviceOrientationData> orientation_; };
diff --git a/third_party/blink/renderer/modules/device_orientation/device_orientation_event_pump_unittest.cc b/third_party/blink/renderer/modules/device_orientation/device_orientation_event_pump_unittest.cc index 64c5535..83d4590 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_orientation_event_pump_unittest.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_orientation_event_pump_unittest.cc
@@ -87,7 +87,7 @@ void SetUp() override { device::mojom::SensorProviderPtrInfo sensor_provider_ptr_info; sensor_provider_.Bind(mojo::MakeRequest(&sensor_provider_ptr_info)); - auto* orientation_pump = new DeviceOrientationEventPump( + auto* orientation_pump = MakeGarbageCollected<DeviceOrientationEventPump>( base::ThreadTaskRunnerHandle::Get(), false /* absolute */); orientation_pump->SetSensorProviderForTesting( device::mojom::blink::SensorProviderPtr( @@ -726,8 +726,9 @@ void SetUp() override { device::mojom::SensorProviderPtrInfo sensor_provider_ptr_info; sensor_provider_.Bind(mojo::MakeRequest(&sensor_provider_ptr_info)); - auto* absolute_orientation_pump = new DeviceOrientationEventPump( - base::ThreadTaskRunnerHandle::Get(), true /* absolute */); + auto* absolute_orientation_pump = + MakeGarbageCollected<DeviceOrientationEventPump>( + base::ThreadTaskRunnerHandle::Get(), true /* absolute */); absolute_orientation_pump->SetSensorProviderForTesting( device::mojom::blink::SensorProviderPtr( device::mojom::blink::SensorProviderPtrInfo(
diff --git a/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.cc b/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.cc index 85e18fd7..4c2d754 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.cc +++ b/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.cc
@@ -31,7 +31,7 @@ DeviceRotationRate* DeviceRotationRate::Create(double alpha, double beta, double gamma) { - return new DeviceRotationRate(alpha, beta, gamma); + return MakeGarbageCollected<DeviceRotationRate>(alpha, beta, gamma); } DeviceRotationRate* DeviceRotationRate::Create(
diff --git a/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.h b/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.h index c5c2c33..8bd90aa 100644 --- a/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.h +++ b/third_party/blink/renderer/modules/device_orientation/device_rotation_rate.h
@@ -42,6 +42,8 @@ static DeviceRotationRate* Create(double alpha, double beta, double gamma); static DeviceRotationRate* Create(const DeviceRotationRateInit*); + DeviceRotationRate(double alpha, double beta, double gamma); + bool HasRotationData() const; double alpha(bool& is_null) const; @@ -49,8 +51,6 @@ double gamma(bool& is_null) const; private: - DeviceRotationRate(double alpha, double beta, double gamma); - const double alpha_; const double beta_; const double gamma_;
diff --git a/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc b/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc index 6397943..225f56c 100644 --- a/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc +++ b/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc
@@ -592,8 +592,9 @@ // (Available as getExecutionContext()->getSecurityOrigin() anytime.) // 7. Let promise be a new promise. - LoadSessionResultPromise* result = new LoadSessionResultPromise( - script_state, this, "MediaKeySession", "load"); + LoadSessionResultPromise* result = + MakeGarbageCollected<LoadSessionResultPromise>(script_state, this, + "MediaKeySession", "load"); ScriptPromise promise = result->Promise(); // 8. Run the following steps asynchronously (done in loadTask())
diff --git a/third_party/blink/renderer/modules/encryptedmedia/media_keys.cc b/third_party/blink/renderer/modules/encryptedmedia/media_keys.cc index 41f86bff..e384ab9 100644 --- a/third_party/blink/renderer/modules/encryptedmedia/media_keys.cc +++ b/third_party/blink/renderer/modules/encryptedmedia/media_keys.cc
@@ -344,8 +344,9 @@ String min_hdcp_version = media_keys_policy->minHdcpVersion(); // Let promise be a new promise. - GetStatusForPolicyResultPromise* result = new GetStatusForPolicyResultPromise( - script_state, this, "MediaKeys", "getStatusForPolicy"); + GetStatusForPolicyResultPromise* result = + MakeGarbageCollected<GetStatusForPolicyResultPromise>( + script_state, this, "MediaKeys", "getStatusForPolicy"); ScriptPromise promise = result->Promise(); // Run the following steps asynchronously. See GetStatusForPolicyTask().
diff --git a/third_party/blink/renderer/modules/filesystem/directory_entry.h b/third_party/blink/renderer/modules/filesystem/directory_entry.h index 7ebdbe2..147f9dc 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_entry.h +++ b/third_party/blink/renderer/modules/filesystem/directory_entry.h
@@ -51,8 +51,11 @@ public: static DirectoryEntry* Create(DOMFileSystemBase* file_system, const String& full_path) { - return new DirectoryEntry(file_system, full_path); + return MakeGarbageCollected<DirectoryEntry>(file_system, full_path); } + + DirectoryEntry(DOMFileSystemBase*, const String& full_path); + bool isDirectory() const override { return true; } DirectoryReader* createReader(); @@ -68,9 +71,6 @@ V8ErrorCallback* = nullptr) const; void Trace(blink::Visitor*) override; - - private: - DirectoryEntry(DOMFileSystemBase*, const String& full_path); }; DEFINE_TYPE_CASTS(DirectoryEntry,
diff --git a/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h b/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h index 3eeb769f..2be2144 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h +++ b/third_party/blink/renderer/modules/filesystem/directory_entry_sync.h
@@ -47,8 +47,11 @@ public: static DirectoryEntrySync* Create(DOMFileSystemBase* file_system, const String& full_path) { - return new DirectoryEntrySync(file_system, full_path); + return MakeGarbageCollected<DirectoryEntrySync>(file_system, full_path); } + + DirectoryEntrySync(DOMFileSystemBase*, const String& full_path); + bool isDirectory() const override { return true; } DirectoryReaderSync* createReader(); @@ -61,9 +64,6 @@ void removeRecursively(ExceptionState&); void Trace(blink::Visitor*) override; - - private: - DirectoryEntrySync(DOMFileSystemBase*, const String& full_path); }; DEFINE_TYPE_CASTS(DirectoryEntrySync,
diff --git a/third_party/blink/renderer/modules/filesystem/directory_reader.cc b/third_party/blink/renderer/modules/filesystem/directory_reader.cc index df3c6202..9c02bf9 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_reader.cc +++ b/third_party/blink/renderer/modules/filesystem/directory_reader.cc
@@ -51,9 +51,11 @@ : public EntriesCallbacks::OnDidGetEntriesCallback { public: static EntriesCallbackHelper* Create(DirectoryReader* reader) { - return new EntriesCallbackHelper(reader); + return MakeGarbageCollected<EntriesCallbackHelper>(reader); } + explicit EntriesCallbackHelper(DirectoryReader* reader) : reader_(reader) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(reader_); EntriesCallbacks::OnDidGetEntriesCallback::Trace(visitor); @@ -64,8 +66,6 @@ } private: - explicit EntriesCallbackHelper(DirectoryReader* reader) : reader_(reader) {} - // FIXME: This Member keeps the reader alive until all of the readDirectory // results are received. crbug.com/350285 Member<DirectoryReader> reader_; @@ -74,9 +74,11 @@ class DirectoryReader::ErrorCallbackHelper final : public ErrorCallbackBase { public: static ErrorCallbackHelper* Create(DirectoryReader* reader) { - return new ErrorCallbackHelper(reader); + return MakeGarbageCollected<ErrorCallbackHelper>(reader); } + explicit ErrorCallbackHelper(DirectoryReader* reader) : reader_(reader) {} + void Invoke(base::File::Error error) override { reader_->OnError(error); } void Trace(blink::Visitor* visitor) override { @@ -85,8 +87,6 @@ } private: - explicit ErrorCallbackHelper(DirectoryReader* reader) : reader_(reader) {} - Member<DirectoryReader> reader_; };
diff --git a/third_party/blink/renderer/modules/filesystem/directory_reader.h b/third_party/blink/renderer/modules/filesystem/directory_reader.h index aa741253..6668cd0 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_reader.h +++ b/third_party/blink/renderer/modules/filesystem/directory_reader.h
@@ -46,9 +46,10 @@ public: static DirectoryReader* Create(DOMFileSystemBase* file_system, const String& full_path) { - return new DirectoryReader(file_system, full_path); + return MakeGarbageCollected<DirectoryReader>(file_system, full_path); } + DirectoryReader(DOMFileSystemBase*, const String& full_path); ~DirectoryReader() override = default; void readEntries(V8EntriesCallback*, V8ErrorCallback* = nullptr); @@ -63,8 +64,6 @@ class EntriesCallbackHelper; class ErrorCallbackHelper; - DirectoryReader(DOMFileSystemBase*, const String& full_path); - void AddEntries(const EntryHeapVector& entries); void OnError(base::File::Error error);
diff --git a/third_party/blink/renderer/modules/filesystem/directory_reader_sync.cc b/third_party/blink/renderer/modules/filesystem/directory_reader_sync.cc index c7e20ce4..e6b6c9e8 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_reader_sync.cc +++ b/third_party/blink/renderer/modules/filesystem/directory_reader_sync.cc
@@ -43,9 +43,12 @@ : public EntriesCallbacks::OnDidGetEntriesCallback { public: static EntriesCallbackHelper* Create(DirectoryReaderSync* reader) { - return new EntriesCallbackHelper(reader); + return MakeGarbageCollected<EntriesCallbackHelper>(reader); } + explicit EntriesCallbackHelper(DirectoryReaderSync* reader) + : reader_(reader) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(reader_); EntriesCallbacks::OnDidGetEntriesCallback::Trace(visitor); @@ -60,9 +63,6 @@ } private: - explicit EntriesCallbackHelper(DirectoryReaderSync* reader) - : reader_(reader) {} - Member<DirectoryReaderSync> reader_; }; @@ -70,9 +70,11 @@ : public ErrorCallbackBase { public: static ErrorCallbackHelper* Create(DirectoryReaderSync* reader) { - return new ErrorCallbackHelper(reader); + return MakeGarbageCollected<ErrorCallbackHelper>(reader); } + explicit ErrorCallbackHelper(DirectoryReaderSync* reader) : reader_(reader) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(reader_); ErrorCallbackBase::Trace(visitor); @@ -83,8 +85,6 @@ } private: - explicit ErrorCallbackHelper(DirectoryReaderSync* reader) : reader_(reader) {} - Member<DirectoryReaderSync> reader_; };
diff --git a/third_party/blink/renderer/modules/filesystem/directory_reader_sync.h b/third_party/blink/renderer/modules/filesystem/directory_reader_sync.h index 92b1bed..fa23b1f4 100644 --- a/third_party/blink/renderer/modules/filesystem/directory_reader_sync.h +++ b/third_party/blink/renderer/modules/filesystem/directory_reader_sync.h
@@ -49,9 +49,10 @@ public: static DirectoryReaderSync* Create(DOMFileSystemBase* file_system, const String& full_path) { - return new DirectoryReaderSync(file_system, full_path); + return MakeGarbageCollected<DirectoryReaderSync>(file_system, full_path); } + DirectoryReaderSync(DOMFileSystemBase*, const String& full_path); ~DirectoryReaderSync() override = default; EntrySyncHeapVector readEntries(ExceptionState&); @@ -62,8 +63,6 @@ class EntriesCallbackHelper; class ErrorCallbackHelper; - DirectoryReaderSync(DOMFileSystemBase*, const String& full_path); - bool has_called_read_directory_ = false; EntrySyncHeapVector entries_; base::File::Error error_code_ = base::File::FILE_OK;
diff --git a/third_party/blink/renderer/modules/filesystem/dom_window_file_system.cc b/third_party/blink/renderer/modules/filesystem/dom_window_file_system.cc index 8ac0f9fd..85317b25 100644 --- a/third_party/blink/renderer/modules/filesystem/dom_window_file_system.cc +++ b/third_party/blink/renderer/modules/filesystem/dom_window_file_system.cc
@@ -179,12 +179,15 @@ // TODO(mek): Try to create handle directly rather than having to do more // IPCs to get the actual entries. if (is_directory) { - fs->GetDirectory(fs->root(), entry->base_name, FileSystemFlags::Create(), - new EntryCallbacks::OnDidGetEntryPromiseImpl(new_resolver), - new PromiseErrorCallback(new_resolver)); + fs->GetDirectory( + fs->root(), entry->base_name, FileSystemFlags::Create(), + MakeGarbageCollected<EntryCallbacks::OnDidGetEntryPromiseImpl>( + new_resolver), + new PromiseErrorCallback(new_resolver)); } else { fs->GetFile(fs->root(), entry->base_name, FileSystemFlags::Create(), - new EntryCallbacks::OnDidGetEntryPromiseImpl(new_resolver), + MakeGarbageCollected<EntryCallbacks::OnDidGetEntryPromiseImpl>( + new_resolver), new PromiseErrorCallback(new_resolver)); } return result;
diff --git a/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.cc b/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.cc index 5e4df3b..5add2029 100644 --- a/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.cc +++ b/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.cc
@@ -76,7 +76,7 @@ DataObject* data_object) { DCHECK(IsMainThread()); DraggedIsolatedFileSystemImpl* file_system = - new DraggedIsolatedFileSystemImpl(); + MakeGarbageCollected<DraggedIsolatedFileSystemImpl>(); ProvideTo(*data_object, file_system); }
diff --git a/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.h b/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.h index 5cd991da..e524f907 100644 --- a/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.h +++ b/third_party/blink/renderer/modules/filesystem/dragged_isolated_file_system_impl.h
@@ -57,13 +57,13 @@ static DraggedIsolatedFileSystemImpl* From(DataObject*); + DraggedIsolatedFileSystemImpl() = default; + void Trace(blink::Visitor*) override; static void PrepareForDataObject(DataObject*); private: - DraggedIsolatedFileSystemImpl() = default; - HeapHashMap<String, Member<DOMFileSystem>> filesystems_; };
diff --git a/third_party/blink/renderer/modules/filesystem/entry.h b/third_party/blink/renderer/modules/filesystem/entry.h index 03744f9..4f2dc22f 100644 --- a/third_party/blink/renderer/modules/filesystem/entry.h +++ b/third_party/blink/renderer/modules/filesystem/entry.h
@@ -48,6 +48,8 @@ DEFINE_WRAPPERTYPEINFO(); public: + Entry(DOMFileSystemBase*, const String& full_path); + DOMFileSystem* filesystem() const { return static_cast<DOMFileSystem*>(file_system_.Get()); } @@ -75,9 +77,6 @@ String toURL(ScriptState*) const; void Trace(blink::Visitor*) override; - - protected: - Entry(DOMFileSystemBase*, const String& full_path); }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/filesystem/entry_base.cc b/third_party/blink/renderer/modules/filesystem/entry_base.cc index b2e0c94..19609d9 100644 --- a/third_party/blink/renderer/modules/filesystem/entry_base.cc +++ b/third_party/blink/renderer/modules/filesystem/entry_base.cc
@@ -59,9 +59,10 @@ FileSystemBaseHandle* EntryBase::asFileSystemHandle() const { if (isFile()) - return new FileSystemFileHandle(filesystem(), fullPath()); + return MakeGarbageCollected<FileSystemFileHandle>(filesystem(), fullPath()); DCHECK(isDirectory()); - return new FileSystemDirectoryHandle(filesystem(), fullPath()); + return MakeGarbageCollected<FileSystemDirectoryHandle>(filesystem(), + fullPath()); } void EntryBase::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/modules/filesystem/file_entry.h b/third_party/blink/renderer/modules/filesystem/file_entry.h index 17ca61e..4626373 100644 --- a/third_party/blink/renderer/modules/filesystem/file_entry.h +++ b/third_party/blink/renderer/modules/filesystem/file_entry.h
@@ -47,18 +47,17 @@ public: static FileEntry* Create(DOMFileSystemBase* file_system, const String& full_path) { - return new FileEntry(file_system, full_path); + return MakeGarbageCollected<FileEntry>(file_system, full_path); } + FileEntry(DOMFileSystemBase*, const String& full_path); + void createWriter(V8FileWriterCallback*, V8ErrorCallback* = nullptr); void file(V8FileCallback*, V8ErrorCallback* = nullptr); bool isFile() const override { return true; } void Trace(blink::Visitor*) override; - - private: - FileEntry(DOMFileSystemBase*, const String& full_path); }; DEFINE_TYPE_CASTS(FileEntry, Entry, entry, entry->isFile(), entry.isFile());
diff --git a/third_party/blink/renderer/modules/filesystem/file_entry_sync.h b/third_party/blink/renderer/modules/filesystem/file_entry_sync.h index 08be0b6..90fe339d 100644 --- a/third_party/blink/renderer/modules/filesystem/file_entry_sync.h +++ b/third_party/blink/renderer/modules/filesystem/file_entry_sync.h
@@ -47,18 +47,17 @@ public: static FileEntrySync* Create(DOMFileSystemBase* file_system, const String& full_path) { - return new FileEntrySync(file_system, full_path); + return MakeGarbageCollected<FileEntrySync>(file_system, full_path); } + FileEntrySync(DOMFileSystemBase*, const String& full_path); + bool isFile() const override { return true; } File* file(ExceptionState&); FileWriterSync* createWriter(ExceptionState&); void Trace(blink::Visitor*) override; - - private: - FileEntrySync(DOMFileSystemBase*, const String& full_path); }; DEFINE_TYPE_CASTS(FileEntrySync,
diff --git a/third_party/blink/renderer/modules/filesystem/file_system_base_handle.cc b/third_party/blink/renderer/modules/filesystem/file_system_base_handle.cc index 1fcaa2f..973408af 100644 --- a/third_party/blink/renderer/modules/filesystem/file_system_base_handle.cc +++ b/third_party/blink/renderer/modules/filesystem/file_system_base_handle.cc
@@ -19,7 +19,8 @@ auto* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise result = resolver->Promise(); filesystem()->GetParent( - this, new EntryCallbacks::OnDidGetEntryPromiseImpl(resolver), + this, + MakeGarbageCollected<EntryCallbacks::OnDidGetEntryPromiseImpl>(resolver), new PromiseErrorCallback(resolver)); return result; } @@ -29,9 +30,10 @@ const String& name) { auto* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise result = resolver->Promise(); - filesystem()->Move(this, parent, name, - new EntryCallbacks::OnDidGetEntryPromiseImpl(resolver), - new PromiseErrorCallback(resolver)); + filesystem()->Move( + this, parent, name, + MakeGarbageCollected<EntryCallbacks::OnDidGetEntryPromiseImpl>(resolver), + new PromiseErrorCallback(resolver)); return result; } @@ -40,9 +42,10 @@ const String& name) { auto* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise result = resolver->Promise(); - filesystem()->Copy(this, parent, name, - new EntryCallbacks::OnDidGetEntryPromiseImpl(resolver), - new PromiseErrorCallback(resolver)); + filesystem()->Copy( + this, parent, name, + MakeGarbageCollected<EntryCallbacks::OnDidGetEntryPromiseImpl>(resolver), + new PromiseErrorCallback(resolver)); return result; }
diff --git a/third_party/blink/renderer/modules/filesystem/file_system_callbacks.h b/third_party/blink/renderer/modules/filesystem/file_system_callbacks.h index 04ab209..25a6743 100644 --- a/third_party/blink/renderer/modules/filesystem/file_system_callbacks.h +++ b/third_party/blink/renderer/modules/filesystem/file_system_callbacks.h
@@ -144,15 +144,17 @@ class OnDidGetEntryV8Impl : public OnDidGetEntryCallback { public: static OnDidGetEntryV8Impl* Create(V8EntryCallback* callback) { - return callback ? new OnDidGetEntryV8Impl(callback) : nullptr; + return callback ? MakeGarbageCollected<OnDidGetEntryV8Impl>(callback) + : nullptr; } + + OnDidGetEntryV8Impl(V8EntryCallback* callback) + : callback_(ToV8PersistentCallbackInterface(callback)) {} + void Trace(blink::Visitor*) override; void OnSuccess(Entry*) override; private: - OnDidGetEntryV8Impl(V8EntryCallback* callback) - : callback_(ToV8PersistentCallbackInterface(callback)) {} - Member<V8PersistentCallbackInterface<V8EntryCallback>> callback_; }; @@ -237,15 +239,18 @@ class OnDidOpenFileSystemV8Impl : public OnDidOpenFileSystemCallback { public: static OnDidOpenFileSystemV8Impl* Create(V8FileSystemCallback* callback) { - return callback ? new OnDidOpenFileSystemV8Impl(callback) : nullptr; + return callback + ? MakeGarbageCollected<OnDidOpenFileSystemV8Impl>(callback) + : nullptr; } + + OnDidOpenFileSystemV8Impl(V8FileSystemCallback* callback) + : callback_(ToV8PersistentCallbackInterface(callback)) {} + void Trace(blink::Visitor*) override; void OnSuccess(DOMFileSystem*) override; private: - OnDidOpenFileSystemV8Impl(V8FileSystemCallback* callback) - : callback_(ToV8PersistentCallbackInterface(callback)) {} - Member<V8PersistentCallbackInterface<V8FileSystemCallback>> callback_; }; @@ -354,15 +359,18 @@ class OnDidCreateFileWriterV8Impl : public OnDidCreateFileWriterCallback { public: static OnDidCreateFileWriterV8Impl* Create(V8FileWriterCallback* callback) { - return callback ? new OnDidCreateFileWriterV8Impl(callback) : nullptr; + return callback + ? MakeGarbageCollected<OnDidCreateFileWriterV8Impl>(callback) + : nullptr; } + + OnDidCreateFileWriterV8Impl(V8FileWriterCallback* callback) + : callback_(ToV8PersistentCallbackInterface(callback)) {} + void Trace(blink::Visitor*) override; void OnSuccess(FileWriterBase*) override; private: - OnDidCreateFileWriterV8Impl(V8FileWriterCallback* callback) - : callback_(ToV8PersistentCallbackInterface(callback)) {} - Member<V8PersistentCallbackInterface<V8FileWriterCallback>> callback_; };
diff --git a/third_party/blink/renderer/modules/filesystem/file_system_directory_handle.cc b/third_party/blink/renderer/modules/filesystem/file_system_directory_handle.cc index 6acbd1a8..e551158 100644 --- a/third_party/blink/renderer/modules/filesystem/file_system_directory_handle.cc +++ b/third_party/blink/renderer/modules/filesystem/file_system_directory_handle.cc
@@ -25,9 +25,10 @@ flags->setCreateFlag(options->create()); auto* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise result = resolver->Promise(); - filesystem()->GetFile(this, name, flags, - new EntryCallbacks::OnDidGetEntryPromiseImpl(resolver), - new PromiseErrorCallback(resolver)); + filesystem()->GetFile( + this, name, flags, + MakeGarbageCollected<EntryCallbacks::OnDidGetEntryPromiseImpl>(resolver), + new PromiseErrorCallback(resolver)); return result; } @@ -40,7 +41,8 @@ auto* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise result = resolver->Promise(); filesystem()->GetDirectory( - this, name, flags, new EntryCallbacks::OnDidGetEntryPromiseImpl(resolver), + this, name, flags, + MakeGarbageCollected<EntryCallbacks::OnDidGetEntryPromiseImpl>(resolver), new PromiseErrorCallback(resolver)); return result; }
diff --git a/third_party/blink/renderer/modules/filesystem/file_system_directory_iterator.cc b/third_party/blink/renderer/modules/filesystem/file_system_directory_iterator.cc index 7a667643..4633c66 100644 --- a/third_party/blink/renderer/modules/filesystem/file_system_directory_iterator.cc +++ b/third_party/blink/renderer/modules/filesystem/file_system_directory_iterator.cc
@@ -55,8 +55,9 @@ DOMFileSystemBase* file_system, const String& full_path) : DirectoryReaderBase(file_system, full_path) { - Filesystem()->ReadDirectory(this, full_path_, new EntriesCallbackHelper(this), - new ErrorCallbackHelper(this)); + Filesystem()->ReadDirectory(this, full_path_, + MakeGarbageCollected<EntriesCallbackHelper>(this), + MakeGarbageCollected<ErrorCallbackHelper>(this)); } ScriptPromise FileSystemDirectoryIterator::next(ScriptState* script_state) {
diff --git a/third_party/blink/renderer/modules/filesystem/file_system_file_handle.cc b/third_party/blink/renderer/modules/filesystem/file_system_file_handle.cc index 6c277c4..58bcbe6 100644 --- a/third_party/blink/renderer/modules/filesystem/file_system_file_handle.cc +++ b/third_party/blink/renderer/modules/filesystem/file_system_file_handle.cc
@@ -50,7 +50,8 @@ [](ScriptPromiseResolver* resolver, base::File::Error result, mojom::blink::FileWriterPtr writer) { if (result == base::File::FILE_OK) { - resolver->Resolve(new FileSystemWriter(std::move(writer))); + resolver->Resolve(MakeGarbageCollected<FileSystemWriter>( + std::move(writer))); } else { resolver->Reject(file_error::CreateDOMException(result)); }
diff --git a/third_party/blink/renderer/modules/filesystem/file_writer.cc b/third_party/blink/renderer/modules/filesystem/file_writer.cc index 63f35972..94dbe81 100644 --- a/third_party/blink/renderer/modules/filesystem/file_writer.cc +++ b/third_party/blink/renderer/modules/filesystem/file_writer.cc
@@ -45,7 +45,7 @@ static const double kProgressNotificationIntervalMS = 50; FileWriter* FileWriter::Create(ExecutionContext* context) { - return new FileWriter(context); + return MakeGarbageCollected<FileWriter>(context); } FileWriter::FileWriter(ExecutionContext* context)
diff --git a/third_party/blink/renderer/modules/filesystem/file_writer.h b/third_party/blink/renderer/modules/filesystem/file_writer.h index 08bb31cd..64842401 100644 --- a/third_party/blink/renderer/modules/filesystem/file_writer.h +++ b/third_party/blink/renderer/modules/filesystem/file_writer.h
@@ -56,6 +56,8 @@ public: static FileWriter* Create(ExecutionContext*); + + explicit FileWriter(ExecutionContext*); ~FileWriter() override; enum ReadyState { kInit = 0, kWriting = 1, kDone = 2 }; @@ -106,8 +108,6 @@ kOperationAbort }; - explicit FileWriter(ExecutionContext*); - void CompleteAbort(); void DoOperation(Operation);
diff --git a/third_party/blink/renderer/modules/filesystem/file_writer_sync.h b/third_party/blink/renderer/modules/filesystem/file_writer_sync.h index 6561606..fff8ede6 100644 --- a/third_party/blink/renderer/modules/filesystem/file_writer_sync.h +++ b/third_party/blink/renderer/modules/filesystem/file_writer_sync.h
@@ -50,8 +50,10 @@ public: static FileWriterSync* Create(ExecutionContext* context) { - return new FileWriterSync(context); + return MakeGarbageCollected<FileWriterSync>(context); } + + explicit FileWriterSync(ExecutionContext* context); ~FileWriterSync() override; void Trace(blink::Visitor*) override; @@ -70,7 +72,6 @@ void DoCancel() override; private: - explicit FileWriterSync(ExecutionContext* context); void PrepareForWrite(); base::File::Error error_;
diff --git a/third_party/blink/renderer/modules/filesystem/local_file_system.cc b/third_party/blink/renderer/modules/filesystem/local_file_system.cc index 676cd7a..b08ad89 100644 --- a/third_party/blink/renderer/modules/filesystem/local_file_system.cc +++ b/third_party/blink/renderer/modules/filesystem/local_file_system.cc
@@ -216,13 +216,15 @@ void ProvideLocalFileSystemTo(LocalFrame& frame, std::unique_ptr<FileSystemClient> client) { - frame.ProvideSupplement(new LocalFileSystem(frame, std::move(client))); + frame.ProvideSupplement( + MakeGarbageCollected<LocalFileSystem>(frame, std::move(client))); } void ProvideLocalFileSystemToWorker(WorkerClients* worker_clients, std::unique_ptr<FileSystemClient> client) { - Supplement<WorkerClients>::ProvideTo( - *worker_clients, new LocalFileSystem(*worker_clients, std::move(client))); + Supplement<WorkerClients>::ProvideTo(*worker_clients, + MakeGarbageCollected<LocalFileSystem>( + *worker_clients, std::move(client))); } } // namespace blink
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad.h b/third_party/blink/renderer/modules/gamepad/gamepad.h index e4141d5..0d60c72 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad.h +++ b/third_party/blink/renderer/modules/gamepad/gamepad.h
@@ -42,7 +42,9 @@ DEFINE_WRAPPERTYPEINFO(); public: - static Gamepad* Create() { return new Gamepad; } + static Gamepad* Create() { return MakeGarbageCollected<Gamepad>(); } + + Gamepad(); ~Gamepad() override; typedef Vector<double> DoubleVector; @@ -87,8 +89,6 @@ void Trace(blink::Visitor*) override; private: - Gamepad(); - String id_; unsigned index_; bool connected_;
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_button.cc b/third_party/blink/renderer/modules/gamepad/gamepad_button.cc index 914930f..d60d596c 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_button.cc +++ b/third_party/blink/renderer/modules/gamepad/gamepad_button.cc
@@ -7,7 +7,7 @@ namespace blink { GamepadButton* GamepadButton::Create() { - return new GamepadButton(); + return MakeGarbageCollected<GamepadButton>(); } GamepadButton::GamepadButton() : value_(0.), pressed_(false), touched_(false) {}
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_button.h b/third_party/blink/renderer/modules/gamepad/gamepad_button.h index ed9ee1f..c2838e0 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_button.h +++ b/third_party/blink/renderer/modules/gamepad/gamepad_button.h
@@ -18,6 +18,8 @@ public: static GamepadButton* Create(); + GamepadButton(); + double value() const { return value_; } void SetValue(double val) { value_ = val; } @@ -31,7 +33,6 @@ void UpdateValuesFrom(const device::GamepadButton&); private: - GamepadButton(); double value_; bool pressed_; bool touched_;
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_event.h b/third_party/blink/renderer/modules/gamepad/gamepad_event.h index af9af7e..e581f00 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_event.h +++ b/third_party/blink/renderer/modules/gamepad/gamepad_event.h
@@ -19,12 +19,16 @@ Bubbles bubbles, Cancelable cancelable, Gamepad* gamepad) { - return new GamepadEvent(type, bubbles, cancelable, gamepad); + return MakeGarbageCollected<GamepadEvent>(type, bubbles, cancelable, + gamepad); } static GamepadEvent* Create(const AtomicString& type, const GamepadEventInit* initializer) { - return new GamepadEvent(type, initializer); + return MakeGarbageCollected<GamepadEvent>(type, initializer); } + + GamepadEvent(const AtomicString& type, Bubbles, Cancelable, Gamepad*); + GamepadEvent(const AtomicString&, const GamepadEventInit*); ~GamepadEvent() override; Gamepad* getGamepad() const { return gamepad_.Get(); } @@ -33,10 +37,6 @@ void Trace(blink::Visitor*) override; - protected: - GamepadEvent(const AtomicString& type, Bubbles, Cancelable, Gamepad*); - GamepadEvent(const AtomicString&, const GamepadEventInit*); - private: Member<Gamepad> gamepad_; };
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.cc b/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.cc index 4665395e..723626d 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.cc +++ b/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.cc
@@ -53,7 +53,7 @@ // static GamepadHapticActuator* GamepadHapticActuator::Create(int pad_index) { - return new GamepadHapticActuator( + return MakeGarbageCollected<GamepadHapticActuator>( pad_index, device::GamepadHapticActuatorType::kDualRumble); }
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.h b/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.h index 5bba834..57fe146 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.h +++ b/third_party/blink/renderer/modules/gamepad/gamepad_haptic_actuator.h
@@ -22,6 +22,8 @@ public: static GamepadHapticActuator* Create(int pad_index); + + GamepadHapticActuator(int pad_index, device::GamepadHapticActuatorType); ~GamepadHapticActuator() override; const String& type() const { return type_; } @@ -36,8 +38,6 @@ void Trace(blink::Visitor*) override; private: - GamepadHapticActuator(int pad_index, device::GamepadHapticActuatorType); - void OnPlayEffectCompleted(ScriptPromiseResolver*, device::mojom::GamepadHapticsResult); void OnResetCompleted(ScriptPromiseResolver*,
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_list.h b/third_party/blink/renderer/modules/gamepad/gamepad_list.h index f903813..631abec 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_list.h +++ b/third_party/blink/renderer/modules/gamepad/gamepad_list.h
@@ -37,7 +37,9 @@ DEFINE_WRAPPERTYPEINFO(); public: - static GamepadList* Create() { return new GamepadList(); } + static GamepadList* Create() { return MakeGarbageCollected<GamepadList>(); } + + GamepadList(); void Set(unsigned index, Gamepad*); Gamepad* item(unsigned index); @@ -46,7 +48,6 @@ void Trace(blink::Visitor*) override; private: - GamepadList(); Member<Gamepad> items_[device::Gamepads::kItemsLengthCap]; };
diff --git a/third_party/blink/renderer/modules/gamepad/gamepad_pose.h b/third_party/blink/renderer/modules/gamepad/gamepad_pose.h index 2247967..4bf4f6c4 100644 --- a/third_party/blink/renderer/modules/gamepad/gamepad_pose.h +++ b/third_party/blink/renderer/modules/gamepad/gamepad_pose.h
@@ -17,7 +17,9 @@ DEFINE_WRAPPERTYPEINFO(); public: - static GamepadPose* Create() { return new GamepadPose(); } + static GamepadPose* Create() { return MakeGarbageCollected<GamepadPose>(); } + + GamepadPose(); bool hasOrientation() const { return has_orientation_; } bool hasPosition() const { return has_position_; } @@ -34,8 +36,6 @@ void Trace(blink::Visitor*) override; private: - GamepadPose(); - bool has_orientation_; bool has_position_;
diff --git a/third_party/blink/renderer/modules/geolocation/geo_notifier.h b/third_party/blink/renderer/modules/geolocation/geo_notifier.h index e58257f..de5c1b8 100644 --- a/third_party/blink/renderer/modules/geolocation/geo_notifier.h +++ b/third_party/blink/renderer/modules/geolocation/geo_notifier.h
@@ -27,9 +27,14 @@ V8PositionCallback* position_callback, V8PositionErrorCallback* position_error_callback, const PositionOptions* options) { - return new GeoNotifier(geolocation, position_callback, - position_error_callback, options); + return MakeGarbageCollected<GeoNotifier>(geolocation, position_callback, + position_error_callback, options); } + + GeoNotifier(Geolocation*, + V8PositionCallback*, + V8PositionErrorCallback*, + const PositionOptions*); ~GeoNotifier() = default; void Trace(blink::Visitor*); const char* NameInHeapSnapshot() const override { return "GeoNotifier"; } @@ -64,9 +69,15 @@ scoped_refptr<base::SingleThreadTaskRunner> web_task_runner, GeoNotifier* notifier, void (GeoNotifier::*member_func)(TimerBase*)) { - return new Timer(web_task_runner, notifier, member_func); + return MakeGarbageCollected<Timer>(web_task_runner, notifier, + member_func); } + explicit Timer(scoped_refptr<base::SingleThreadTaskRunner> web_task_runner, + GeoNotifier* notifier, + void (GeoNotifier::*member_func)(TimerBase*)) + : timer_(web_task_runner, notifier, member_func), notifier_(notifier) {} + void Trace(blink::Visitor*); // TimerBase-compatible API @@ -75,20 +86,10 @@ bool IsActive() const { return timer_.IsActive(); } private: - explicit Timer(scoped_refptr<base::SingleThreadTaskRunner> web_task_runner, - GeoNotifier* notifier, - void (GeoNotifier::*member_func)(TimerBase*)) - : timer_(web_task_runner, notifier, member_func), notifier_(notifier) {} - TaskRunnerTimer<GeoNotifier> timer_; Member<GeoNotifier> notifier_; }; - GeoNotifier(Geolocation*, - V8PositionCallback*, - V8PositionErrorCallback*, - const PositionOptions*); - // Runs the error callback if there is a fatal error. Otherwise, if a // cached position must be used, registers itself for receiving one. // Otherwise, the notifier has expired, and its error callback is run.
diff --git a/third_party/blink/renderer/modules/geolocation/geolocation.cc b/third_party/blink/renderer/modules/geolocation/geolocation.cc index 68a94ef2..dff776ce 100644 --- a/third_party/blink/renderer/modules/geolocation/geolocation.cc +++ b/third_party/blink/renderer/modules/geolocation/geolocation.cc
@@ -99,14 +99,14 @@ } // namespace Geolocation* Geolocation::Create(ExecutionContext* context) { - Geolocation* geolocation = new Geolocation(context); + Geolocation* geolocation = MakeGarbageCollected<Geolocation>(context); return geolocation; } Geolocation::Geolocation(ExecutionContext* context) : ContextLifecycleObserver(context), PageVisibilityObserver(GetDocument()->GetPage()), - watchers_(new GeolocationWatchers()) {} + watchers_(MakeGarbageCollected<GeolocationWatchers>()) {} Geolocation::~Geolocation() = default;
diff --git a/third_party/blink/renderer/modules/geolocation/geolocation.h b/third_party/blink/renderer/modules/geolocation/geolocation.h index 5ae94fb..50f7b26d 100644 --- a/third_party/blink/renderer/modules/geolocation/geolocation.h +++ b/third_party/blink/renderer/modules/geolocation/geolocation.h
@@ -60,6 +60,8 @@ public: static Geolocation* Create(ExecutionContext*); + + explicit Geolocation(ExecutionContext*); ~Geolocation() override; void Trace(blink::Visitor*) override; @@ -153,8 +155,6 @@ void ClearWithoutTimerCheck() { BaseClass::clear(); } }; - explicit Geolocation(ExecutionContext*); - bool HasListeners() const { return !one_shots_.IsEmpty() || !watchers_->IsEmpty(); }
diff --git a/third_party/blink/renderer/modules/geolocation/geolocation_error.h b/third_party/blink/renderer/modules/geolocation/geolocation_error.h index 1601dfe..da1cfdf 100644 --- a/third_party/blink/renderer/modules/geolocation/geolocation_error.h +++ b/third_party/blink/renderer/modules/geolocation/geolocation_error.h
@@ -35,17 +35,18 @@ enum ErrorCode { kPermissionDenied, kPositionUnavailable }; static GeolocationError* Create(ErrorCode code, const String& message) { - return new GeolocationError(code, message); + return MakeGarbageCollected<GeolocationError>(code, message); } + + GeolocationError(ErrorCode code, const String& message) + : code_(code), message_(message) {} + void Trace(blink::Visitor* visitor) {} ErrorCode Code() const { return code_; } const String& Message() const { return message_; } private: - GeolocationError(ErrorCode code, const String& message) - : code_(code), message_(message) {} - ErrorCode code_; String message_; };
diff --git a/third_party/blink/renderer/modules/geolocation/geoposition.h b/third_party/blink/renderer/modules/geolocation/geoposition.h index cbb5c44e..02b867b 100644 --- a/third_party/blink/renderer/modules/geolocation/geoposition.h +++ b/third_party/blink/renderer/modules/geolocation/geoposition.h
@@ -40,7 +40,12 @@ public: static Geoposition* Create(Coordinates* coordinates, DOMTimeStamp timestamp) { - return new Geoposition(coordinates, timestamp); + return MakeGarbageCollected<Geoposition>(coordinates, timestamp); + } + + Geoposition(Coordinates* coordinates, DOMTimeStamp timestamp) + : coordinates_(coordinates), timestamp_(timestamp) { + DCHECK(coordinates_); } void Trace(blink::Visitor* visitor) override { @@ -52,11 +57,6 @@ Coordinates* coords() const { return coordinates_; } private: - Geoposition(Coordinates* coordinates, DOMTimeStamp timestamp) - : coordinates_(coordinates), timestamp_(timestamp) { - DCHECK(coordinates_); - } - Member<Coordinates> coordinates_; DOMTimeStamp timestamp_; };
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_any.cc b/third_party/blink/renderer/modules/indexeddb/idb_any.cc index 6b1c2550..777f8d0a 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_any.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_any.cc
@@ -36,11 +36,11 @@ namespace blink { IDBAny* IDBAny::CreateUndefined() { - return new IDBAny(kUndefinedType); + return MakeGarbageCollected<IDBAny>(kUndefinedType); } IDBAny* IDBAny::CreateNull() { - return new IDBAny(kNullType); + return MakeGarbageCollected<IDBAny>(kNullType); } IDBAny::IDBAny(Type type) : type_(type) {
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_any.h b/third_party/blink/renderer/modules/indexeddb/idb_any.h index 4c2cbf5..38dc88f 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_any.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_any.h
@@ -59,24 +59,23 @@ static IDBAny* CreateNull(); template <typename T> static IDBAny* Create(T* idb_object) { - return new IDBAny(idb_object); + return MakeGarbageCollected<IDBAny>(idb_object); } static IDBAny* Create(DOMStringList* dom_string_list) { - return new IDBAny(dom_string_list); + return MakeGarbageCollected<IDBAny>(dom_string_list); } - static IDBAny* Create(int64_t value) { return new IDBAny(value); } + static IDBAny* Create(int64_t value) { + return MakeGarbageCollected<IDBAny>(value); + } static IDBAny* Create(std::unique_ptr<IDBKey> key) { - return new IDBAny(std::move(key)); + return MakeGarbageCollected<IDBAny>(std::move(key)); } static IDBAny* Create(std::unique_ptr<IDBValue> value) { - return new IDBAny(std::move(value)); + return MakeGarbageCollected<IDBAny>(std::move(value)); } static IDBAny* Create(Vector<std::unique_ptr<IDBValue>> values) { - return new IDBAny(std::move(values)); + return MakeGarbageCollected<IDBAny>(std::move(values)); } - ~IDBAny(); - void Trace(blink::Visitor*); - void ContextWillBeDestroyed(); enum Type { kUndefinedType = 0, @@ -91,6 +90,19 @@ kIDBValueArrayType }; + explicit IDBAny(Type); + explicit IDBAny(DOMStringList*); + explicit IDBAny(IDBCursor*); + explicit IDBAny(IDBDatabase*); + explicit IDBAny(std::unique_ptr<IDBKey>); + explicit IDBAny(Vector<std::unique_ptr<IDBValue>>); + explicit IDBAny(std::unique_ptr<IDBValue>); + explicit IDBAny(int64_t); + ~IDBAny(); + + void Trace(blink::Visitor*); + void ContextWillBeDestroyed(); + Type GetType() const { return type_; } // Use type() to figure out which one of these you're allowed to call. DOMStringList* DomStringList() const; @@ -103,15 +115,6 @@ const IDBKey* Key() const; private: - explicit IDBAny(Type); - explicit IDBAny(DOMStringList*); - explicit IDBAny(IDBCursor*); - explicit IDBAny(IDBDatabase*); - explicit IDBAny(std::unique_ptr<IDBKey>); - explicit IDBAny(Vector<std::unique_ptr<IDBValue>>); - explicit IDBAny(std::unique_ptr<IDBValue>); - explicit IDBAny(int64_t); - const Type type_; // Only one of the following should ever be in use at any given time.
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_cursor.cc b/third_party/blink/renderer/modules/indexeddb/idb_cursor.cc index 0b954b60..07bad6a 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_cursor.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_cursor.cc
@@ -52,8 +52,8 @@ IDBRequest* request, const Source& source, IDBTransaction* transaction) { - return new IDBCursor(std::move(backend), direction, request, source, - transaction); + return MakeGarbageCollected<IDBCursor>(std::move(backend), direction, request, + source, transaction); } IDBCursor::IDBCursor(std::unique_ptr<WebIDBCursor> backend,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_cursor.h b/third_party/blink/renderer/modules/indexeddb/idb_cursor.h index d93ecb34..5c3306d 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_cursor.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_cursor.h
@@ -58,7 +58,14 @@ IDBRequest*, const Source&, IDBTransaction*); + + IDBCursor(std::unique_ptr<WebIDBCursor>, + mojom::IDBCursorDirection, + IDBRequest*, + const Source&, + IDBTransaction*); ~IDBCursor() override; + void Trace(blink::Visitor*) override; void ContextWillBeDestroyed() { backend_.reset(); } @@ -101,13 +108,6 @@ virtual bool IsKeyCursor() const { return true; } virtual bool IsCursorWithValue() const { return false; } - protected: - IDBCursor(std::unique_ptr<WebIDBCursor>, - mojom::IDBCursorDirection, - IDBRequest*, - const Source&, - IDBTransaction*); - private: IDBObjectStore* EffectiveObjectStore() const;
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.cc b/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.cc index 21e3960..b9bad78 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.cc
@@ -38,8 +38,8 @@ IDBRequest* request, const Source& source, IDBTransaction* transaction) { - return new IDBCursorWithValue(std::move(backend), direction, request, source, - transaction); + return MakeGarbageCollected<IDBCursorWithValue>(std::move(backend), direction, + request, source, transaction); } IDBCursorWithValue::IDBCursorWithValue(std::unique_ptr<WebIDBCursor> backend,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.h b/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.h index 71a6538..4c0deb78 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_cursor_with_value.h
@@ -46,6 +46,12 @@ IDBRequest*, const Source&, IDBTransaction*); + + IDBCursorWithValue(std::unique_ptr<WebIDBCursor>, + mojom::IDBCursorDirection, + IDBRequest*, + const Source&, + IDBTransaction*); ~IDBCursorWithValue() override; // The value attribute defined in the IDL is simply implemented in IDBCursor @@ -54,13 +60,6 @@ bool IsKeyCursor() const override { return false; } bool IsCursorWithValue() const override { return true; } - - private: - IDBCursorWithValue(std::unique_ptr<WebIDBCursor>, - mojom::IDBCursorDirection, - IDBRequest*, - const Source&, - IDBTransaction*); }; DEFINE_TYPE_CASTS(IDBCursorWithValue,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_database.cc b/third_party/blink/renderer/modules/indexeddb/idb_database.cc index 7d04f49..c8764dc 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_database.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_database.cc
@@ -99,7 +99,8 @@ std::unique_ptr<WebIDBDatabase> database, IDBDatabaseCallbacks* callbacks, v8::Isolate* isolate) { - return new IDBDatabase(context, std::move(database), callbacks, isolate); + return MakeGarbageCollected<IDBDatabase>(context, std::move(database), + callbacks, isolate); } IDBDatabase::IDBDatabase(ExecutionContext* context,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_database.h b/third_party/blink/renderer/modules/indexeddb/idb_database.h index cdd36a2..1e2f207 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_database.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_database.h
@@ -68,7 +68,13 @@ std::unique_ptr<WebIDBDatabase>, IDBDatabaseCallbacks*, v8::Isolate*); + + IDBDatabase(ExecutionContext*, + std::unique_ptr<WebIDBDatabase>, + IDBDatabaseCallbacks*, + v8::Isolate*); ~IDBDatabase() override; + void Trace(blink::Visitor*) override; // Overwrites the database metadata, including object store and index @@ -174,11 +180,6 @@ DispatchEventResult DispatchEventInternal(Event&) override; private: - IDBDatabase(ExecutionContext*, - std::unique_ptr<WebIDBDatabase>, - IDBDatabaseCallbacks*, - v8::Isolate*); - IDBObjectStore* createObjectStore(const String& name, const IDBKeyPath&, bool auto_increment,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.cc b/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.cc index f607a91..7fa1f036 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.cc
@@ -33,7 +33,7 @@ namespace blink { IDBDatabaseCallbacks* IDBDatabaseCallbacks::Create() { - return new IDBDatabaseCallbacks(); + return MakeGarbageCollected<IDBDatabaseCallbacks>(); } IDBDatabaseCallbacks::IDBDatabaseCallbacks() : database_(nullptr) {}
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.h b/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.h index d9d36328..2a4a0c3 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_database_callbacks.h
@@ -43,6 +43,8 @@ : public GarbageCollectedFinalized<IDBDatabaseCallbacks> { public: static IDBDatabaseCallbacks* Create(); + + IDBDatabaseCallbacks(); virtual ~IDBDatabaseCallbacks(); void Trace(blink::Visitor*); @@ -65,10 +67,6 @@ void DetachWebCallbacks(); void WebCallbacksDestroyed(); - protected: - // Exposed to subclasses for unit tests. - IDBDatabaseCallbacks(); - private: // The initial IDBOpenDBRequest, final IDBDatabase, and/or // WebIDBDatabaseCallbacks have strong references to an IDBDatabaseCallbacks
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_factory.h b/third_party/blink/renderer/modules/indexeddb/idb_factory.h index 3ff9b1c..68b8234 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_factory.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_factory.h
@@ -46,12 +46,15 @@ DEFINE_WRAPPERTYPEINFO(); public: - static IDBFactory* Create() { return new IDBFactory(); } + static IDBFactory* Create() { return MakeGarbageCollected<IDBFactory>(); } static IDBFactory* CreateForTest( std::unique_ptr<WebIDBFactory> web_idb_factory) { - return new IDBFactory(std::move(web_idb_factory)); + return MakeGarbageCollected<IDBFactory>(std::move(web_idb_factory)); } + IDBFactory(); + IDBFactory(std::unique_ptr<WebIDBFactory>); + // Implement the IDBFactory IDL IDBOpenDBRequest* open(ScriptState*, const String& name, ExceptionState&); IDBOpenDBRequest* open(ScriptState*, @@ -75,9 +78,6 @@ ScriptPromise GetDatabaseInfo(ScriptState*, ExceptionState&); private: - IDBFactory(); - IDBFactory(std::unique_ptr<WebIDBFactory>); - WebIDBFactory* GetFactory(); IDBOpenDBRequest* OpenInternal(ScriptState*,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_index.h b/third_party/blink/renderer/modules/indexeddb/idb_index.h index 46b6f72..20e69c4 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_index.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_index.h
@@ -51,9 +51,13 @@ static IDBIndex* Create(scoped_refptr<IDBIndexMetadata> metadata, IDBObjectStore* object_store, IDBTransaction* transaction) { - return new IDBIndex(std::move(metadata), object_store, transaction); + return MakeGarbageCollected<IDBIndex>(std::move(metadata), object_store, + transaction); } + + IDBIndex(scoped_refptr<IDBIndexMetadata>, IDBObjectStore*, IDBTransaction*); ~IDBIndex() override; + void Trace(blink::Visitor*) override; // Implement the IDL @@ -120,8 +124,6 @@ WebIDBDatabase* BackendDB() const; private: - IDBIndex(scoped_refptr<IDBIndexMetadata>, IDBObjectStore*, IDBTransaction*); - const IDBIndexMetadata& Metadata() const { return *metadata_; } IDBRequest* GetInternal(ScriptState*,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_key_range.cc b/third_party/blink/renderer/modules/indexeddb/idb_key_range.cc index 3554ee3..193c0cf 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_key_range.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_key_range.cc
@@ -56,8 +56,9 @@ } IDBKey* const upper_compressed = key.get(); - return new IDBKeyRange(std::move(key), upper_compressed, nullptr, - kLowerBoundClosed, kUpperBoundClosed); + return MakeGarbageCollected<IDBKeyRange>(std::move(key), upper_compressed, + nullptr, kLowerBoundClosed, + kUpperBoundClosed); } IDBKeyRange::IDBKeyRange(std::unique_ptr<IDBKey> lower, @@ -95,8 +96,9 @@ } IDBKey* const upper_compressed = key.get(); - return new IDBKeyRange(std::move(key), upper_compressed, nullptr, - kLowerBoundClosed, kUpperBoundClosed); + return MakeGarbageCollected<IDBKeyRange>(std::move(key), upper_compressed, + nullptr, kLowerBoundClosed, + kUpperBoundClosed); } IDBKeyRange* IDBKeyRange::only(ScriptState* script_state, @@ -114,8 +116,9 @@ } IDBKey* const upper_compressed = key.get(); - return new IDBKeyRange(std::move(key), upper_compressed, nullptr, - kLowerBoundClosed, kUpperBoundClosed); + return MakeGarbageCollected<IDBKeyRange>(std::move(key), upper_compressed, + nullptr, kLowerBoundClosed, + kUpperBoundClosed); } IDBKeyRange* IDBKeyRange::lowerBound(ScriptState* script_state,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_key_range.h b/third_party/blink/renderer/modules/indexeddb/idb_key_range.h index e259981..fb8132b9 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_key_range.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_key_range.h
@@ -49,10 +49,17 @@ LowerBoundType lower_type, UpperBoundType upper_type) { IDBKey* upper_compressed = upper.get(); - return new IDBKeyRange(std::move(lower), upper_compressed, std::move(upper), - lower_type, upper_type); + return MakeGarbageCollected<IDBKeyRange>(std::move(lower), upper_compressed, + std::move(upper), lower_type, + upper_type); } + IDBKeyRange(std::unique_ptr<IDBKey> lower, + IDBKey* upper, + std::unique_ptr<IDBKey> upper_if_distinct, + LowerBoundType lower_type, + UpperBoundType upper_type); + // Null if the script value is null or undefined, the range if it is one, // otherwise tries to convert to a key and throws if it fails. static IDBKeyRange* FromScriptValue(ExecutionContext*, @@ -116,12 +123,6 @@ // are not considered compressed, as the left key is different from the right // key. - IDBKeyRange(std::unique_ptr<IDBKey> lower, - IDBKey* upper, - std::unique_ptr<IDBKey> upper_if_distinct, - LowerBoundType lower_type, - UpperBoundType upper_type); - // Owns the range's lower key, and possibly the upper key. std::unique_ptr<IDBKey> lower_;
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_object_store.h b/third_party/blink/renderer/modules/indexeddb/idb_object_store.h index 664c4a7..9a59516 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_object_store.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_object_store.h
@@ -53,8 +53,11 @@ public: static IDBObjectStore* Create(scoped_refptr<IDBObjectStoreMetadata> metadata, IDBTransaction* transaction) { - return new IDBObjectStore(std::move(metadata), transaction); + return MakeGarbageCollected<IDBObjectStore>(std::move(metadata), + transaction); } + + IDBObjectStore(scoped_refptr<IDBObjectStoreMetadata>, IDBTransaction*); ~IDBObjectStore() override = default; void Trace(blink::Visitor*) override; @@ -187,8 +190,6 @@ private: using IDBIndexMap = HeapHashMap<String, Member<IDBIndex>>; - IDBObjectStore(scoped_refptr<IDBObjectStoreMetadata>, IDBTransaction*); - IDBIndex* createIndex(ScriptState*, const String& name, const IDBKeyPath&,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_observation.cc b/third_party/blink/renderer/modules/indexeddb/idb_observation.cc index a448acf9..1c67cf4 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_observation.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_observation.cc
@@ -68,7 +68,7 @@ IDBObservation* IDBObservation::Create(WebIDBObservation observation, v8::Isolate* isolate) { - return new IDBObservation(std::move(observation), isolate); + return MakeGarbageCollected<IDBObservation>(std::move(observation), isolate); } IDBObservation::IDBObservation(WebIDBObservation observation,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_observation.h b/third_party/blink/renderer/modules/indexeddb/idb_observation.h index 0f6d57c..339043e 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_observation.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_observation.h
@@ -29,6 +29,7 @@ // Consumes the WebIDBObservation. static IDBObservation* Create(WebIDBObservation, v8::Isolate*); + IDBObservation(WebIDBObservation, v8::Isolate*); ~IDBObservation() override; void Trace(blink::Visitor*) override; @@ -39,8 +40,6 @@ const String& type() const; private: - IDBObservation(WebIDBObservation, v8::Isolate*); - Member<IDBKeyRange> key_range_; Member<IDBAny> value_; const mojom::IDBOperationType operation_type_;
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_observer.cc b/third_party/blink/renderer/modules/indexeddb/idb_observer.cc index 2922bbb..fb4c061 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_observer.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_observer.cc
@@ -19,7 +19,7 @@ namespace blink { IDBObserver* IDBObserver::Create(V8IDBObserverCallback* callback) { - return new IDBObserver(callback); + return MakeGarbageCollected<IDBObserver>(callback); } IDBObserver::IDBObserver(V8IDBObserverCallback* callback)
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_observer.h b/third_party/blink/renderer/modules/indexeddb/idb_observer.h index f914754..85bdb35 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_observer.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_observer.h
@@ -28,6 +28,8 @@ V8IDBObserverCallback* Callback() { return callback_; } + explicit IDBObserver(V8IDBObserverCallback*); + // Implement the IDBObserver IDL. void observe(IDBDatabase*, IDBTransaction*, @@ -38,8 +40,6 @@ void Trace(blink::Visitor*) override; private: - explicit IDBObserver(V8IDBObserverCallback*); - TraceWrapperMember<V8IDBObserverCallback> callback_; HeapHashMap<int32_t, WeakMember<IDBDatabase>> observer_ids_; };
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.cc b/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.cc index 1e5ceec..af876c8 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.cc
@@ -36,8 +36,9 @@ const HeapVector<Member<IDBObservation>>& observations, const WebVector<int32_t>& observation_indices) { DCHECK_EQ(web_observations.size(), observations.size()); - return new IDBObserverChanges(database, transaction, web_observations, - observations, observation_indices); + return MakeGarbageCollected<IDBObserverChanges>( + database, transaction, web_observations, observations, + observation_indices); } IDBObserverChanges::IDBObserverChanges(
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.h b/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.h index 1c48bcf0..53bc5dee 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_observer_changes.h
@@ -28,6 +28,13 @@ const HeapVector<Member<IDBObservation>>& observations, const WebVector<int32_t>& observation_indices); + IDBObserverChanges(IDBDatabase*, + IDBTransaction*, + + const WebVector<WebIDBObservation>& web_observations, + const HeapVector<Member<IDBObservation>>& observations, + const WebVector<int32_t>& observation_indices); + void Trace(blink::Visitor*) override; // Implement IDL @@ -36,13 +43,6 @@ ScriptValue records(ScriptState*); private: - IDBObserverChanges(IDBDatabase*, - IDBTransaction*, - - const WebVector<WebIDBObservation>& web_observations, - const HeapVector<Member<IDBObservation>>& observations, - const WebVector<int32_t>& observation_indices); - void ExtractChanges(const WebVector<WebIDBObservation>& web_observations, const HeapVector<Member<IDBObservation>>& observations, const WebVector<int32_t>& observation_indices);
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc b/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc index ba91424..f8a81ea 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.cc
@@ -45,7 +45,7 @@ int64_t transaction_id, int64_t version, IDBRequest::AsyncTraceState metrics) { - IDBOpenDBRequest* request = new IDBOpenDBRequest( + IDBOpenDBRequest* request = MakeGarbageCollected<IDBOpenDBRequest>( script_state, callbacks, transaction_id, version, std::move(metrics)); request->PauseIfNeeded(); return request;
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.h b/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.h index 0c333ecb..7752ece4 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_open_db_request.h
@@ -44,7 +44,14 @@ int64_t transaction_id, int64_t version, IDBRequest::AsyncTraceState metrics); + + IDBOpenDBRequest(ScriptState*, + IDBDatabaseCallbacks*, + int64_t transaction_id, + int64_t version, + IDBRequest::AsyncTraceState metrics); ~IDBOpenDBRequest() override; + void Trace(blink::Visitor*) override; void EnqueueBlocked(int64_t existing_version) override; @@ -74,12 +81,6 @@ DispatchEventResult DispatchEventInternal(Event&) override; private: - IDBOpenDBRequest(ScriptState*, - IDBDatabaseCallbacks*, - int64_t transaction_id, - int64_t version, - IDBRequest::AsyncTraceState metrics); - Member<IDBDatabaseCallbacks> database_callbacks_; const int64_t transaction_id_; int64_t version_;
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_request.cc b/third_party/blink/renderer/modules/indexeddb/idb_request.cc index f69bbe4e..a457f84 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_request.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_request.cc
@@ -120,8 +120,8 @@ const Source& source, IDBTransaction* transaction, IDBRequest::AsyncTraceState metrics) { - IDBRequest* request = - new IDBRequest(script_state, source, transaction, std::move(metrics)); + IDBRequest* request = MakeGarbageCollected<IDBRequest>( + script_state, source, transaction, std::move(metrics)); request->PauseIfNeeded(); // Requests associated with IDBFactory (open/deleteDatabase/getDatabaseNames) // do not have an associated transaction.
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_request.h b/third_party/blink/renderer/modules/indexeddb/idb_request.h index 0cf8d1d..4822690 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_request.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_request.h
@@ -176,7 +176,10 @@ const Source&, IDBTransaction*, AsyncTraceState); + + IDBRequest(ScriptState*, const Source&, IDBTransaction*, AsyncTraceState); ~IDBRequest() override; + void Trace(blink::Visitor*) override; v8::Isolate* GetIsolate() const { return isolate_; } @@ -334,7 +337,6 @@ } protected: - IDBRequest(ScriptState*, const Source&, IDBTransaction*, AsyncTraceState); void EnqueueEvent(Event*); virtual bool ShouldEnqueueEvent() const; void EnqueueResultInternal(IDBAny*);
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_transaction.cc b/third_party/blink/renderer/modules/indexeddb/idb_transaction.cc index 19e4c6a..f04b84cc 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_transaction.cc +++ b/third_party/blink/renderer/modules/indexeddb/idb_transaction.cc
@@ -55,7 +55,7 @@ DCHECK(!scope.IsEmpty()) << "Observer transactions must operate on a " "well-defined set of stores"; IDBTransaction* transaction = - new IDBTransaction(execution_context, id, scope, db); + MakeGarbageCollected<IDBTransaction>(execution_context, id, scope, db); return transaction; } @@ -68,7 +68,8 @@ DCHECK_NE(mode, mojom::IDBTransactionMode::VersionChange); DCHECK(!scope.IsEmpty()) << "Non-version transactions should operate on a " "well-defined set of stores"; - return new IDBTransaction(script_state, id, scope, mode, db); + return MakeGarbageCollected<IDBTransaction>(script_state, id, scope, mode, + db); } IDBTransaction* IDBTransaction::CreateVersionChange( @@ -77,8 +78,8 @@ IDBDatabase* db, IDBOpenDBRequest* open_db_request, const IDBDatabaseMetadata& old_metadata) { - return new IDBTransaction(execution_context, id, db, open_db_request, - old_metadata); + return MakeGarbageCollected<IDBTransaction>(execution_context, id, db, + open_db_request, old_metadata); } IDBTransaction::IDBTransaction(ExecutionContext* execution_context,
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_transaction.h b/third_party/blink/renderer/modules/indexeddb/idb_transaction.h index 29fa50b4..f589fe3 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_transaction.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_transaction.h
@@ -83,7 +83,26 @@ IDBDatabase*, IDBOpenDBRequest*, const IDBDatabaseMetadata& old_metadata); + + // For observer transactions. + IDBTransaction(ExecutionContext*, + int64_t, + const HashSet<String>& scope, + IDBDatabase*); + // For non-upgrade transactions. + IDBTransaction(ScriptState*, + int64_t, + const HashSet<String>& scope, + mojom::IDBTransactionMode, + IDBDatabase*); + // For upgrade transactions. + IDBTransaction(ExecutionContext*, + int64_t, + IDBDatabase*, + IDBOpenDBRequest*, + const IDBDatabaseMetadata&); ~IDBTransaction() override; + void Trace(blink::Visitor*) override; static mojom::IDBTransactionMode StringToMode(const String&); @@ -169,26 +188,6 @@ private: using IDBObjectStoreMap = HeapHashMap<String, Member<IDBObjectStore>>; - // For observer transactions. - IDBTransaction(ExecutionContext*, - int64_t, - const HashSet<String>& scope, - IDBDatabase*); - - // For non-upgrade transactions. - IDBTransaction(ScriptState*, - int64_t, - const HashSet<String>& scope, - mojom::IDBTransactionMode, - IDBDatabase*); - - // For upgrade transactions. - IDBTransaction(ExecutionContext*, - int64_t, - IDBDatabase*, - IDBOpenDBRequest*, - const IDBDatabaseMetadata&); - void EnqueueEvent(Event*); // Called when a transaction is aborted.
diff --git a/third_party/blink/renderer/modules/indexeddb/idb_version_change_event.h b/third_party/blink/renderer/modules/indexeddb/idb_version_change_event.h index 5b8fc7cd..70c5e1d3 100644 --- a/third_party/blink/renderer/modules/indexeddb/idb_version_change_event.h +++ b/third_party/blink/renderer/modules/indexeddb/idb_version_change_event.h
@@ -42,22 +42,33 @@ DEFINE_WRAPPERTYPEINFO(); public: - static IDBVersionChangeEvent* Create() { return new IDBVersionChangeEvent(); } + static IDBVersionChangeEvent* Create() { + return MakeGarbageCollected<IDBVersionChangeEvent>(); + } static IDBVersionChangeEvent* Create( const AtomicString& event_type, unsigned long long old_version, const base::Optional<unsigned long long>& new_version, mojom::IDBDataLoss data_loss = mojom::IDBDataLoss::None, const String& data_loss_message = String()) { - return new IDBVersionChangeEvent(event_type, old_version, new_version, - data_loss, data_loss_message); + return MakeGarbageCollected<IDBVersionChangeEvent>( + event_type, old_version, new_version, data_loss, data_loss_message); } static IDBVersionChangeEvent* Create( const AtomicString& event_type, const IDBVersionChangeEventInit* initializer) { - return new IDBVersionChangeEvent(event_type, initializer); + return MakeGarbageCollected<IDBVersionChangeEvent>(event_type, initializer); } + IDBVersionChangeEvent(); + IDBVersionChangeEvent(const AtomicString& event_type, + unsigned long long old_version, + const base::Optional<unsigned long long>& new_version, + mojom::IDBDataLoss, + const String& data_loss); + IDBVersionChangeEvent(const AtomicString& event_type, + const IDBVersionChangeEventInit*); + unsigned long long oldVersion() const { return old_version_; } unsigned long long newVersion(bool& is_null) const; @@ -69,15 +80,6 @@ void Trace(blink::Visitor*) override; private: - IDBVersionChangeEvent(); - IDBVersionChangeEvent(const AtomicString& event_type, - unsigned long long old_version, - const base::Optional<unsigned long long>& new_version, - mojom::IDBDataLoss, - const String& data_loss); - IDBVersionChangeEvent(const AtomicString& event_type, - const IDBVersionChangeEventInit*); - unsigned long long old_version_; base::Optional<unsigned long long> new_version_; mojom::IDBDataLoss data_loss_;
diff --git a/third_party/blink/renderer/modules/indexeddb/indexed_db_client.cc b/third_party/blink/renderer/modules/indexeddb/indexed_db_client.cc index 3d1313b..f2f3785 100644 --- a/third_party/blink/renderer/modules/indexeddb/indexed_db_client.cc +++ b/third_party/blink/renderer/modules/indexeddb/indexed_db_client.cc
@@ -18,11 +18,11 @@ namespace blink { IndexedDBClient* IndexedDBClient::Create(LocalFrame& frame) { - return new IndexedDBClient(frame); + return MakeGarbageCollected<IndexedDBClient>(frame); } IndexedDBClient* IndexedDBClient::Create(WorkerClients& worker_clients) { - return new IndexedDBClient(worker_clients); + return MakeGarbageCollected<IndexedDBClient>(worker_clients); } IndexedDBClient::IndexedDBClient(LocalFrame& frame)
diff --git a/third_party/blink/renderer/modules/indexeddb/indexed_db_client.h b/third_party/blink/renderer/modules/indexeddb/indexed_db_client.h index 42ef27c2..296e954 100644 --- a/third_party/blink/renderer/modules/indexeddb/indexed_db_client.h +++ b/third_party/blink/renderer/modules/indexeddb/indexed_db_client.h
@@ -55,16 +55,15 @@ static IndexedDBClient* Create(LocalFrame&); static IndexedDBClient* Create(WorkerClients&); + explicit IndexedDBClient(LocalFrame&); + explicit IndexedDBClient(WorkerClients&); + void Trace(blink::Visitor*) override; const char* NameInHeapSnapshot() const override { return "IndexedDBClient"; } bool AllowIndexedDB(ExecutionContext*); static IndexedDBClient* From(ExecutionContext*); - - private: - explicit IndexedDBClient(LocalFrame&); - explicit IndexedDBClient(WorkerClients&); }; void ProvideIndexedDBClientTo(LocalFrame&, IndexedDBClient*);
diff --git a/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc b/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc index 6428c78..5cf1906 100644 --- a/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc +++ b/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc
@@ -861,9 +861,14 @@ public: static DeleteObjectStoreEntriesListener* Create( std::unique_ptr<DeleteObjectStoreEntriesCallback> request_callback) { - return new DeleteObjectStoreEntriesListener(std::move(request_callback)); + return MakeGarbageCollected<DeleteObjectStoreEntriesListener>( + std::move(request_callback)); } + DeleteObjectStoreEntriesListener( + std::unique_ptr<DeleteObjectStoreEntriesCallback> request_callback) + : EventListener(EventListener::kCPPEventListenerType), + request_callback_(std::move(request_callback)) {} ~DeleteObjectStoreEntriesListener() override = default; bool operator==(const EventListener& other) const override { @@ -881,11 +886,6 @@ } private: - DeleteObjectStoreEntriesListener( - std::unique_ptr<DeleteObjectStoreEntriesCallback> request_callback) - : EventListener(EventListener::kCPPEventListenerType), - request_callback_(std::move(request_callback)) {} - std::unique_ptr<DeleteObjectStoreEntriesCallback> request_callback_; };
diff --git a/third_party/blink/renderer/modules/indexeddb/web_idb_database_impl.cc b/third_party/blink/renderer/modules/indexeddb/web_idb_database_impl.cc index 798ab1dc..c41c23e 100644 --- a/third_party/blink/renderer/modules/indexeddb/web_idb_database_impl.cc +++ b/third_party/blink/renderer/modules/indexeddb/web_idb_database_impl.cc
@@ -79,7 +79,8 @@ static_assert(kIDBOperationTypeCount < sizeof(uint32_t) * CHAR_BIT, "IDBOperationTypeCount exceeds size of uint32_t"); database_->AddObserver(transaction_id, observer_id, include_transaction, - no_records, values, operation_types.to_ulong()); + no_records, values, + static_cast<uint32_t>(operation_types.to_ulong())); } void WebIDBDatabaseImpl::RemoveObservers(const Vector<int32_t>& observer_ids) {
diff --git a/third_party/blink/renderer/modules/installedapp/installed_app_controller.cc b/third_party/blink/renderer/modules/installedapp/installed_app_controller.cc index 81c59a0..8524dc4 100644 --- a/third_party/blink/renderer/modules/installedapp/installed_app_controller.cc +++ b/third_party/blink/renderer/modules/installedapp/installed_app_controller.cc
@@ -63,7 +63,8 @@ LocalFrame& frame, WebRelatedAppsFetcher* related_apps_fetcher) { Supplement<LocalFrame>::ProvideTo( - frame, new InstalledAppController(frame, related_apps_fetcher)); + frame, MakeGarbageCollected<InstalledAppController>( + frame, related_apps_fetcher)); } InstalledAppController* InstalledAppController::From(LocalFrame& frame) {
diff --git a/third_party/blink/renderer/modules/installedapp/installed_app_controller.h b/third_party/blink/renderer/modules/installedapp/installed_app_controller.h index 1018ca3..338c2b0 100644 --- a/third_party/blink/renderer/modules/installedapp/installed_app_controller.h +++ b/third_party/blink/renderer/modules/installedapp/installed_app_controller.h
@@ -31,6 +31,7 @@ public: static const char kSupplementName[]; + InstalledAppController(LocalFrame&, WebRelatedAppsFetcher*); virtual ~InstalledAppController(); // Gets a list of related apps from the current page's manifest that belong @@ -45,8 +46,6 @@ private: class GetRelatedAppsCallbacks; - InstalledAppController(LocalFrame&, WebRelatedAppsFetcher*); - // Inherited from ContextLifecycleObserver. void ContextDestroyed(ExecutionContext*) override;
diff --git a/third_party/blink/renderer/modules/keyboard/keyboard.cc b/third_party/blink/renderer/modules/keyboard/keyboard.cc index 934fdb1..758cfde 100644 --- a/third_party/blink/renderer/modules/keyboard/keyboard.cc +++ b/third_party/blink/renderer/modules/keyboard/keyboard.cc
@@ -12,8 +12,8 @@ namespace blink { Keyboard::Keyboard(ExecutionContext* context) - : keyboard_lock_(new KeyboardLock(context)), - keyboard_layout_(new KeyboardLayout(context)) {} + : keyboard_lock_(MakeGarbageCollected<KeyboardLock>(context)), + keyboard_layout_(MakeGarbageCollected<KeyboardLayout>(context)) {} Keyboard::~Keyboard() = default;
diff --git a/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc b/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc index ab964f1..af4f02e 100644 --- a/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc +++ b/third_party/blink/renderer/modules/keyboard/keyboard_layout.cc
@@ -99,7 +99,7 @@ switch (result->status) { case mojom::blink::GetKeyboardLayoutMapStatus::kSuccess: script_promise_resolver_->Resolve( - new KeyboardLayoutMap(result->layout_map)); + MakeGarbageCollected<KeyboardLayoutMap>(result->layout_map)); break; case mojom::blink::GetKeyboardLayoutMapStatus::kFail: script_promise_resolver_->Reject(
diff --git a/third_party/blink/renderer/modules/keyboard/keyboard_layout_map.cc b/third_party/blink/renderer/modules/keyboard/keyboard_layout_map.cc index f71a3ea..6591192 100644 --- a/third_party/blink/renderer/modules/keyboard/keyboard_layout_map.cc +++ b/third_party/blink/renderer/modules/keyboard/keyboard_layout_map.cc
@@ -40,7 +40,7 @@ PairIterable<String, String>::IterationSource* KeyboardLayoutMap::StartIteration(ScriptState*, ExceptionState&) { - return new KeyboardLayoutMapIterationSource(*this); + return MakeGarbageCollected<KeyboardLayoutMapIterationSource>(*this); } bool KeyboardLayoutMap::GetMapEntry(ScriptState*,
diff --git a/third_party/blink/renderer/modules/keyboard/navigator_keyboard.cc b/third_party/blink/renderer/modules/keyboard/navigator_keyboard.cc index c9d4574..3f7cae0 100644 --- a/third_party/blink/renderer/modules/keyboard/navigator_keyboard.cc +++ b/third_party/blink/renderer/modules/keyboard/navigator_keyboard.cc
@@ -16,10 +16,10 @@ NavigatorKeyboard::NavigatorKeyboard(Navigator& navigator) : Supplement<Navigator>(navigator), - keyboard_( - new Keyboard(GetSupplementable()->GetFrame() - ? GetSupplementable()->GetFrame()->GetDocument() - : nullptr)) {} + keyboard_(MakeGarbageCollected<Keyboard>( + GetSupplementable()->GetFrame() + ? GetSupplementable()->GetFrame()->GetDocument() + : nullptr)) {} // static Keyboard* NavigatorKeyboard::keyboard(Navigator& navigator) {
diff --git a/third_party/blink/renderer/modules/locks/lock.cc b/third_party/blink/renderer/modules/locks/lock.cc index 05f7c0c5..f8fd4574 100644 --- a/third_party/blink/renderer/modules/locks/lock.cc +++ b/third_party/blink/renderer/modules/locks/lock.cc
@@ -30,19 +30,20 @@ static v8::Local<v8::Function> CreateFunction(ScriptState* script_state, Lock* lock, ResolveType type) { - ThenFunction* self = new ThenFunction(script_state, lock, type); + ThenFunction* self = + MakeGarbageCollected<ThenFunction>(script_state, lock, type); return self->BindToV8Function(); } + ThenFunction(ScriptState* script_state, Lock* lock, ResolveType type) + : ScriptFunction(script_state), lock_(lock), resolve_type_(type) {} + void Trace(blink::Visitor* visitor) override { visitor->Trace(lock_); ScriptFunction::Trace(visitor); } private: - ThenFunction(ScriptState* script_state, Lock* lock, ResolveType type) - : ScriptFunction(script_state), lock_(lock), resolve_type_(type) {} - ScriptValue Call(ScriptValue value) override { DCHECK(lock_); DCHECK(resolve_type_ == Fulfilled || resolve_type_ == Rejected); @@ -65,7 +66,8 @@ mojom::blink::LockMode mode, mojom::blink::LockHandlePtr handle, LockManager* manager) { - return new Lock(script_state, name, mode, std::move(handle), manager); + return MakeGarbageCollected<Lock>(script_state, name, mode, std::move(handle), + manager); } Lock::Lock(ScriptState* script_state,
diff --git a/third_party/blink/renderer/modules/locks/lock.h b/third_party/blink/renderer/modules/locks/lock.h index 04a40bb..a7bdc4f 100644 --- a/third_party/blink/renderer/modules/locks/lock.h +++ b/third_party/blink/renderer/modules/locks/lock.h
@@ -30,6 +30,11 @@ mojom::blink::LockHandlePtr, LockManager*); + Lock(ScriptState*, + const String& name, + mojom::blink::LockMode, + mojom::blink::LockHandlePtr, + LockManager*); ~Lock() override; void Trace(blink::Visitor*) override; @@ -52,12 +57,6 @@ private: class ThenFunction; - Lock(ScriptState*, - const String& name, - mojom::blink::LockMode, - mojom::blink::LockHandlePtr, - LockManager*); - void ReleaseIfHeld(); void OnConnectionError();
diff --git a/third_party/blink/renderer/modules/locks/lock_manager.cc b/third_party/blink/renderer/modules/locks/lock_manager.cc index c7999982..85ec1925 100644 --- a/third_party/blink/renderer/modules/locks/lock_manager.cc +++ b/third_party/blink/renderer/modules/locks/lock_manager.cc
@@ -290,7 +290,7 @@ // promise, the current agent, environment’s id, origin, callback, name, // options’ mode dictionary member, options’ ifAvailable dictionary member, // and options’ steal dictionary member. - LockRequestImpl* request = new LockRequestImpl( + LockRequestImpl* request = MakeGarbageCollected<LockRequestImpl>( callback, resolver, name, mode, mojo::MakeRequest(&request_ptr), this); AddPendingRequest(request);
diff --git a/third_party/blink/renderer/modules/locks/navigator_locks.cc b/third_party/blink/renderer/modules/locks/navigator_locks.cc index f18cfb5..2ee6981 100644 --- a/third_party/blink/renderer/modules/locks/navigator_locks.cc +++ b/third_party/blink/renderer/modules/locks/navigator_locks.cc
@@ -37,7 +37,7 @@ LockManager* GetLockManager(ExecutionContext* context) const { if (!lock_manager_ && context) { - lock_manager_ = new LockManager(context); + lock_manager_ = MakeGarbageCollected<LockManager>(context); } return lock_manager_.Get(); }
diff --git a/third_party/blink/renderer/modules/media_capabilities/BUILD.gn b/third_party/blink/renderer/modules/media_capabilities/BUILD.gn index 022538b4..d37c6e8e 100644 --- a/third_party/blink/renderer/modules/media_capabilities/BUILD.gn +++ b/third_party/blink/renderer/modules/media_capabilities/BUILD.gn
@@ -8,8 +8,10 @@ sources = [ "media_capabilities.cc", "media_capabilities.h", - "media_capabilities_info.cc", - "media_capabilities_info.h", + "media_capabilities_decoding_info_callbacks.cc", + "media_capabilities_decoding_info_callbacks.h", + "media_capabilities_encoding_info_callbacks.cc", + "media_capabilities_encoding_info_callbacks.h", "navigator_media_capabilities.cc", "navigator_media_capabilities.h", ]
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc index a0367aa2..62898e0 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities.cc
@@ -12,11 +12,12 @@ #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/web_media_recorder_handler.h" -#include "third_party/blink/renderer/bindings/core/v8/callback_promise_adapter.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h" +#include "third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.h" +#include "third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.h" #include "third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.h" #include "third_party/blink/renderer/modules/media_capabilities/media_configuration.h" #include "third_party/blink/renderer/modules/media_capabilities/media_decoding_configuration.h" @@ -246,8 +247,7 @@ Platform::Current()->MediaCapabilitiesClient()->DecodingInfo( ToWebMediaConfiguration(configuration), - std::make_unique<CallbackPromiseAdapter<MediaCapabilitiesInfo, void>>( - resolver)); + std::make_unique<MediaCapabilitiesDecodingInfoCallbacks>(resolver)); return promise; } @@ -295,8 +295,8 @@ handler->EncodingInfo( ToWebMediaConfiguration(configuration), - std::make_unique<CallbackPromiseAdapter<MediaCapabilitiesInfo, void>>( - resolver)); + std::make_unique<MediaCapabilitiesEncodingInfoCallbacks>(resolver)); + return promise; }
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.cc new file mode 100644 index 0000000..32d0dfd --- /dev/null +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.cc
@@ -0,0 +1,37 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.h" + +#include "third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.h" + +namespace blink { + +MediaCapabilitiesDecodingInfoCallbacks::MediaCapabilitiesDecodingInfoCallbacks( + ScriptPromiseResolver* resolver) + : resolver_(resolver) {} + +MediaCapabilitiesDecodingInfoCallbacks:: + ~MediaCapabilitiesDecodingInfoCallbacks() = default; + +void MediaCapabilitiesDecodingInfoCallbacks::OnSuccess( + std::unique_ptr<WebMediaCapabilitiesInfo> result) { + if (!resolver_->GetExecutionContext() || + resolver_->GetExecutionContext()->IsContextDestroyed()) { + return; + } + + Persistent<MediaCapabilitiesInfo> info(MediaCapabilitiesInfo::Create()); + info->setSupported(result->supported); + info->setSmooth(result->smooth); + info->setPowerEfficient(result->power_efficient); + + resolver_->Resolve(std::move(info)); +} + +void MediaCapabilitiesDecodingInfoCallbacks::OnError() { + NOTREACHED(); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.h b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.h new file mode 100644 index 0000000..5928261 --- /dev/null +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_decoding_info_callbacks.h
@@ -0,0 +1,31 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_DECODING_INFO_CALLBACKS_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_DECODING_INFO_CALLBACKS_H_ + +#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +#include "third_party/blink/renderer/platform/heap/persistent.h" + +namespace blink { + +class MediaCapabilitiesDecodingInfoCallbacks + : public WebMediaCapabilitiesDecodingInfoCallbacks { + public: + explicit MediaCapabilitiesDecodingInfoCallbacks( + ScriptPromiseResolver* resolver); + + ~MediaCapabilitiesDecodingInfoCallbacks() override; + + void OnSuccess(std::unique_ptr<WebMediaCapabilitiesInfo>) override; + void OnError() override; + + private: + Persistent<ScriptPromiseResolver> resolver_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_QUERY_CALLBACKS_H_
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.cc new file mode 100644 index 0000000..044b9c8 --- /dev/null +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.cc
@@ -0,0 +1,37 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.h" + +#include "third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.h" + +namespace blink { + +MediaCapabilitiesEncodingInfoCallbacks::MediaCapabilitiesEncodingInfoCallbacks( + ScriptPromiseResolver* resolver) + : resolver_(resolver) {} + +MediaCapabilitiesEncodingInfoCallbacks:: + ~MediaCapabilitiesEncodingInfoCallbacks() = default; + +void MediaCapabilitiesEncodingInfoCallbacks::OnSuccess( + std::unique_ptr<WebMediaCapabilitiesInfo> result) { + if (!resolver_->GetExecutionContext() || + resolver_->GetExecutionContext()->IsContextDestroyed()) { + return; + } + + Persistent<MediaCapabilitiesInfo> info(MediaCapabilitiesInfo::Create()); + info->setSupported(result->supported); + info->setSmooth(result->smooth); + info->setPowerEfficient(result->power_efficient); + + resolver_->Resolve(std::move(info)); +} + +void MediaCapabilitiesEncodingInfoCallbacks::OnError() { + NOTREACHED(); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.h b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.h new file mode 100644 index 0000000..6f847b7 --- /dev/null +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_encoding_info_callbacks.h
@@ -0,0 +1,31 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_ENCODING_INFO_CALLBACKS_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_ENCODING_INFO_CALLBACKS_H_ + +#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_callbacks.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +#include "third_party/blink/renderer/platform/heap/persistent.h" + +namespace blink { + +class MediaCapabilitiesEncodingInfoCallbacks + : public WebMediaCapabilitiesEncodingInfoCallbacks { + public: + explicit MediaCapabilitiesEncodingInfoCallbacks( + ScriptPromiseResolver* resolver); + + ~MediaCapabilitiesEncodingInfoCallbacks() override; + + void OnSuccess(std::unique_ptr<WebMediaCapabilitiesInfo>) override; + void OnError() override; + + private: + Persistent<ScriptPromiseResolver> resolver_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_ENCODING_INFO_CALLBACKS_H_
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.cc b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.cc deleted file mode 100644 index 30d3c49..0000000 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.cc +++ /dev/null
@@ -1,33 +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 "third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.h" - -namespace blink { - -// static -MediaCapabilitiesInfo* MediaCapabilitiesInfo::Take( - ScriptPromiseResolver*, - std::unique_ptr<WebMediaCapabilitiesInfo> web_media_capabilities_info) { - DCHECK(web_media_capabilities_info); - return new MediaCapabilitiesInfo(std::move(web_media_capabilities_info)); -} - -bool MediaCapabilitiesInfo::supported() const { - return web_media_capabilities_info_->supported; -} - -bool MediaCapabilitiesInfo::smooth() const { - return web_media_capabilities_info_->smooth; -} - -bool MediaCapabilitiesInfo::powerEfficient() const { - return web_media_capabilities_info_->power_efficient; -} - -MediaCapabilitiesInfo::MediaCapabilitiesInfo( - std::unique_ptr<WebMediaCapabilitiesInfo> web_media_capabilities_info) - : web_media_capabilities_info_(std::move(web_media_capabilities_info)) {} - -} // namespace blink
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.h b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.h deleted file mode 100644 index da51fbc..0000000 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.h +++ /dev/null
@@ -1,39 +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 THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_INFO_H_ -#define THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_INFO_H_ - -#include <memory> - -#include "third_party/blink/public/platform/modules/media_capabilities/web_media_capabilities_info.h" -#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" - -namespace blink { - -class ScriptPromiseResolver; - -// Implementation of the MediaCapabilitiesInfo interface. -class MediaCapabilitiesInfo final : public ScriptWrappable { - DEFINE_WRAPPERTYPEINFO(); - - public: - using WebType = std::unique_ptr<WebMediaCapabilitiesInfo>; - static MediaCapabilitiesInfo* Take(ScriptPromiseResolver*, - std::unique_ptr<WebMediaCapabilitiesInfo>); - - bool supported() const; - bool smooth() const; - bool powerEfficient() const; - - private: - MediaCapabilitiesInfo() = delete; - explicit MediaCapabilitiesInfo(std::unique_ptr<WebMediaCapabilitiesInfo>); - - std::unique_ptr<WebMediaCapabilitiesInfo> web_media_capabilities_info_; -}; - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_MEDIA_CAPABILITIES_MEDIA_CAPABILITIES_INFO_H_
diff --git a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.idl b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.idl index 06bf60f..1a80a70 100644 --- a/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.idl +++ b/third_party/blink/renderer/modules/media_capabilities/media_capabilities_info.idl
@@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// https://wicg.github.io/media-capabilities/#mediacapabilitiesinfo +// https://wicg.github.io/media-capabilities/#media-capabilities-info -[ - Exposed=Window -] interface MediaCapabilitiesInfo { - [Measure] readonly attribute boolean supported; - [Measure] readonly attribute boolean smooth; - [Measure] readonly attribute boolean powerEfficient; +dictionary MediaCapabilitiesInfo { + required boolean supported; + required boolean smooth; + required boolean powerEfficient; };
diff --git a/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc b/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc index 9296d8d..aa680c9 100644 --- a/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc +++ b/third_party/blink/renderer/modules/media_controls/media_controls_rotate_to_fullscreen_delegate.cc
@@ -136,7 +136,7 @@ << needs_visibility_observer; if (needs_visibility_observer && !visibility_observer_) { - visibility_observer_ = new ElementVisibilityObserver( + visibility_observer_ = MakeGarbageCollected<ElementVisibilityObserver>( video_element_, WTF::BindRepeating( &MediaControlsRotateToFullscreenDelegate::OnVisibilityChange,
diff --git a/third_party/blink/renderer/modules/mediastream/input_device_info.cc b/third_party/blink/renderer/modules/mediastream/input_device_info.cc index b7edac2..7a3fa46 100644 --- a/third_party/blink/renderer/modules/mediastream/input_device_info.cc +++ b/third_party/blink/renderer/modules/mediastream/input_device_info.cc
@@ -38,7 +38,8 @@ const String& label, const String& group_id, MediaDeviceType device_type) { - return new InputDeviceInfo(device_id, label, group_id, device_type); + return MakeGarbageCollected<InputDeviceInfo>(device_id, label, group_id, + device_type); } InputDeviceInfo::InputDeviceInfo(const String& device_id,
diff --git a/third_party/blink/renderer/modules/mediastream/input_device_info.h b/third_party/blink/renderer/modules/mediastream/input_device_info.h index 06c27b1..abd16df 100644 --- a/third_party/blink/renderer/modules/mediastream/input_device_info.h +++ b/third_party/blink/renderer/modules/mediastream/input_device_info.h
@@ -21,16 +21,16 @@ const String& group_id, MediaDeviceType); - void SetVideoInputCapabilities(mojom::blink::VideoInputDeviceCapabilitiesPtr); - - MediaTrackCapabilities* getCapabilities() const; - - private: InputDeviceInfo(const String& device_id, const String& label, const String& group_id, MediaDeviceType); + void SetVideoInputCapabilities(mojom::blink::VideoInputDeviceCapabilitiesPtr); + + MediaTrackCapabilities* getCapabilities() const; + + private: WebMediaStreamSource::Capabilities platform_capabilities_; };
diff --git a/third_party/blink/renderer/modules/modules_idl_files.gni b/third_party/blink/renderer/modules/modules_idl_files.gni index 8040f78..1fe3cd8 100644 --- a/third_party/blink/renderer/modules/modules_idl_files.gni +++ b/third_party/blink/renderer/modules/modules_idl_files.gni
@@ -187,7 +187,6 @@ "locks/lock.idl", "locks/lock_manager.idl", "media_capabilities/media_capabilities.idl", - "media_capabilities/media_capabilities_info.idl", "mediacapturefromelement/canvas_capture_media_stream_track.idl", "mediarecorder/blob_event.idl", "mediarecorder/media_recorder.idl", @@ -559,6 +558,7 @@ "manifest/image_resource.idl", "media_capabilities/audio_configuration.idl", "media_capabilities/media_configuration.idl", + "media_capabilities/media_capabilities_info.idl", "media_capabilities/media_decoding_configuration.idl", "media_capabilities/media_encoding_configuration.idl", "media_capabilities/video_configuration.idl",
diff --git a/third_party/blink/renderer/modules/modules_initializer.cc b/third_party/blink/renderer/modules/modules_initializer.cc index 7485828..0774044 100644 --- a/third_party/blink/renderer/modules/modules_initializer.cc +++ b/third_party/blink/renderer/modules/modules_initializer.cc
@@ -218,7 +218,8 @@ Page* page) const { session->Append(MakeGarbageCollected<InspectorIndexedDBAgent>( inspected_frames, session->V8Session())); - session->Append(new DeviceOrientationInspectorAgent(inspected_frames)); + session->Append( + MakeGarbageCollected<DeviceOrientationInspectorAgent>(inspected_frames)); session->Append( MakeGarbageCollected<InspectorDOMStorageAgent>(inspected_frames)); if (allow_view_agents) {
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport_test.cc b/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport_test.cc index 28129d98..a4b6e64 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport_test.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport_test.cc
@@ -133,7 +133,7 @@ } MockEventListener* RTCIceTransportTest::CreateMockEventListener() { - MockEventListener* event_listener = new MockEventListener(); + MockEventListener* event_listener = MakeGarbageCollected<MockEventListener>(); mock_event_listeners_.push_back(event_listener); return event_listener; }
diff --git a/third_party/blink/renderer/modules/quota/deprecated_storage_info.h b/third_party/blink/renderer/modules/quota/deprecated_storage_info.h index 57e26d4..a52c318 100644 --- a/third_party/blink/renderer/modules/quota/deprecated_storage_info.h +++ b/third_party/blink/renderer/modules/quota/deprecated_storage_info.h
@@ -52,7 +52,11 @@ kPersistent, }; - static DeprecatedStorageInfo* Create() { return new DeprecatedStorageInfo(); } + static DeprecatedStorageInfo* Create() { + return MakeGarbageCollected<DeprecatedStorageInfo>(); + } + + DeprecatedStorageInfo(); void queryUsageAndQuota(ScriptState*, int storage_type, @@ -68,8 +72,6 @@ void Trace(blink::Visitor*) override; private: - DeprecatedStorageInfo(); - DeprecatedStorageQuota* GetStorageQuota(int storage_type); mutable Member<DeprecatedStorageQuota> temporary_storage_;
diff --git a/third_party/blink/renderer/modules/quota/deprecated_storage_quota.h b/third_party/blink/renderer/modules/quota/deprecated_storage_quota.h index 0d5bb07f..4903732 100644 --- a/third_party/blink/renderer/modules/quota/deprecated_storage_quota.h +++ b/third_party/blink/renderer/modules/quota/deprecated_storage_quota.h
@@ -54,13 +54,15 @@ }; static DeprecatedStorageQuota* Create(Type type) { - return new DeprecatedStorageQuota(type); + return MakeGarbageCollected<DeprecatedStorageQuota>(type); } static void EnqueueStorageErrorCallback(ScriptState*, V8StorageErrorCallback*, DOMExceptionCode); + explicit DeprecatedStorageQuota(Type); + void queryUsageAndQuota(ScriptState*, V8StorageUsageCallback*, V8StorageErrorCallback* = nullptr); @@ -71,8 +73,6 @@ V8StorageErrorCallback* = nullptr); private: - explicit DeprecatedStorageQuota(Type); - // Binds the interface (if not already bound) with the given interface // provider, and returns it, mojom::blink::QuotaDispatcherHost& GetQuotaHost(ExecutionContext*);
diff --git a/third_party/blink/renderer/modules/sensor/gyroscope.cc b/third_party/blink/renderer/modules/sensor/gyroscope.cc index b020d77..b03a5f8 100644 --- a/third_party/blink/renderer/modules/sensor/gyroscope.cc +++ b/third_party/blink/renderer/modules/sensor/gyroscope.cc
@@ -11,7 +11,8 @@ Gyroscope* Gyroscope::Create(ExecutionContext* execution_context, const SpatialSensorOptions* options, ExceptionState& exception_state) { - return new Gyroscope(execution_context, options, exception_state); + return MakeGarbageCollected<Gyroscope>(execution_context, options, + exception_state); } // static
diff --git a/third_party/blink/renderer/modules/sensor/gyroscope.h b/third_party/blink/renderer/modules/sensor/gyroscope.h index 73cf30e4..27e36a14 100644 --- a/third_party/blink/renderer/modules/sensor/gyroscope.h +++ b/third_party/blink/renderer/modules/sensor/gyroscope.h
@@ -19,14 +19,13 @@ ExceptionState&); static Gyroscope* Create(ExecutionContext*, ExceptionState&); + Gyroscope(ExecutionContext*, const SpatialSensorOptions*, ExceptionState&); + double x(bool& is_null) const; double y(bool& is_null) const; double z(bool& is_null) const; void Trace(blink::Visitor*) override; - - private: - Gyroscope(ExecutionContext*, const SpatialSensorOptions*, ExceptionState&); }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.cc b/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.cc index ff1bb87..26283bb 100644 --- a/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.cc +++ b/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.cc
@@ -12,8 +12,8 @@ ExecutionContext* execution_context, const SpatialSensorOptions* options, ExceptionState& exception_state) { - return new LinearAccelerationSensor(execution_context, options, - exception_state); + return MakeGarbageCollected<LinearAccelerationSensor>( + execution_context, options, exception_state); } // static
diff --git a/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.h b/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.h index 8e535ddf..bf54c82 100644 --- a/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.h +++ b/third_party/blink/renderer/modules/sensor/linear_acceleration_sensor.h
@@ -18,12 +18,11 @@ ExceptionState&); static LinearAccelerationSensor* Create(ExecutionContext*, ExceptionState&); - void Trace(blink::Visitor*) override; - - private: LinearAccelerationSensor(ExecutionContext*, const SpatialSensorOptions*, ExceptionState&); + + void Trace(blink::Visitor*) override; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/service_worker/extendable_event.cc b/third_party/blink/renderer/modules/service_worker/extendable_event.cc index 389b2fd..1335f01 100644 --- a/third_party/blink/renderer/modules/service_worker/extendable_event.cc +++ b/third_party/blink/renderer/modules/service_worker/extendable_event.cc
@@ -39,13 +39,13 @@ ExtendableEvent* ExtendableEvent::Create( const AtomicString& type, const ExtendableEventInit* event_init) { - return new ExtendableEvent(type, event_init); + return MakeGarbageCollected<ExtendableEvent>(type, event_init); } ExtendableEvent* ExtendableEvent::Create(const AtomicString& type, const ExtendableEventInit* event_init, WaitUntilObserver* observer) { - return new ExtendableEvent(type, event_init, observer); + return MakeGarbageCollected<ExtendableEvent>(type, event_init, observer); } ExtendableEvent::~ExtendableEvent() = default;
diff --git a/third_party/blink/renderer/modules/service_worker/extendable_event.h b/third_party/blink/renderer/modules/service_worker/extendable_event.h index 1d6d7aa13..75932320 100644 --- a/third_party/blink/renderer/modules/service_worker/extendable_event.h +++ b/third_party/blink/renderer/modules/service_worker/extendable_event.h
@@ -50,6 +50,10 @@ const ExtendableEventInit*, WaitUntilObserver*); + ExtendableEvent(const AtomicString& type, const ExtendableEventInit*); + ExtendableEvent(const AtomicString& type, + const ExtendableEventInit*, + WaitUntilObserver*); ~ExtendableEvent() override; void waitUntil(ScriptState*, ScriptPromise, ExceptionState&); @@ -58,11 +62,6 @@ void Trace(blink::Visitor*) override; protected: - ExtendableEvent(const AtomicString& type, const ExtendableEventInit*); - ExtendableEvent(const AtomicString& type, - const ExtendableEventInit*, - WaitUntilObserver*); - Member<WaitUntilObserver> observer_; };
diff --git a/third_party/blink/renderer/modules/service_worker/extendable_message_event.cc b/third_party/blink/renderer/modules/service_worker/extendable_message_event.cc index 32e6074..758194d 100644 --- a/third_party/blink/renderer/modules/service_worker/extendable_message_event.cc +++ b/third_party/blink/renderer/modules/service_worker/extendable_message_event.cc
@@ -9,14 +9,15 @@ ExtendableMessageEvent* ExtendableMessageEvent::Create( const AtomicString& type, const ExtendableMessageEventInit* initializer) { - return new ExtendableMessageEvent(type, initializer); + return MakeGarbageCollected<ExtendableMessageEvent>(type, initializer); } ExtendableMessageEvent* ExtendableMessageEvent::Create( const AtomicString& type, const ExtendableMessageEventInit* initializer, WaitUntilObserver* observer) { - return new ExtendableMessageEvent(type, initializer, observer); + return MakeGarbageCollected<ExtendableMessageEvent>(type, initializer, + observer); } ExtendableMessageEvent* ExtendableMessageEvent::Create( @@ -24,7 +25,8 @@ const String& origin, MessagePortArray* ports, WaitUntilObserver* observer) { - return new ExtendableMessageEvent(std::move(data), origin, ports, observer); + return MakeGarbageCollected<ExtendableMessageEvent>(std::move(data), origin, + ports, observer); } ExtendableMessageEvent* ExtendableMessageEvent::Create( @@ -33,8 +35,8 @@ MessagePortArray* ports, ServiceWorkerClient* source, WaitUntilObserver* observer) { - ExtendableMessageEvent* event = - new ExtendableMessageEvent(std::move(data), origin, ports, observer); + ExtendableMessageEvent* event = MakeGarbageCollected<ExtendableMessageEvent>( + std::move(data), origin, ports, observer); event->source_as_client_ = source; return event; } @@ -45,8 +47,8 @@ MessagePortArray* ports, ServiceWorker* source, WaitUntilObserver* observer) { - ExtendableMessageEvent* event = - new ExtendableMessageEvent(std::move(data), origin, ports, observer); + ExtendableMessageEvent* event = MakeGarbageCollected<ExtendableMessageEvent>( + std::move(data), origin, ports, observer); event->source_as_service_worker_ = source; return event; }
diff --git a/third_party/blink/renderer/modules/service_worker/extendable_message_event.h b/third_party/blink/renderer/modules/service_worker/extendable_message_event.h index fe9fd03..b0517c6 100644 --- a/third_party/blink/renderer/modules/service_worker/extendable_message_event.h +++ b/third_party/blink/renderer/modules/service_worker/extendable_message_event.h
@@ -41,6 +41,16 @@ ServiceWorker* source, WaitUntilObserver*); + ExtendableMessageEvent(const AtomicString& type, + const ExtendableMessageEventInit* initializer); + ExtendableMessageEvent(const AtomicString& type, + const ExtendableMessageEventInit* initializer, + WaitUntilObserver*); + ExtendableMessageEvent(scoped_refptr<SerializedScriptValue> data, + const String& origin, + MessagePortArray* ports, + WaitUntilObserver*); + SerializedScriptValue* SerializedData() const { return serialized_data_.get(); } @@ -58,16 +68,6 @@ void Trace(blink::Visitor*) override; private: - ExtendableMessageEvent(const AtomicString& type, - const ExtendableMessageEventInit* initializer); - ExtendableMessageEvent(const AtomicString& type, - const ExtendableMessageEventInit* initializer, - WaitUntilObserver*); - ExtendableMessageEvent(scoped_refptr<SerializedScriptValue> data, - const String& origin, - MessagePortArray* ports, - WaitUntilObserver*); - scoped_refptr<SerializedScriptValue> serialized_data_; String origin_; String last_event_id_;
diff --git a/third_party/blink/renderer/modules/service_worker/fetch_event.cc b/third_party/blink/renderer/modules/service_worker/fetch_event.cc index 92b2ca31..c95d157 100644 --- a/third_party/blink/renderer/modules/service_worker/fetch_event.cc +++ b/third_party/blink/renderer/modules/service_worker/fetch_event.cc
@@ -28,8 +28,8 @@ FetchEvent* FetchEvent::Create(ScriptState* script_state, const AtomicString& type, const FetchEventInit* initializer) { - return new FetchEvent(script_state, type, initializer, nullptr, nullptr, - false); + return MakeGarbageCollected<FetchEvent>(script_state, type, initializer, + nullptr, nullptr, false); } FetchEvent* FetchEvent::Create(ScriptState* script_state, @@ -38,8 +38,9 @@ FetchRespondWithObserver* respond_with_observer, WaitUntilObserver* wait_until_observer, bool navigation_preload_sent) { - return new FetchEvent(script_state, type, initializer, respond_with_observer, - wait_until_observer, navigation_preload_sent); + return MakeGarbageCollected<FetchEvent>( + script_state, type, initializer, respond_with_observer, + wait_until_observer, navigation_preload_sent); } Request* FetchEvent::request() const {
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 723eb9a..d4c6824 100644 --- a/third_party/blink/renderer/modules/service_worker/fetch_event.h +++ b/third_party/blink/renderer/modules/service_worker/fetch_event.h
@@ -56,6 +56,12 @@ WaitUntilObserver*, bool navigation_preload_sent); + FetchEvent(ScriptState*, + const AtomicString& type, + const FetchEventInit*, + FetchRespondWithObserver*, + WaitUntilObserver*, + bool navigation_preload_sent); ~FetchEvent() override; Request* request() const; @@ -84,14 +90,6 @@ void Trace(blink::Visitor*) override; - protected: - FetchEvent(ScriptState*, - const AtomicString& type, - const FetchEventInit*, - FetchRespondWithObserver*, - WaitUntilObserver*, - bool navigation_preload_sent); - private: Member<FetchRespondWithObserver> observer_; TraceWrapperMember<Request> request_;
diff --git a/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc b/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc index ea94c36..903916c6 100644 --- a/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc +++ b/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.cc
@@ -203,9 +203,9 @@ network::mojom::RequestContextFrameType frame_type, mojom::RequestContextType request_context, WaitUntilObserver* observer) { - return new FetchRespondWithObserver(context, fetch_event_id, request_url, - request_mode, redirect_mode, frame_type, - request_context, observer); + return MakeGarbageCollected<FetchRespondWithObserver>( + context, fetch_event_id, request_url, request_mode, redirect_mode, + frame_type, request_context, observer); } // This function may be called when an exception is scheduled. Thus, it must
diff --git a/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.h b/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.h index 892927e..631ed37 100644 --- a/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.h +++ b/third_party/blink/renderer/modules/service_worker/fetch_respond_with_observer.h
@@ -22,6 +22,14 @@ // notifies the client. class MODULES_EXPORT FetchRespondWithObserver : public RespondWithObserver { public: + FetchRespondWithObserver(ExecutionContext*, + int fetch_event_id, + const KURL& request_url, + network::mojom::FetchRequestMode, + network::mojom::FetchRedirectMode, + network::mojom::RequestContextFrameType, + mojom::RequestContextType, + WaitUntilObserver*); ~FetchRespondWithObserver() override = default; static FetchRespondWithObserver* Create( @@ -43,16 +51,6 @@ void Trace(blink::Visitor*) override; - protected: - FetchRespondWithObserver(ExecutionContext*, - int fetch_event_id, - const KURL& request_url, - network::mojom::FetchRequestMode, - network::mojom::FetchRedirectMode, - network::mojom::RequestContextFrameType, - mojom::RequestContextType, - WaitUntilObserver*); - private: const KURL request_url_; const network::mojom::FetchRequestMode request_mode_;
diff --git a/third_party/blink/renderer/modules/service_worker/install_event.cc b/third_party/blink/renderer/modules/service_worker/install_event.cc index 1ec43ea..35e3682c 100644 --- a/third_party/blink/renderer/modules/service_worker/install_event.cc +++ b/third_party/blink/renderer/modules/service_worker/install_event.cc
@@ -13,14 +13,15 @@ InstallEvent* InstallEvent::Create(const AtomicString& type, const ExtendableEventInit* event_init) { - return new InstallEvent(type, event_init); + return MakeGarbageCollected<InstallEvent>(type, event_init); } InstallEvent* InstallEvent::Create(const AtomicString& type, const ExtendableEventInit* event_init, int event_id, WaitUntilObserver* observer) { - return new InstallEvent(type, event_init, event_id, observer); + return MakeGarbageCollected<InstallEvent>(type, event_init, event_id, + observer); } InstallEvent::~InstallEvent() = default;
diff --git a/third_party/blink/renderer/modules/service_worker/install_event.h b/third_party/blink/renderer/modules/service_worker/install_event.h index ffb3691..5cbc94b 100644 --- a/third_party/blink/renderer/modules/service_worker/install_event.h +++ b/third_party/blink/renderer/modules/service_worker/install_event.h
@@ -22,16 +22,16 @@ int event_id, WaitUntilObserver*); - ~InstallEvent() override; - - const AtomicString& InterfaceName() const override; - - protected: InstallEvent(const AtomicString& type, const ExtendableEventInit*); InstallEvent(const AtomicString& type, const ExtendableEventInit*, int event_id, WaitUntilObserver*); + ~InstallEvent() override; + + const AtomicString& InterfaceName() const override; + + protected: const int event_id_; };
diff --git a/third_party/blink/renderer/modules/service_worker/wait_until_observer.cc b/third_party/blink/renderer/modules/service_worker/wait_until_observer.cc index 22eee7b..8d37624 100644 --- a/third_party/blink/renderer/modules/service_worker/wait_until_observer.cc +++ b/third_party/blink/renderer/modules/service_worker/wait_until_observer.cc
@@ -47,17 +47,11 @@ WaitUntilObserver* observer, ResolveType type, PromiseSettledCallback callback) { - ThenFunction* self = - new ThenFunction(script_state, observer, type, std::move(callback)); + ThenFunction* self = MakeGarbageCollected<ThenFunction>( + script_state, observer, type, std::move(callback)); return self->BindToV8Function(); } - void Trace(blink::Visitor* visitor) override { - visitor->Trace(observer_); - ScriptFunction::Trace(visitor); - } - - private: ThenFunction(ScriptState* script_state, WaitUntilObserver* observer, ResolveType type, @@ -67,6 +61,12 @@ resolve_type_(type), callback_(std::move(callback)) {} + void Trace(blink::Visitor* visitor) override { + visitor->Trace(observer_); + ScriptFunction::Trace(visitor); + } + + private: ScriptValue Call(ScriptValue value) override { DCHECK(observer_); DCHECK(resolve_type_ == kFulfilled || resolve_type_ == kRejected);
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc b/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc index b700b6e7..4815379b 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc +++ b/third_party/blink/renderer/modules/shapedetection/detected_barcode.cc
@@ -11,15 +11,16 @@ DetectedBarcode* DetectedBarcode::Create() { HeapVector<Member<Point2D>> empty_list; - return new DetectedBarcode(g_empty_string, - DOMRectReadOnly::Create(0, 0, 0, 0), empty_list); + return MakeGarbageCollected<DetectedBarcode>( + g_empty_string, DOMRectReadOnly::Create(0, 0, 0, 0), empty_list); } DetectedBarcode* DetectedBarcode::Create( String raw_value, DOMRectReadOnly* bounding_box, HeapVector<Member<Point2D>> corner_points) { - return new DetectedBarcode(raw_value, bounding_box, corner_points); + return MakeGarbageCollected<DetectedBarcode>(raw_value, bounding_box, + corner_points); } const String& DetectedBarcode::rawValue() const {
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_barcode.h b/third_party/blink/renderer/modules/shapedetection/detected_barcode.h index 4f5e7f1..201a6d1 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_barcode.h +++ b/third_party/blink/renderer/modules/shapedetection/detected_barcode.h
@@ -24,6 +24,8 @@ DOMRectReadOnly*, HeapVector<Member<Point2D>>); + DetectedBarcode(String, DOMRectReadOnly*, HeapVector<Member<Point2D>>); + const String& rawValue() const; DOMRectReadOnly* boundingBox() const; const HeapVector<Member<Point2D>>& cornerPoints() const; @@ -32,8 +34,6 @@ void Trace(blink::Visitor*) override; private: - DetectedBarcode(String, DOMRectReadOnly*, HeapVector<Member<Point2D>>); - const String raw_value_; const Member<DOMRectReadOnly> bounding_box_; const HeapVector<Member<Point2D>> corner_points_;
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_face.cc b/third_party/blink/renderer/modules/shapedetection/detected_face.cc index fcafc96..beb88c6 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_face.cc +++ b/third_party/blink/renderer/modules/shapedetection/detected_face.cc
@@ -10,17 +10,18 @@ namespace blink { DetectedFace* DetectedFace::Create() { - return new DetectedFace(DOMRectReadOnly::Create(0, 0, 0, 0)); + return MakeGarbageCollected<DetectedFace>( + DOMRectReadOnly::Create(0, 0, 0, 0)); } DetectedFace* DetectedFace::Create(DOMRectReadOnly* bounding_box) { - return new DetectedFace(bounding_box); + return MakeGarbageCollected<DetectedFace>(bounding_box); } DetectedFace* DetectedFace::Create( DOMRectReadOnly* bounding_box, const HeapVector<Member<Landmark>>& landmarks) { - return new DetectedFace(bounding_box, landmarks); + return MakeGarbageCollected<DetectedFace>(bounding_box, landmarks); } DOMRectReadOnly* DetectedFace::boundingBox() const {
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_face.h b/third_party/blink/renderer/modules/shapedetection/detected_face.h index 22d2cd3..40be303 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_face.h +++ b/third_party/blink/renderer/modules/shapedetection/detected_face.h
@@ -23,6 +23,9 @@ static DetectedFace* Create(DOMRectReadOnly*, const HeapVector<Member<Landmark>>&); + explicit DetectedFace(DOMRectReadOnly*); + DetectedFace(DOMRectReadOnly*, const HeapVector<Member<Landmark>>&); + DOMRectReadOnly* boundingBox() const; const HeapVector<Member<Landmark>>& landmarks() const; @@ -30,9 +33,6 @@ void Trace(blink::Visitor*) override; private: - explicit DetectedFace(DOMRectReadOnly*); - DetectedFace(DOMRectReadOnly*, const HeapVector<Member<Landmark>>&); - const Member<DOMRectReadOnly> bounding_box_; const HeapVector<Member<Landmark>> landmarks_; };
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_text.cc b/third_party/blink/renderer/modules/shapedetection/detected_text.cc index 2851615..dfd3de3 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_text.cc +++ b/third_party/blink/renderer/modules/shapedetection/detected_text.cc
@@ -11,14 +11,15 @@ DetectedText* DetectedText::Create() { HeapVector<Member<Point2D>> empty_list; - return new DetectedText(g_empty_string, DOMRectReadOnly::Create(0, 0, 0, 0), - empty_list); + return MakeGarbageCollected<DetectedText>( + g_empty_string, DOMRectReadOnly::Create(0, 0, 0, 0), empty_list); } DetectedText* DetectedText::Create(String raw_value, DOMRectReadOnly* bounding_box, HeapVector<Member<Point2D>> corner_points) { - return new DetectedText(raw_value, bounding_box, corner_points); + return MakeGarbageCollected<DetectedText>(raw_value, bounding_box, + corner_points); } const String& DetectedText::rawValue() const {
diff --git a/third_party/blink/renderer/modules/shapedetection/detected_text.h b/third_party/blink/renderer/modules/shapedetection/detected_text.h index 0f3b0b2..8af515e 100644 --- a/third_party/blink/renderer/modules/shapedetection/detected_text.h +++ b/third_party/blink/renderer/modules/shapedetection/detected_text.h
@@ -24,6 +24,8 @@ DOMRectReadOnly*, HeapVector<Member<Point2D>>); + DetectedText(String, DOMRectReadOnly*, HeapVector<Member<Point2D>>); + const String& rawValue() const; DOMRectReadOnly* boundingBox() const; const HeapVector<Member<Point2D>>& cornerPoints() const; @@ -32,8 +34,6 @@ void Trace(blink::Visitor*) override; private: - DetectedText(String, DOMRectReadOnly*, HeapVector<Member<Point2D>>); - const String raw_value_; const Member<DOMRectReadOnly> bounding_box_; const HeapVector<Member<Point2D>> corner_points_;
diff --git a/third_party/blink/renderer/modules/shapedetection/face_detector.cc b/third_party/blink/renderer/modules/shapedetection/face_detector.cc index 718e5af..fa7a072 100644 --- a/third_party/blink/renderer/modules/shapedetection/face_detector.cc +++ b/third_party/blink/renderer/modules/shapedetection/face_detector.cc
@@ -23,7 +23,7 @@ FaceDetector* FaceDetector::Create(ExecutionContext* context, const FaceDetectorOptions* options) { - return new FaceDetector(context, options); + return MakeGarbageCollected<FaceDetector>(context, options); } FaceDetector::FaceDetector(ExecutionContext* context,
diff --git a/third_party/blink/renderer/modules/shapedetection/face_detector.h b/third_party/blink/renderer/modules/shapedetection/face_detector.h index 7717b9a8..8653708 100644 --- a/third_party/blink/renderer/modules/shapedetection/face_detector.h +++ b/third_party/blink/renderer/modules/shapedetection/face_detector.h
@@ -23,10 +23,11 @@ public: static FaceDetector* Create(ExecutionContext*, const FaceDetectorOptions*); + FaceDetector(ExecutionContext*, const FaceDetectorOptions*); + void Trace(blink::Visitor*) override; private: - FaceDetector(ExecutionContext*, const FaceDetectorOptions*); ~FaceDetector() override = default; ScriptPromise DoDetect(ScriptPromiseResolver*, SkBitmap) override;
diff --git a/third_party/blink/renderer/modules/speech/speech_synthesis.cc b/third_party/blink/renderer/modules/speech/speech_synthesis.cc index 80306fb..530c158 100644 --- a/third_party/blink/renderer/modules/speech/speech_synthesis.cc +++ b/third_party/blink/renderer/modules/speech/speech_synthesis.cc
@@ -167,7 +167,7 @@ } void SpeechSynthesis::FireErrorEvent(SpeechSynthesisUtterance* utterance, - unsigned long char_index, + uint32_t char_index, const String& error) { double millis; if (!GetElapsedTimeMillis(&millis))
diff --git a/third_party/blink/renderer/modules/speech/speech_synthesis.h b/third_party/blink/renderer/modules/speech/speech_synthesis.h index c394fd5..cc5bbc0e 100644 --- a/third_party/blink/renderer/modules/speech/speech_synthesis.h +++ b/third_party/blink/renderer/modules/speech/speech_synthesis.h
@@ -93,7 +93,7 @@ const String& name); void FireErrorEvent(SpeechSynthesisUtterance*, - unsigned long char_index, + uint32_t char_index, const String& error); // Returns the utterance at the front of the queue.
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 6ee54a2..eab9d83 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
@@ -38,10 +38,10 @@ kOrigin, mock_storage_area_.GetInterfacePtr(), scheduler::GetSingleThreadTaskRunnerForTesting(), this); } - source_area_ = new FakeAreaSource(kPageUrl); + source_area_ = MakeGarbageCollected<FakeAreaSource>(kPageUrl); source_area_id_ = cached_area_->RegisterSource(source_area_); source_ = kPageUrl.GetString() + "\n" + source_area_id_; - source_area2_ = new FakeAreaSource(kPageUrl2); + source_area2_ = MakeGarbageCollected<FakeAreaSource>(kPageUrl2); cached_area_->RegisterSource(source_area2_); }
diff --git a/third_party/blink/renderer/modules/storage/storage_controller_test.cc b/third_party/blink/renderer/modules/storage/storage_controller_test.cc index 68810538..e3ba631 100644 --- a/third_party/blink/renderer/modules/storage/storage_controller_test.cc +++ b/third_party/blink/renderer/modules/storage/storage_controller_test.cc
@@ -55,7 +55,8 @@ const String kKey("key"); const String kValue("value"); const KURL kPageUrl("http://dom_storage/page"); - Persistent<FakeAreaSource> source_area = new FakeAreaSource(kPageUrl); + Persistent<FakeAreaSource> source_area = + MakeGarbageCollected<FakeAreaSource>(kPageUrl); mojom::blink::StoragePartitionServicePtr storage_partition_service_ptr; PostCrossThreadTask( @@ -109,7 +110,8 @@ const String kValue("value"); const KURL kPageUrl("http://dom_storage/page"); - Persistent<FakeAreaSource> source_area = new FakeAreaSource(kPageUrl); + Persistent<FakeAreaSource> source_area = + MakeGarbageCollected<FakeAreaSource>(kPageUrl); auto task_runner = base::CreateSequencedTaskRunnerWithTraits({});
diff --git a/third_party/blink/renderer/modules/storage/storage_namespace_test.cc b/third_party/blink/renderer/modules/storage/storage_namespace_test.cc index a6886e4..a3ef3c0 100644 --- a/third_party/blink/renderer/modules/storage/storage_namespace_test.cc +++ b/third_party/blink/renderer/modules/storage/storage_namespace_test.cc
@@ -53,7 +53,8 @@ const String kValue("value"); const String kSessionStorageNamespace("abcd"); const KURL kPageUrl("http://dom_storage/page"); - Persistent<FakeAreaSource> source_area = new FakeAreaSource(kPageUrl); + Persistent<FakeAreaSource> source_area = + MakeGarbageCollected<FakeAreaSource>(kPageUrl); mojom::blink::StoragePartitionServicePtr storage_partition_service_ptr; PostCrossThreadTask(
diff --git a/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.cc b/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.cc index 964e68ea..e2a2549 100644 --- a/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.cc +++ b/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.cc
@@ -259,7 +259,8 @@ DefaultAudioDestinationNode* DefaultAudioDestinationNode::Create( BaseAudioContext* context, const WebAudioLatencyHint& latency_hint) { - return new DefaultAudioDestinationNode(*context, latency_hint); + return MakeGarbageCollected<DefaultAudioDestinationNode>(*context, + latency_hint); } } // namespace blink
diff --git a/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.h b/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.h index 0507a5a..2e19277 100644 --- a/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.h +++ b/third_party/blink/renderer/modules/webaudio/default_audio_destination_node.h
@@ -96,7 +96,6 @@ static DefaultAudioDestinationNode* Create(BaseAudioContext*, const WebAudioLatencyHint&); - private: explicit DefaultAudioDestinationNode(BaseAudioContext&, const WebAudioLatencyHint&); };
diff --git a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc index 5174ef59..5229105 100644 --- a/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc +++ b/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc
@@ -182,7 +182,7 @@ bool disable_outputs) { AssertGraphOwner(); - size_t index = tail_processing_handlers_.Find(handler); + wtf_size_t index = tail_processing_handlers_.Find(handler); if (index != kNotFound) { #if DEBUG_AUDIONODE_REFERENCES > 1 handler->RemoveTailProcessingDebug(disable_outputs);
diff --git a/third_party/blink/renderer/modules/webaudio/delay_node.cc b/third_party/blink/renderer/modules/webaudio/delay_node.cc index d21da7c..e06c962d 100644 --- a/third_party/blink/renderer/modules/webaudio/delay_node.cc +++ b/third_party/blink/renderer/modules/webaudio/delay_node.cc
@@ -104,7 +104,7 @@ return nullptr; } - return new DelayNode(context, max_delay_time); + return MakeGarbageCollected<DelayNode>(context, max_delay_time); } DelayNode* DelayNode::Create(BaseAudioContext* context,
diff --git a/third_party/blink/renderer/modules/webaudio/delay_node.h b/third_party/blink/renderer/modules/webaudio/delay_node.h index 72d4872..72f6ff7 100644 --- a/third_party/blink/renderer/modules/webaudio/delay_node.h +++ b/third_party/blink/renderer/modules/webaudio/delay_node.h
@@ -61,12 +61,13 @@ static DelayNode* Create(BaseAudioContext*, const DelayOptions*, ExceptionState&); + + DelayNode(BaseAudioContext&, double max_delay_time); + void Trace(blink::Visitor*) override; AudioParam* delayTime(); private: - DelayNode(BaseAudioContext&, double max_delay_time); - Member<AudioParam> delay_time_; };
diff --git a/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.cc b/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.cc index 9e4c4d86..7faaf06 100644 --- a/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.cc +++ b/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.cc
@@ -245,7 +245,7 @@ return nullptr; } - return new DynamicsCompressorNode(context); + return MakeGarbageCollected<DynamicsCompressorNode>(context); } DynamicsCompressorNode* DynamicsCompressorNode::Create(
diff --git a/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.h b/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.h index 1295e65..9821284 100644 --- a/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.h +++ b/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.h
@@ -92,6 +92,9 @@ static DynamicsCompressorNode* Create(BaseAudioContext*, const DynamicsCompressorOptions*, ExceptionState&); + + DynamicsCompressorNode(BaseAudioContext&); + void Trace(blink::Visitor*) override; AudioParam* threshold() const; @@ -102,7 +105,6 @@ AudioParam* release() const; private: - DynamicsCompressorNode(BaseAudioContext&); DynamicsCompressorHandler& GetDynamicsCompressorHandler() const; Member<AudioParam> threshold_;
diff --git a/third_party/blink/renderer/modules/webaudio/gain_node.cc b/third_party/blink/renderer/modules/webaudio/gain_node.cc index 05ed33d..ea9ae0e 100644 --- a/third_party/blink/renderer/modules/webaudio/gain_node.cc +++ b/third_party/blink/renderer/modules/webaudio/gain_node.cc
@@ -154,7 +154,7 @@ return nullptr; } - return new GainNode(context); + return MakeGarbageCollected<GainNode>(context); } GainNode* GainNode::Create(BaseAudioContext* context,
diff --git a/third_party/blink/renderer/modules/webaudio/gain_node.h b/third_party/blink/renderer/modules/webaudio/gain_node.h index 1930c36..6005e365 100644 --- a/third_party/blink/renderer/modules/webaudio/gain_node.h +++ b/third_party/blink/renderer/modules/webaudio/gain_node.h
@@ -75,13 +75,14 @@ static GainNode* Create(BaseAudioContext*, const GainOptions*, ExceptionState&); + + GainNode(BaseAudioContext&); + void Trace(blink::Visitor*) override; AudioParam* gain() const; private: - GainNode(BaseAudioContext&); - Member<AudioParam> gain_; };
diff --git a/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc b/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc index 4fb7f8a..d97c8606e 100644 --- a/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc +++ b/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc
@@ -145,7 +145,7 @@ bool has_non_zero_coef = false; - for (size_t k = 0; k < feedforward_coef.size(); ++k) { + for (wtf_size_t k = 0; k < feedforward_coef.size(); ++k) { if (feedforward_coef[k] != 0) { has_non_zero_coef = true; break; @@ -164,7 +164,7 @@ StringBuilder message; message.Append("Unstable IIRFilter with feedback coefficients: ["); message.AppendNumber(feedback_coef[0]); - for (size_t k = 1; k < feedback_coef.size(); ++k) { + for (wtf_size_t k = 1; k < feedback_coef.size(); ++k) { message.Append(", "); message.AppendNumber(feedback_coef[k]); } @@ -174,8 +174,8 @@ kJSMessageSource, kWarningMessageLevel, message.ToString())); } - return new IIRFilterNode(context, feedforward_coef, feedback_coef, - is_filter_stable); + return MakeGarbageCollected<IIRFilterNode>(context, feedforward_coef, + feedback_coef, is_filter_stable); } IIRFilterNode* IIRFilterNode::Create(BaseAudioContext* context,
diff --git a/third_party/blink/renderer/modules/webaudio/iir_filter_node.h b/third_party/blink/renderer/modules/webaudio/iir_filter_node.h index a8fe454..a33d99c2 100644 --- a/third_party/blink/renderer/modules/webaudio/iir_filter_node.h +++ b/third_party/blink/renderer/modules/webaudio/iir_filter_node.h
@@ -47,6 +47,11 @@ const IIRFilterOptions*, ExceptionState&); + IIRFilterNode(BaseAudioContext&, + const Vector<double>& denominator, + const Vector<double>& numerator, + bool is_filter_stable); + void Trace(blink::Visitor*) override; // Get the magnitude and phase response of the filter at the given @@ -57,11 +62,6 @@ ExceptionState&); private: - IIRFilterNode(BaseAudioContext&, - const Vector<double>& denominator, - const Vector<double>& numerator, - bool is_filter_stable); - IIRProcessor* GetIIRFilterProcessor() const; };
diff --git a/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.cc b/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.cc index ec42e046..70ba5e60 100644 --- a/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.cc +++ b/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.cc
@@ -30,7 +30,7 @@ namespace blink { WaveShaperProcessor::WaveShaperProcessor(float sample_rate, - size_t number_of_channels) + unsigned number_of_channels) : AudioDSPKernelProcessor(sample_rate, number_of_channels), oversample_(kOverSampleNone) {}
diff --git a/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.h b/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.h index 8c5ba109..bcbecfa 100644 --- a/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.h +++ b/third_party/blink/renderer/modules/webaudio/wave_shaper_processor.h
@@ -43,7 +43,7 @@ public: enum OverSampleType { kOverSampleNone, kOverSample2x, kOverSample4x }; - WaveShaperProcessor(float sample_rate, size_t number_of_channels); + WaveShaperProcessor(float sample_rate, unsigned number_of_channels); ~WaveShaperProcessor() override;
diff --git a/third_party/blink/renderer/modules/webdatabase/database.h b/third_party/blink/renderer/modules/webdatabase/database.h index 7c42a47..a7a9427 100644 --- a/third_party/blink/renderer/modules/webdatabase/database.h +++ b/third_party/blink/renderer/modules/webdatabase/database.h
@@ -53,6 +53,11 @@ DEFINE_WRAPPERTYPEINFO(); public: + Database(DatabaseContext*, + const String& name, + const String& expected_version, + const String& display_name, + unsigned estimated_size); ~Database() override; void Trace(blink::Visitor*) override; @@ -128,11 +133,6 @@ class DatabaseTransactionTask; class DatabaseTableNamesTask; - Database(DatabaseContext*, - const String& name, - const String& expected_version, - const String& display_name, - unsigned estimated_size); bool PerformOpenAndVerify(bool set_version_in_new_database, DatabaseError&, String& error_message);
diff --git a/third_party/blink/renderer/modules/webdatabase/database_authorizer.cc b/third_party/blink/renderer/modules/webdatabase/database_authorizer.cc index 49a3eb2..b15f5a5 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_authorizer.cc +++ b/third_party/blink/renderer/modules/webdatabase/database_authorizer.cc
@@ -40,7 +40,8 @@ DatabaseAuthorizer* DatabaseAuthorizer::Create( DatabaseContext* database_context, const String& database_info_table_name) { - return new DatabaseAuthorizer(database_context, database_info_table_name); + return MakeGarbageCollected<DatabaseAuthorizer>(database_context, + database_info_table_name); } DatabaseAuthorizer::DatabaseAuthorizer(DatabaseContext* database_context,
diff --git a/third_party/blink/renderer/modules/webdatabase/database_authorizer.h b/third_party/blink/renderer/modules/webdatabase/database_authorizer.h index 4461190..4af1926 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_authorizer.h +++ b/third_party/blink/renderer/modules/webdatabase/database_authorizer.h
@@ -50,6 +50,10 @@ static DatabaseAuthorizer* Create(DatabaseContext*, const String& database_info_table_name); + + explicit DatabaseAuthorizer(DatabaseContext*, + const String& database_info_table_name); + void Trace(blink::Visitor*); int CreateTable(const String& table_name); @@ -103,8 +107,6 @@ bool HadDeletes() const { return had_deletes_; } private: - explicit DatabaseAuthorizer(DatabaseContext*, - const String& database_info_table_name); void AddWhitelistedFunctions(); int DenyBasedOnTableName(const String&) const; int UpdateDeletesBasedOnTableName(const String&);
diff --git a/third_party/blink/renderer/modules/webdatabase/database_context.cc b/third_party/blink/renderer/modules/webdatabase/database_context.cc index 1eb9b79a..765aaaa 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_context.cc +++ b/third_party/blink/renderer/modules/webdatabase/database_context.cc
@@ -93,7 +93,7 @@ // which of the 2 destructs first. DatabaseContext* DatabaseContext::Create(ExecutionContext* context) { - DatabaseContext* self = new DatabaseContext(context); + DatabaseContext* self = MakeGarbageCollected<DatabaseContext>(context); DatabaseManager::Manager().RegisterDatabaseContext(self); return self; }
diff --git a/third_party/blink/renderer/modules/webdatabase/database_context.h b/third_party/blink/renderer/modules/webdatabase/database_context.h index bfbf056..063e20b 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_context.h +++ b/third_party/blink/renderer/modules/webdatabase/database_context.h
@@ -47,6 +47,7 @@ static DatabaseContext* Create(ExecutionContext*); + explicit DatabaseContext(ExecutionContext*); ~DatabaseContext(); void Trace(blink::Visitor*) override; @@ -67,8 +68,6 @@ bool IsContextThread() const; private: - explicit DatabaseContext(ExecutionContext*); - Member<DatabaseThread> database_thread_; bool has_open_databases_; // This never changes back to false, even after the // database thread is closed.
diff --git a/third_party/blink/renderer/modules/webdatabase/database_manager.cc b/third_party/blink/renderer/modules/webdatabase/database_manager.cc index 0f9e353..abe7320 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_manager.cc +++ b/third_party/blink/renderer/modules/webdatabase/database_manager.cc
@@ -144,8 +144,8 @@ DatabaseContext* backend_context = DatabaseContextFor(context)->Backend(); if (DatabaseTracker::Tracker().CanEstablishDatabase( backend_context, name, display_name, estimated_size, error)) { - Database* backend = new Database(backend_context, name, expected_version, - display_name, estimated_size); + Database* backend = MakeGarbageCollected<Database>( + backend_context, name, expected_version, display_name, estimated_size); if (backend->OpenAndVerifyVersion(set_version_in_new_database, error, error_message, creation_callback)) return backend;
diff --git a/third_party/blink/renderer/modules/webdatabase/database_thread.h b/third_party/blink/renderer/modules/webdatabase/database_thread.h index 045b609..168cc4a 100644 --- a/third_party/blink/renderer/modules/webdatabase/database_thread.h +++ b/third_party/blink/renderer/modules/webdatabase/database_thread.h
@@ -44,7 +44,11 @@ class DatabaseThread : public GarbageCollectedFinalized<DatabaseThread> { public: - static DatabaseThread* Create() { return new DatabaseThread; } + static DatabaseThread* Create() { + return MakeGarbageCollected<DatabaseThread>(); + } + + DatabaseThread(); ~DatabaseThread(); void Trace(blink::Visitor*); @@ -69,8 +73,6 @@ } private: - DatabaseThread(); - void SetupDatabaseThread(); void CleanupDatabaseThread(); void CleanupDatabaseThreadCompleted();
diff --git a/third_party/blink/renderer/modules/webdatabase/inspector_database_agent.cc b/third_party/blink/renderer/modules/webdatabase/inspector_database_agent.cc index 5c77fbdb..b28ced3 100644 --- a/third_party/blink/renderer/modules/webdatabase/inspector_database_agent.cc +++ b/third_party/blink/renderer/modules/webdatabase/inspector_database_agent.cc
@@ -95,13 +95,13 @@ std::unique_ptr<protocol::Array<String>> column_names = protocol::Array<String>::create(); const Vector<String>& columns = row_list->ColumnNames(); - for (size_t i = 0; i < columns.size(); ++i) + for (wtf_size_t i = 0; i < columns.size(); ++i) column_names->addItem(columns[i]); std::unique_ptr<protocol::Array<protocol::Value>> values = protocol::Array<protocol::Value>::create(); const Vector<SQLValue>& data = row_list->Values(); - for (size_t i = 0; i < data.size(); ++i) { + for (wtf_size_t i = 0; i < data.size(); ++i) { const SQLValue& value = row_list->Values()[i]; switch (value.GetType()) { case SQLValue::kStringValue:
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_result_set.idl b/third_party/blink/renderer/modules/webdatabase/sql_result_set.idl index 84a20be..acc7eda 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_result_set.idl +++ b/third_party/blink/renderer/modules/webdatabase/sql_result_set.idl
@@ -32,6 +32,6 @@ ] interface SQLResultSet { readonly attribute SQLResultSetRowList rows; - [RaisesException=Getter] readonly attribute long insertId; + [RaisesException=Getter] readonly attribute long long insertId; readonly attribute long rowsAffected; };
diff --git a/third_party/blink/renderer/modules/webgl/ext_blend_min_max.cc b/third_party/blink/renderer/modules/webgl/ext_blend_min_max.cc index f84a9bd..9ccc0f1 100644 --- a/third_party/blink/renderer/modules/webgl/ext_blend_min_max.cc +++ b/third_party/blink/renderer/modules/webgl/ext_blend_min_max.cc
@@ -16,7 +16,7 @@ } EXTBlendMinMax* EXTBlendMinMax::Create(WebGLRenderingContextBase* context) { - return new EXTBlendMinMax(context); + return MakeGarbageCollected<EXTBlendMinMax>(context); } bool EXTBlendMinMax::Supported(WebGLRenderingContextBase* context) {
diff --git a/third_party/blink/renderer/modules/webgl/ext_blend_min_max.h b/third_party/blink/renderer/modules/webgl/ext_blend_min_max.h index a9a6c261..09598f2 100644 --- a/third_party/blink/renderer/modules/webgl/ext_blend_min_max.h +++ b/third_party/blink/renderer/modules/webgl/ext_blend_min_max.h
@@ -17,10 +17,9 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); - WebGLExtensionName GetName() const override; - - private: explicit EXTBlendMinMax(WebGLRenderingContextBase*); + + WebGLExtensionName GetName() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.cc b/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.cc index e19fa24..bcce26a 100644 --- a/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.cc +++ b/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.cc
@@ -18,7 +18,7 @@ EXTColorBufferFloat* EXTColorBufferFloat::Create( WebGLRenderingContextBase* context) { - return new EXTColorBufferFloat(context); + return MakeGarbageCollected<EXTColorBufferFloat>(context); } bool EXTColorBufferFloat::Supported(WebGLRenderingContextBase* context) {
diff --git a/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.h b/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.h index 74c86a6..15a8587 100644 --- a/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.h +++ b/third_party/blink/renderer/modules/webgl/ext_color_buffer_float.h
@@ -17,10 +17,9 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); - WebGLExtensionName GetName() const override; - - private: explicit EXTColorBufferFloat(WebGLRenderingContextBase*); + + WebGLExtensionName GetName() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.cc b/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.cc index 166eaae..82bd7bc 100644 --- a/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.cc +++ b/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.cc
@@ -37,7 +37,7 @@ EXTColorBufferHalfFloat* EXTColorBufferHalfFloat::Create( WebGLRenderingContextBase* context) { - return new EXTColorBufferHalfFloat(context); + return MakeGarbageCollected<EXTColorBufferHalfFloat>(context); } bool EXTColorBufferHalfFloat::Supported(WebGLRenderingContextBase* context) {
diff --git a/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.h b/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.h index bf31b51..e82ec1b 100644 --- a/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.h +++ b/third_party/blink/renderer/modules/webgl/ext_color_buffer_half_float.h
@@ -38,10 +38,9 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); - WebGLExtensionName GetName() const override; - - private: explicit EXTColorBufferHalfFloat(WebGLRenderingContextBase*); + + WebGLExtensionName GetName() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.cc b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.cc index 8f6dcdb..4be645fb 100644 --- a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.cc +++ b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.cc
@@ -17,7 +17,7 @@ EXTDisjointTimerQuery* EXTDisjointTimerQuery::Create( WebGLRenderingContextBase* context) { - return new EXTDisjointTimerQuery(context); + return MakeGarbageCollected<EXTDisjointTimerQuery>(context); } bool EXTDisjointTimerQuery::Supported(WebGLRenderingContextBase* context) {
diff --git a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.h b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.h index ad18e650..2a1e205c 100644 --- a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.h +++ b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query.h
@@ -22,6 +22,8 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); + explicit EXTDisjointTimerQuery(WebGLRenderingContextBase*); + WebGLExtensionName GetName() const override; WebGLTimerQueryEXT* createQueryEXT(); @@ -37,7 +39,6 @@ private: friend class WebGLTimerQueryEXT; - explicit EXTDisjointTimerQuery(WebGLRenderingContextBase*); Member<WebGLTimerQueryEXT> current_elapsed_query_; };
diff --git a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.cc b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.cc index 123d601..8eba91c 100644 --- a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.cc +++ b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.cc
@@ -16,7 +16,8 @@ EXTDisjointTimerQueryWebGL2* EXTDisjointTimerQueryWebGL2::Create( WebGLRenderingContextBase* context) { - EXTDisjointTimerQueryWebGL2* o = new EXTDisjointTimerQueryWebGL2(context); + EXTDisjointTimerQueryWebGL2* o = + MakeGarbageCollected<EXTDisjointTimerQueryWebGL2>(context); return o; }
diff --git a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.h b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.h index 076932a..8ff994aa 100644 --- a/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.h +++ b/third_party/blink/renderer/modules/webgl/ext_disjoint_timer_query_webgl2.h
@@ -23,14 +23,13 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); + explicit EXTDisjointTimerQueryWebGL2(WebGLRenderingContextBase*); + WebGLExtensionName GetName() const override; void queryCounterEXT(WebGLQuery*, GLenum); void Trace(blink::Visitor*) override; - - private: - explicit EXTDisjointTimerQueryWebGL2(WebGLRenderingContextBase*); }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/ext_frag_depth.cc b/third_party/blink/renderer/modules/webgl/ext_frag_depth.cc index 7185974..e5e7886 100644 --- a/third_party/blink/renderer/modules/webgl/ext_frag_depth.cc +++ b/third_party/blink/renderer/modules/webgl/ext_frag_depth.cc
@@ -37,7 +37,7 @@ } EXTFragDepth* EXTFragDepth::Create(WebGLRenderingContextBase* context) { - return new EXTFragDepth(context); + return MakeGarbageCollected<EXTFragDepth>(context); } bool EXTFragDepth::Supported(WebGLRenderingContextBase* context) {
diff --git a/third_party/blink/renderer/modules/webgl/ext_frag_depth.h b/third_party/blink/renderer/modules/webgl/ext_frag_depth.h index 16d9e78..3d332a9 100644 --- a/third_party/blink/renderer/modules/webgl/ext_frag_depth.h +++ b/third_party/blink/renderer/modules/webgl/ext_frag_depth.h
@@ -38,10 +38,9 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); - WebGLExtensionName GetName() const override; - - private: explicit EXTFragDepth(WebGLRenderingContextBase*); + + WebGLExtensionName GetName() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.cc b/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.cc index 173f6c2..a15db7a7 100644 --- a/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.cc +++ b/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.cc
@@ -18,7 +18,7 @@ EXTShaderTextureLOD* EXTShaderTextureLOD::Create( WebGLRenderingContextBase* context) { - return new EXTShaderTextureLOD(context); + return MakeGarbageCollected<EXTShaderTextureLOD>(context); } bool EXTShaderTextureLOD::Supported(WebGLRenderingContextBase* context) {
diff --git a/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.h b/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.h index 8912f8365..1f8065e5 100644 --- a/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.h +++ b/third_party/blink/renderer/modules/webgl/ext_shader_texture_lod.h
@@ -17,10 +17,9 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); - WebGLExtensionName GetName() const override; - - private: explicit EXTShaderTextureLOD(WebGLRenderingContextBase*); + + WebGLExtensionName GetName() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/ext_srgb.cc b/third_party/blink/renderer/modules/webgl/ext_srgb.cc index fad8cc2..bd28afa 100644 --- a/third_party/blink/renderer/modules/webgl/ext_srgb.cc +++ b/third_party/blink/renderer/modules/webgl/ext_srgb.cc
@@ -17,7 +17,7 @@ } EXTsRGB* EXTsRGB::Create(WebGLRenderingContextBase* context) { - return new EXTsRGB(context); + return MakeGarbageCollected<EXTsRGB>(context); } bool EXTsRGB::Supported(WebGLRenderingContextBase* context) {
diff --git a/third_party/blink/renderer/modules/webgl/ext_srgb.h b/third_party/blink/renderer/modules/webgl/ext_srgb.h index 9e65590..673f3b9 100644 --- a/third_party/blink/renderer/modules/webgl/ext_srgb.h +++ b/third_party/blink/renderer/modules/webgl/ext_srgb.h
@@ -17,10 +17,9 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); - WebGLExtensionName GetName() const override; - - private: explicit EXTsRGB(WebGLRenderingContextBase*); + + WebGLExtensionName GetName() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.cc b/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.cc index d9e9005e..31d33a98 100644 --- a/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.cc +++ b/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.cc
@@ -40,7 +40,7 @@ EXTTextureFilterAnisotropic* EXTTextureFilterAnisotropic::Create( WebGLRenderingContextBase* context) { - return new EXTTextureFilterAnisotropic(context); + return MakeGarbageCollected<EXTTextureFilterAnisotropic>(context); } bool EXTTextureFilterAnisotropic::Supported(
diff --git a/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h b/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h index 90dfa126..353e048 100644 --- a/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h +++ b/third_party/blink/renderer/modules/webgl/ext_texture_filter_anisotropic.h
@@ -38,10 +38,9 @@ static bool Supported(WebGLRenderingContextBase*); static const char* ExtensionName(); - WebGLExtensionName GetName() const override; - - private: explicit EXTTextureFilterAnisotropic(WebGLRenderingContextBase*); + + WebGLExtensionName GetName() const override; }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/geometry/region.cc b/third_party/blink/renderer/platform/geometry/region.cc index 217ce61..d0623339 100644 --- a/third_party/blink/renderer/platform/geometry/region.cc +++ b/third_party/blink/renderer/platform/geometry/region.cc
@@ -100,8 +100,8 @@ region.shape_); } -double Region::Area() const { - double area = 0.0; +uint64_t Region::Area() const { + uint64_t area = 0; for (Shape::SpanIterator span = shape_.SpansBegin(), end = shape_.SpansEnd(); span != end && span + 1 != end; ++span) { int height = (span + 1)->y - span->y; @@ -110,7 +110,7 @@ end = shape_.SegmentsEnd(span); segment != end && segment + 1 != end; segment += 2) { int width = *(segment + 1) - *segment; - area += height * width; + area += (uint64_t)height * (uint64_t)width; } } return area;
diff --git a/third_party/blink/renderer/platform/geometry/region.h b/third_party/blink/renderer/platform/geometry/region.h index 12e29acb..943756a 100644 --- a/third_party/blink/renderer/platform/geometry/region.h +++ b/third_party/blink/renderer/platform/geometry/region.h
@@ -71,7 +71,7 @@ // Returns true if the query region intersects any part of this region. bool Intersects(const Region&) const; - double Area() const; + uint64_t Area() const; #ifndef NDEBUG void Dump() const;
diff --git a/third_party/blink/renderer/platform/geometry/region_test.cc b/third_party/blink/renderer/platform/geometry/region_test.cc index 2b207d52..cb642293 100644 --- a/third_party/blink/renderer/platform/geometry/region_test.cc +++ b/third_party/blink/renderer/platform/geometry/region_test.cc
@@ -383,19 +383,22 @@ TEST(RegionTest, Area) { Region r; - EXPECT_EQ(0.0, r.Area()); + EXPECT_EQ(0u, r.Area()); r.Unite(IntRect(10, 20, 30, 10)); - EXPECT_EQ(300.0, r.Area()); + EXPECT_EQ(300u, r.Area()); r.Unite(IntRect(20, 10, 10, 30)); - EXPECT_EQ(500.0, r.Area()); + EXPECT_EQ(500u, r.Area()); r.Unite(IntRect(10, 10, 30, 30)); - EXPECT_EQ(900.0, r.Area()); + EXPECT_EQ(900u, r.Area()); r.Subtract(IntRect(20, 20, 10, 10)); - EXPECT_EQ(800.0, r.Area()); + EXPECT_EQ(800u, r.Area()); + + r.Unite(IntRect(0, 0, 50000, 50000)); + EXPECT_EQ(2500000000u, r.Area()); } } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_blend.cc b/third_party/blink/renderer/platform/graphics/filters/fe_blend.cc index 51aa105..80f3535 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_blend.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_blend.cc
@@ -35,7 +35,7 @@ : FilterEffect(filter), mode_(mode) {} FEBlend* FEBlend::Create(Filter* filter, BlendMode mode) { - return new FEBlend(filter, mode); + return MakeGarbageCollected<FEBlend>(filter, mode); } bool FEBlend::SetBlendMode(BlendMode mode) {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_blend.h b/third_party/blink/renderer/platform/graphics/filters/fe_blend.h index 4dbbf31c..0b23ad9 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_blend.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_blend.h
@@ -32,6 +32,8 @@ public: static FEBlend* Create(Filter*, BlendMode); + FEBlend(Filter*, BlendMode); + BlendMode GetBlendMode() const { return mode_; } bool SetBlendMode(BlendMode); @@ -39,8 +41,6 @@ int indention) const override; private: - FEBlend(Filter*, BlendMode); - sk_sp<PaintFilter> CreateImageFilter() override; BlendMode mode_;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_box_reflect.h b/third_party/blink/renderer/platform/graphics/filters/fe_box_reflect.h index f7227790..a28d295 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_box_reflect.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_box_reflect.h
@@ -15,15 +15,16 @@ class PLATFORM_EXPORT FEBoxReflect final : public FilterEffect { public: static FEBoxReflect* Create(Filter* filter, const BoxReflection& reflection) { - return new FEBoxReflect(filter, reflection); + return MakeGarbageCollected<FEBoxReflect>(filter, reflection); } + FEBoxReflect(Filter*, const BoxReflection&); + // FilterEffect implementation WTF::TextStream& ExternalRepresentation(WTF::TextStream&, int indentation) const final; private: - FEBoxReflect(Filter*, const BoxReflection&); ~FEBoxReflect() final; FloatRect MapEffect(const FloatRect&) const final;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.cc b/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.cc index 3782178a..616cb43 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.cc
@@ -40,7 +40,7 @@ FEColorMatrix* FEColorMatrix::Create(Filter* filter, ColorMatrixType type, const Vector<float>& values) { - return new FEColorMatrix(filter, type, values); + return MakeGarbageCollected<FEColorMatrix>(filter, type, values); } ColorMatrixType FEColorMatrix::GetType() const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.h b/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.h index 2cd73e87..212eb96 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_color_matrix.h
@@ -40,6 +40,8 @@ public: static FEColorMatrix* Create(Filter*, ColorMatrixType, const Vector<float>&); + FEColorMatrix(Filter*, ColorMatrixType, const Vector<float>&); + ColorMatrixType GetType() const; bool SetType(ColorMatrixType); @@ -55,8 +57,6 @@ float value); private: - FEColorMatrix(Filter*, ColorMatrixType, const Vector<float>&); - sk_sp<PaintFilter> CreateImageFilter() override; bool AffectsTransparentPixels() const override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc b/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc index 6aaf717e..af4e32d 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.cc
@@ -52,8 +52,8 @@ const ComponentTransferFunction& green_func, const ComponentTransferFunction& blue_func, const ComponentTransferFunction& alpha_func) { - return new FEComponentTransfer(filter, red_func, green_func, blue_func, - alpha_func); + return MakeGarbageCollected<FEComponentTransfer>(filter, red_func, green_func, + blue_func, alpha_func); } static void Identity(unsigned char*, const ComponentTransferFunction&) {}
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.h b/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.h index 74738c4..1509883 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_component_transfer.h
@@ -67,16 +67,16 @@ const ComponentTransferFunction& blue_func, const ComponentTransferFunction& alpha_func); - WTF::TextStream& ExternalRepresentation(WTF::TextStream&, - int indention) const override; - - private: FEComponentTransfer(Filter*, const ComponentTransferFunction& red_func, const ComponentTransferFunction& green_func, const ComponentTransferFunction& blue_func, const ComponentTransferFunction& alpha_func); + WTF::TextStream& ExternalRepresentation(WTF::TextStream&, + int indention) const override; + + private: sk_sp<PaintFilter> CreateImageFilter() override; bool AffectsTransparentPixels() const override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_composite.cc b/third_party/blink/renderer/platform/graphics/filters/fe_composite.cc index cb35b13..2b0834f 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_composite.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_composite.cc
@@ -47,7 +47,7 @@ float k2, float k3, float k4) { - return new FEComposite(filter, type, k1, k2, k3, k4); + return MakeGarbageCollected<FEComposite>(filter, type, k1, k2, k3, k4); } CompositeOperationType FEComposite::Operation() const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_composite.h b/third_party/blink/renderer/platform/graphics/filters/fe_composite.h index 3841eb7..d416525a 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_composite.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_composite.h
@@ -48,6 +48,13 @@ float, float); + FEComposite(Filter*, + const CompositeOperationType&, + float, + float, + float, + float); + CompositeOperationType Operation() const; bool SetOperation(CompositeOperationType); @@ -72,13 +79,6 @@ } private: - FEComposite(Filter*, - const CompositeOperationType&, - float, - float, - float, - float); - FloatRect MapInputs(const FloatRect&) const override; bool AffectsTransparentPixels() const override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.cc b/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.cc index 621548d..2598ea2 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.cc
@@ -57,8 +57,9 @@ EdgeModeType edge_mode, bool preserve_alpha, const Vector<float>& kernel_matrix) { - return new FEConvolveMatrix(filter, kernel_size, divisor, bias, target_offset, - edge_mode, preserve_alpha, kernel_matrix); + return MakeGarbageCollected<FEConvolveMatrix>(filter, kernel_size, divisor, + bias, target_offset, edge_mode, + preserve_alpha, kernel_matrix); } FloatRect FEConvolveMatrix::MapEffect(const FloatRect& rect) const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.h b/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.h index 615e29cf..9212f5a 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_convolve_matrix.h
@@ -50,6 +50,15 @@ bool, const Vector<float>&); + FEConvolveMatrix(Filter*, + const IntSize&, + float, + float, + const IntPoint&, + EdgeModeType, + bool, + const Vector<float>&); + bool SetDivisor(float); bool SetBias(float); bool SetTargetOffset(const IntPoint&); @@ -60,15 +69,6 @@ int indention) const override; private: - FEConvolveMatrix(Filter*, - const IntSize&, - float, - float, - const IntPoint&, - EdgeModeType, - bool, - const Vector<float>&); - FloatRect MapEffect(const FloatRect&) const final; sk_sp<PaintFilter> CreateImageFilter() override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.cc b/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.cc index 344387f8..8d0c99d 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.cc
@@ -47,8 +47,9 @@ float surface_scale, float diffuse_constant, scoped_refptr<LightSource> light_source) { - return new FEDiffuseLighting(filter, lighting_color, surface_scale, - diffuse_constant, std::move(light_source)); + return MakeGarbageCollected<FEDiffuseLighting>( + filter, lighting_color, surface_scale, diffuse_constant, + std::move(light_source)); } FEDiffuseLighting::~FEDiffuseLighting() = default;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.h b/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.h index 8c57b15..5db5f8af 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_diffuse_lighting.h
@@ -36,6 +36,12 @@ float, float, scoped_refptr<LightSource>); + + FEDiffuseLighting(Filter*, + const Color&, + float, + float, + scoped_refptr<LightSource>); ~FEDiffuseLighting() override; Color LightingColor() const; @@ -52,13 +58,6 @@ WTF::TextStream& ExternalRepresentation(WTF::TextStream&, int indention) const override; - - private: - FEDiffuseLighting(Filter*, - const Color&, - float, - float, - scoped_refptr<LightSource>); }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.cc b/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.cc index 763d1ebc..02ecb59e 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.cc
@@ -45,8 +45,8 @@ ChannelSelectorType x_channel_selector, ChannelSelectorType y_channel_selector, float scale) { - return new FEDisplacementMap(filter, x_channel_selector, y_channel_selector, - scale); + return MakeGarbageCollected<FEDisplacementMap>(filter, x_channel_selector, + y_channel_selector, scale); } FloatRect FEDisplacementMap::MapEffect(const FloatRect& rect) const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.h b/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.h index a224f92a..fac11a8 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_displacement_map.h
@@ -42,6 +42,11 @@ ChannelSelectorType y_channel_selector, float); + FEDisplacementMap(Filter*, + ChannelSelectorType x_channel_selector, + ChannelSelectorType y_channel_selector, + float); + ChannelSelectorType XChannelSelector() const; bool SetXChannelSelector(const ChannelSelectorType); @@ -55,11 +60,6 @@ int indention) const override; private: - FEDisplacementMap(Filter*, - ChannelSelectorType x_channel_selector, - ChannelSelectorType y_channel_selector, - float); - FloatRect MapInputs(const FloatRect&) const override; FloatRect MapEffect(const FloatRect&) const override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc b/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc index 2f62c79..e9d121f6 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.cc
@@ -50,8 +50,8 @@ float dy, const Color& shadow_color, float shadow_opacity) { - return new FEDropShadow(filter, std_x, std_y, dx, dy, shadow_color, - shadow_opacity); + return MakeGarbageCollected<FEDropShadow>(filter, std_x, std_y, dx, dy, + shadow_color, shadow_opacity); } FloatRect FEDropShadow::MapEffect(const FloatSize& std_deviation,
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.h b/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.h index bbdf283..e3fa045 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_drop_shadow.h
@@ -31,6 +31,8 @@ static FEDropShadow* Create(Filter*, float, float, float, float, const Color&, float); + FEDropShadow(Filter*, float, float, float, float, const Color&, float); + // Compute which destination area will be affected when applying a drop // shadow effect with |stdDeviation| and |offset| to an area |rect|. static FloatRect MapEffect(const FloatSize& std_deviation, @@ -44,8 +46,6 @@ int indention) const override; private: - FEDropShadow(Filter*, float, float, float, float, const Color&, float); - FloatRect MapEffect(const FloatRect&) const override; sk_sp<PaintFilter> CreateImageFilter() override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_flood.cc b/third_party/blink/renderer/platform/graphics/filters/fe_flood.cc index 27d749cd..08715d1 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_flood.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_flood.cc
@@ -39,7 +39,7 @@ FEFlood* FEFlood::Create(Filter* filter, const Color& flood_color, float flood_opacity) { - return new FEFlood(filter, flood_color, flood_opacity); + return MakeGarbageCollected<FEFlood>(filter, flood_color, flood_opacity); } Color FEFlood::FloodColor() const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_flood.h b/third_party/blink/renderer/platform/graphics/filters/fe_flood.h index 6ebaae3..43147f60 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_flood.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_flood.h
@@ -32,6 +32,8 @@ public: static FEFlood* Create(Filter*, const Color&, float); + FEFlood(Filter*, const Color&, float); + Color FloodColor() const; bool SetFloodColor(const Color&); @@ -47,8 +49,6 @@ int indention) const override; private: - FEFlood(Filter*, const Color&, float); - sk_sp<PaintFilter> CreateImageFilter() override; Color flood_color_;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.cc b/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.cc index 1c643ab6..7be8b94 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.cc
@@ -60,7 +60,7 @@ : FilterEffect(filter), std_x_(x), std_y_(y) {} FEGaussianBlur* FEGaussianBlur::Create(Filter* filter, float x, float y) { - return new FEGaussianBlur(filter, x, y); + return MakeGarbageCollected<FEGaussianBlur>(filter, x, y); } FloatRect FEGaussianBlur::MapEffect(const FloatSize& std_deviation,
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.h b/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.h index 73ec88b..ec92a6eb 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_gaussian_blur.h
@@ -31,6 +31,8 @@ public: static FEGaussianBlur* Create(Filter*, float, float); + FEGaussianBlur(Filter*, float, float); + // Compute which destination area will be affected when applying a gaussian // blur effect with |stdDeviation| to an area |rect|. static FloatRect MapEffect(const FloatSize& std_deviation, const FloatRect&); @@ -39,8 +41,6 @@ int indention) const override; private: - FEGaussianBlur(Filter*, float, float); - FloatRect MapEffect(const FloatRect&) const override; sk_sp<PaintFilter> CreateImageFilter() override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_merge.cc b/third_party/blink/renderer/platform/graphics/filters/fe_merge.cc index 734f304..f3c40fe 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_merge.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_merge.cc
@@ -32,7 +32,7 @@ FEMerge::FEMerge(Filter* filter) : FilterEffect(filter) {} FEMerge* FEMerge::Create(Filter* filter) { - return new FEMerge(filter); + return MakeGarbageCollected<FEMerge>(filter); } sk_sp<PaintFilter> FEMerge::CreateImageFilter() {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_merge.h b/third_party/blink/renderer/platform/graphics/filters/fe_merge.h index 0577157d..02dab02a 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_merge.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_merge.h
@@ -31,12 +31,12 @@ public: static FEMerge* Create(Filter*); + explicit FEMerge(Filter*); + WTF::TextStream& ExternalRepresentation(WTF::TextStream&, int indention) const override; private: - explicit FEMerge(Filter*); - sk_sp<PaintFilter> CreateImageFilter() override; };
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_morphology.cc b/third_party/blink/renderer/platform/graphics/filters/fe_morphology.cc index d1d640a8..d8ee86f 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_morphology.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_morphology.cc
@@ -44,7 +44,7 @@ MorphologyOperatorType type, float radius_x, float radius_y) { - return new FEMorphology(filter, type, radius_x, radius_y); + return MakeGarbageCollected<FEMorphology>(filter, type, radius_x, radius_y); } MorphologyOperatorType FEMorphology::MorphologyOperator() const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_morphology.h b/third_party/blink/renderer/platform/graphics/filters/fe_morphology.h index 93b7048..baa3ca6f4 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_morphology.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_morphology.h
@@ -39,6 +39,9 @@ MorphologyOperatorType, float radius_x, float radius_y); + + FEMorphology(Filter*, MorphologyOperatorType, float radius_x, float radius_y); + MorphologyOperatorType MorphologyOperator() const; bool SetMorphologyOperator(MorphologyOperatorType); @@ -52,8 +55,6 @@ int indention) const override; private: - FEMorphology(Filter*, MorphologyOperatorType, float radius_x, float radius_y); - FloatRect MapEffect(const FloatRect&) const override; sk_sp<PaintFilter> CreateImageFilter() override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_offset.cc b/third_party/blink/renderer/platform/graphics/filters/fe_offset.cc index 7db7816..f5844d6 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_offset.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_offset.cc
@@ -35,7 +35,7 @@ : FilterEffect(filter), dx_(dx), dy_(dy) {} FEOffset* FEOffset::Create(Filter* filter, float dx, float dy) { - return new FEOffset(filter, dx, dy); + return MakeGarbageCollected<FEOffset>(filter, dx, dy); } float FEOffset::Dx() const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_offset.h b/third_party/blink/renderer/platform/graphics/filters/fe_offset.h index 2a45624..b7c1f1b 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_offset.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_offset.h
@@ -31,6 +31,8 @@ public: static FEOffset* Create(Filter*, float dx, float dy); + FEOffset(Filter*, float dx, float dy); + float Dx() const; void SetDx(float); @@ -41,8 +43,6 @@ int indention) const override; private: - FEOffset(Filter*, float dx, float dy); - FloatRect MapEffect(const FloatRect&) const override; sk_sp<PaintFilter> CreateImageFilter() override;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.cc b/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.cc index 427ef67..d2679a7 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.cc
@@ -51,9 +51,9 @@ float specular_constant, float specular_exponent, scoped_refptr<LightSource> light_source) { - return new FESpecularLighting(filter, lighting_color, surface_scale, - specular_constant, specular_exponent, - std::move(light_source)); + return MakeGarbageCollected<FESpecularLighting>( + filter, lighting_color, surface_scale, specular_constant, + specular_exponent, std::move(light_source)); } FESpecularLighting::~FESpecularLighting() = default;
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.h b/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.h index da68cb2..e35c0e4 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_specular_lighting.h
@@ -35,6 +35,13 @@ float, float, scoped_refptr<LightSource>); + + FESpecularLighting(Filter*, + const Color&, + float, + float, + float, + scoped_refptr<LightSource>); ~FESpecularLighting() override; Color LightingColor() const; @@ -54,14 +61,6 @@ WTF::TextStream& ExternalRepresentation(WTF::TextStream&, int indention) const override; - - private: - FESpecularLighting(Filter*, - const Color&, - float, - float, - float, - scoped_refptr<LightSource>); }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_tile.cc b/third_party/blink/renderer/platform/graphics/filters/fe_tile.cc index 22b1e32..70cb722 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_tile.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_tile.cc
@@ -31,7 +31,7 @@ FETile::FETile(Filter* filter) : FilterEffect(filter) {} FETile* FETile::Create(Filter* filter) { - return new FETile(filter); + return MakeGarbageCollected<FETile>(filter); } FloatRect FETile::MapInputs(const FloatRect& rect) const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_tile.h b/third_party/blink/renderer/platform/graphics/filters/fe_tile.h index 29c4cbf..1a7b7c5 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_tile.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_tile.h
@@ -31,12 +31,12 @@ public: static FETile* Create(Filter*); + FETile(Filter*); + WTF::TextStream& ExternalRepresentation(WTF::TextStream&, int indention) const override; private: - FETile(Filter*); - FilterEffectType GetFilterEffectType() const override { return kFilterEffectTypeTile; }
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.cc b/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.cc index da06cba..05e4acf 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.cc +++ b/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.cc
@@ -54,8 +54,9 @@ int num_octaves, float seed, bool stitch_tiles) { - return new FETurbulence(filter, type, base_frequency_x, base_frequency_y, - num_octaves, seed, stitch_tiles); + return MakeGarbageCollected<FETurbulence>(filter, type, base_frequency_x, + base_frequency_y, num_octaves, seed, + stitch_tiles); } TurbulenceType FETurbulence::GetType() const {
diff --git a/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.h b/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.h index 8f07b2d..21ef942 100644 --- a/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.h +++ b/third_party/blink/renderer/platform/graphics/filters/fe_turbulence.h
@@ -40,6 +40,8 @@ static FETurbulence* Create(Filter*, TurbulenceType, float, float, int, float, bool); + FETurbulence(Filter*, TurbulenceType, float, float, int, float, bool); + TurbulenceType GetType() const; bool SetType(TurbulenceType); @@ -62,8 +64,6 @@ int indention) const override; private: - FETurbulence(Filter*, TurbulenceType, float, float, int, float, bool); - sk_sp<PaintFilter> CreateImageFilter() override; TurbulenceType type_;
diff --git a/third_party/blink/renderer/platform/graphics/filters/filter.cc b/third_party/blink/renderer/platform/graphics/filters/filter.cc index 3cc292d..57ab7b7 100644 --- a/third_party/blink/renderer/platform/graphics/filters/filter.cc +++ b/third_party/blink/renderer/platform/graphics/filters/filter.cc
@@ -49,11 +49,13 @@ const FloatRect& filter_region, float scale, UnitScaling unit_scaling) { - return new Filter(reference_box, filter_region, scale, unit_scaling); + return MakeGarbageCollected<Filter>(reference_box, filter_region, scale, + unit_scaling); } Filter* Filter::Create(float scale) { - return new Filter(FloatRect(), FloatRect(), scale, kUserSpace); + return MakeGarbageCollected<Filter>(FloatRect(), FloatRect(), scale, + kUserSpace); } void Filter::Trace(blink::Visitor* visitor) {
diff --git a/third_party/blink/renderer/platform/graphics/filters/filter.h b/third_party/blink/renderer/platform/graphics/filters/filter.h index 0eda810..ecdfd6c2 100644 --- a/third_party/blink/renderer/platform/graphics/filters/filter.h +++ b/third_party/blink/renderer/platform/graphics/filters/filter.h
@@ -44,6 +44,11 @@ UnitScaling); static Filter* Create(float scale); + Filter(const FloatRect& reference_box, + const FloatRect& filter_region, + float scale, + UnitScaling); + void Trace(blink::Visitor*); float Scale() const { return scale_; } @@ -68,11 +73,6 @@ SourceGraphic* GetSourceGraphic() const { return source_graphic_.Get(); } private: - Filter(const FloatRect& reference_box, - const FloatRect& filter_region, - float scale, - UnitScaling); - FloatRect reference_box_; FloatRect filter_region_; float scale_;
diff --git a/third_party/blink/renderer/platform/heap/persistent_node.h b/third_party/blink/renderer/platform/heap/persistent_node.h index 1401441..596ce27 100644 --- a/third_party/blink/renderer/platform/heap/persistent_node.h +++ b/third_party/blink/renderer/platform/heap/persistent_node.h
@@ -11,6 +11,7 @@ #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/assertions.h" +#include "third_party/blink/renderer/platform/wtf/atomics.h" #include "third_party/blink/renderer/platform/wtf/threading_primitives.h" namespace blink {
diff --git a/third_party/blink/renderer/platform/heap/process_heap.cc b/third_party/blink/renderer/platform/heap/process_heap.cc index 26afa8b..023b203 100644 --- a/third_party/blink/renderer/platform/heap/process_heap.cc +++ b/third_party/blink/renderer/platform/heap/process_heap.cc
@@ -61,8 +61,8 @@ return mutex; } -size_t ProcessHeap::total_allocated_space_ = 0; -size_t ProcessHeap::total_allocated_object_size_ = 0; -size_t ProcessHeap::total_marked_object_size_ = 0; +std::atomic_size_t ProcessHeap::total_allocated_space_{0}; +std::atomic_size_t ProcessHeap::total_allocated_object_size_{0}; +std::atomic_size_t ProcessHeap::total_marked_object_size_{0}; } // namespace blink
diff --git a/third_party/blink/renderer/platform/heap/process_heap.h b/third_party/blink/renderer/platform/heap/process_heap.h index f119f05..ec3db19 100644 --- a/third_party/blink/renderer/platform/heap/process_heap.h +++ b/third_party/blink/renderer/platform/heap/process_heap.h
@@ -5,9 +5,9 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_PROCESS_HEAP_H_ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_HEAP_PROCESS_HEAP_H_ +#include <atomic> #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/atomics.h" #include "third_party/blink/renderer/platform/wtf/threading_primitives.h" namespace blink { @@ -35,38 +35,38 @@ static Mutex& CrossThreadPersistentMutex(); static void IncreaseTotalAllocatedObjectSize(size_t delta) { - AtomicAdd(&total_allocated_object_size_, static_cast<long>(delta)); + total_allocated_object_size_.fetch_add(delta, std::memory_order_relaxed); } static void DecreaseTotalAllocatedObjectSize(size_t delta) { - AtomicSubtract(&total_allocated_object_size_, static_cast<long>(delta)); + total_allocated_object_size_.fetch_sub(delta, std::memory_order_relaxed); } static size_t TotalAllocatedObjectSize() { - return AcquireLoad(&total_allocated_object_size_); + return total_allocated_object_size_.load(std::memory_order_relaxed); } static void IncreaseTotalMarkedObjectSize(size_t delta) { - AtomicAdd(&total_marked_object_size_, static_cast<long>(delta)); + total_marked_object_size_.fetch_add(delta, std::memory_order_relaxed); } static void DecreaseTotalMarkedObjectSize(size_t delta) { - AtomicSubtract(&total_marked_object_size_, static_cast<long>(delta)); + total_marked_object_size_.fetch_sub(delta, std::memory_order_relaxed); } static size_t TotalMarkedObjectSize() { - return AcquireLoad(&total_marked_object_size_); + return total_marked_object_size_.load(std::memory_order_relaxed); } static void IncreaseTotalAllocatedSpace(size_t delta) { - AtomicAdd(&total_allocated_space_, static_cast<long>(delta)); + total_allocated_space_.fetch_add(delta, std::memory_order_relaxed); } static void DecreaseTotalAllocatedSpace(size_t delta) { - AtomicSubtract(&total_allocated_space_, static_cast<long>(delta)); + total_allocated_space_.fetch_sub(delta, std::memory_order_relaxed); } static size_t TotalAllocatedSpace() { - return AcquireLoad(&total_allocated_space_); + return total_allocated_space_.load(std::memory_order_relaxed); } static void ResetHeapCounters(); private: - static size_t total_allocated_space_; - static size_t total_allocated_object_size_; - static size_t total_marked_object_size_; + static std::atomic_size_t total_allocated_space_; + static std::atomic_size_t total_allocated_object_size_; + static std::atomic_size_t total_marked_object_size_; friend class ThreadState; };
diff --git a/third_party/blink/renderer/platform/lifecycle_context_test.cc b/third_party/blink/renderer/platform/lifecycle_context_test.cc index 2b482bf..2b46c1f7 100644 --- a/third_party/blink/renderer/platform/lifecycle_context_test.cc +++ b/third_party/blink/renderer/platform/lifecycle_context_test.cc
@@ -41,7 +41,7 @@ USING_GARBAGE_COLLECTED_MIXIN(DummyContext); public: - static DummyContext* Create() { return new DummyContext; } + static DummyContext* Create() { return MakeGarbageCollected<DummyContext>(); } void Trace(blink::Visitor* visitor) override { LifecycleNotifier<DummyContext, TestingObserver>::Trace(visitor);
diff --git a/third_party/blink/renderer/platform/loader/fetch/memory_cache_test.cc b/third_party/blink/renderer/platform/loader/fetch/memory_cache_test.cc index e8c59241..8b0b6c7 100644 --- a/third_party/blink/renderer/platform/loader/fetch/memory_cache_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/memory_cache_test.cc
@@ -54,6 +54,10 @@ fetcher->RequestResource(params, Factory(), client)); } + FakeDecodedResource(const ResourceRequest& request, + const ResourceLoaderOptions& options) + : Resource(request, ResourceType::kMock, options) {} + void AppendData(const char* data, size_t len) override { Resource::AppendData(data, len); SetDecodedSize(this->size()); @@ -68,14 +72,10 @@ Resource* Create(const ResourceRequest& request, const ResourceLoaderOptions& options) const override { - return new FakeDecodedResource(request, options); + return MakeGarbageCollected<FakeDecodedResource>(request, options); } }; - FakeDecodedResource(const ResourceRequest& request, - const ResourceLoaderOptions& options) - : Resource(request, ResourceType::kMock, options) {} - void DestroyDecodedDataIfPossible() override { SetDecodedSize(0); } };
diff --git a/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc b/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc index 1654526..ccebb11 100644 --- a/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/raw_resource_test.cc
@@ -165,7 +165,7 @@ raw->FinishForTest(); EXPECT_FALSE(raw->GetResponse().IsNull()); - Persistent<DummyClient> dummy_client = new DummyClient(); + Persistent<DummyClient> dummy_client = MakeGarbageCollected<DummyClient>(); Persistent<AddingClient> adding_client = new AddingClient(dummy_client.Get(), raw); raw->AddClient(adding_client, platform_->test_task_runner().get()); @@ -208,7 +208,7 @@ raw->FinishForTest(); EXPECT_FALSE(raw->GetResponse().IsNull()); - Persistent<DummyClient> dummy_client = new DummyClient(); + Persistent<DummyClient> dummy_client = MakeGarbageCollected<DummyClient>(); Persistent<RemovingClient> removing_client = new RemovingClient(dummy_client.Get()); raw->AddClient(dummy_client, platform_->test_task_runner().get());
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_client.h b/third_party/blink/renderer/platform/loader/fetch/resource_client.h index 2238aa1..dced85b 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_client.h +++ b/third_party/blink/renderer/platform/loader/fetch/resource_client.h
@@ -42,7 +42,7 @@ class PLATFORM_EXPORT ResourceClient : public GarbageCollectedMixin { USING_PRE_FINALIZER(ResourceClient, ClearResource); public: - + ResourceClient() = default; virtual ~ResourceClient() = default; // DataReceived() is called each time a chunk of data is received. @@ -70,8 +70,6 @@ void Trace(Visitor* visitor) override; protected: - ResourceClient() = default; - void ClearResource() { SetResource(nullptr, nullptr); } private:
diff --git a/third_party/blink/renderer/platform/loader/testing/mock_fetch_context.h b/third_party/blink/renderer/platform/loader/testing/mock_fetch_context.h index a2a6b76..cb22145 100644 --- a/third_party/blink/renderer/platform/loader/testing/mock_fetch_context.h +++ b/third_party/blink/renderer/platform/loader/testing/mock_fetch_context.h
@@ -56,9 +56,9 @@ const FetchClientSettingsObject* GetFetchClientSettingsObject() const override { - return new FetchClientSettingsObjectSnapshot(KURL(), security_origin_, - kReferrerPolicyDefault, - String(), HttpsState::kNone); + return MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + KURL(), security_origin_, kReferrerPolicyDefault, String(), + HttpsState::kNone); } // The last ResourceRequest passed to DispatchWillSendRequest.
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 3ca1c43..8071d80 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -647,10 +647,15 @@ // Tracks "jank" from layout objects changing their visual location // between animation frames (see crbug.com/581518). name: "JankTracking", - implied_by: ["LayoutJankAPI"], + implied_by: ["LayoutJankAPI", "JankTrackingSweepLine"], status: "experimental", }, { + // Modifies JankTracking to use O(n log n) sweep line algorithm for + // computing the area of the jank region. + name: "JankTrackingSweepLine", + }, + { name: "KeyboardFocusableScrollers", status: "experimental", },
diff --git a/third_party/google_android_play_core/BUILD.gn b/third_party/google_android_play_core/BUILD.gn index d87f355..62df4b81 100644 --- a/third_party/google_android_play_core/BUILD.gn +++ b/third_party/google_android_play_core/BUILD.gn
@@ -5,6 +5,6 @@ import("//build/config/android/rules.gni") android_aar_prebuilt("com_google_android_play_core_java") { - aar_path = "core-1.3.6.aar" + aar_path = "core-1.3.7.aar" info_path = "com_google_android_play_core.info" }
diff --git a/third_party/google_android_play_core/README.chromium b/third_party/google_android_play_core/README.chromium index ef6c7734..3e37261 100644 --- a/third_party/google_android_play_core/README.chromium +++ b/third_party/google_android_play_core/README.chromium
@@ -1,7 +1,7 @@ Name: Goole Android Play Core Short Name: Play Core URL: https://developers.google.com/android/guides/setup -Version: 1.3.6 +Version: 1.3.7 License: Android Software Development Kit License License File: LICENSE Security Critical: yes
diff --git a/third_party/google_android_play_core/cipd.yaml b/third_party/google_android_play_core/cipd.yaml index 430f283..a397474 100644 --- a/third_party/google_android_play_core/cipd.yaml +++ b/third_party/google_android_play_core/cipd.yaml
@@ -3,8 +3,8 @@ # found in the LICENSE file. # To create CIPD package run the following command. -# cipd create --pkg-def cipd.yaml -tag version:1.3.6-cr1 +# cipd create --pkg-def cipd.yaml -tag version:1.3.7-cr0 package: chromium/third_party/android_deps/libs/com_google_android_play_core_verification description: "" data: -- file: core-1.3.6.aar \ No newline at end of file +- file: core-1.3.7.aar \ No newline at end of file
diff --git a/third_party/sqlite/BUILD.gn b/third_party/sqlite/BUILD.gn index 36fa01b..70853a8 100644 --- a/third_party/sqlite/BUILD.gn +++ b/third_party/sqlite/BUILD.gn
@@ -45,6 +45,13 @@ # prefer to control distribution to worker threads. "SQLITE_MAX_WORKER_THREADS=0", + # Allow 256MB mmap footprint per connection. Should not be too open-ended + # as that could cause memory fragmentation. 50MB encompasses the 99th + # percentile of Chrome databases in the wild. + # TODO(pwnall): A 64-bit-specific value could be 1G or more. + # TODO(pwnall): Figure out if exceeding this is costly. + "SQLITE_MAX_MMAP_SIZE=268435456", + # The default POSIX permissions for a newly created SQLite database. # # If unspecified, this defaults to 0644. All the data stored by Chrome is @@ -133,24 +140,6 @@ "SQLITE_HAVE_ISNAN", ] - if (is_win) { - defines += [ - # TODO(crbug.com/897576): Remove the Windows special-casing when we figure - # out if it's causing the crashes in the - # referenced bug. - "SQLITE_MAX_MMAP_SIZE=0", - ] - } else { - defines += [ - # Allow 256MB mmap footprint per connection. Should not be too open-ended - # as that could cause memory fragmentation. 50MB encompasses the 99th - # percentile of Chrome databases in the wild. - # TODO(pwnall): A 64-bit-specific value could be 1G or more. - # TODO(pwnall): Figure out if exceeding this is costly. - "SQLITE_MAX_MMAP_SIZE=268435456", - ] - } - # On OSX, SQLite has extra logic for detecting the use of network # filesystems (e.g., AFS, NFS) and for working around locking problems in # these filesystems. This logic is gated by SQLITE_ENABLE_LOCKING_STYLE, which
diff --git a/third_party/sqlite/amalgamation/sqlite3.c b/third_party/sqlite/amalgamation/sqlite3.c index e286561f..63562e45 100644 --- a/third_party/sqlite/amalgamation/sqlite3.c +++ b/third_party/sqlite/amalgamation/sqlite3.c
@@ -43143,6 +43143,7 @@ DWORD lastErrno; #if SQLITE_MAX_MMAP_SIZE>0 sqlite3_int64 oldMmapSize; + if( pFile->nFetchOut>0 ) return SQLITE_OK; #endif assert( pFile ); @@ -219049,7 +219050,7 @@ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ -#if __LINE__!=219052 +#if __LINE__!=219053 #undef SQLITE_SOURCE_ID #define SQLITE_SOURCE_ID "2018-11-05 20:37:38 89e099fbe5e13c33e683bef07361231ca525b88f7907be7092058007b750alt2" #endif
diff --git a/third_party/sqlite/patches/0011-Backport-windows-vfs-mmap-fix.patch b/third_party/sqlite/patches/0011-Backport-windows-vfs-mmap-fix.patch new file mode 100644 index 0000000..e117baef --- /dev/null +++ b/third_party/sqlite/patches/0011-Backport-windows-vfs-mmap-fix.patch
@@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Victor Costan <pwnall@chromium.org> +Date: Fri, 23 Nov 2018 10:51:10 -0800 +Subject: [PATCH 11/11] Backport Windows VFS mmap fix + + +Original change: https://www.sqlite.org/src/info/8576ccb479fc4b76 + +Original change description: +Make the winTruncate() method of the windows VFS be a no-op if there are +outstanding references to the memory-mapped pages. Otherwise, memory +might be deleted out from under those references when the file is +remapped during the truncate operation. + +Bug: 897576 +--- + third_party/sqlite/src/src/os_win.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os_win.c +index dfefc4452f02..5cd28a20e427 100644 +--- a/third_party/sqlite/src/src/os_win.c ++++ b/third_party/sqlite/src/src/os_win.c +@@ -2906,6 +2906,7 @@ static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ + DWORD lastErrno; + #if SQLITE_MAX_MMAP_SIZE>0 + sqlite3_int64 oldMmapSize; ++ if( pFile->nFetchOut>0 ) return SQLITE_OK; + #endif + + assert( pFile ); +-- +2.18.0 +
diff --git a/third_party/sqlite/src/src/os_win.c b/third_party/sqlite/src/src/os_win.c index dfefc44..5cd28a2 100644 --- a/third_party/sqlite/src/src/os_win.c +++ b/third_party/sqlite/src/src/os_win.c
@@ -2906,6 +2906,7 @@ DWORD lastErrno; #if SQLITE_MAX_MMAP_SIZE>0 sqlite3_int64 oldMmapSize; + if( pFile->nFetchOut>0 ) return SQLITE_OK; #endif assert( pFile );
diff --git a/tools/determinism/compare_build_artifacts.py b/tools/determinism/compare_build_artifacts.py index 9facad0d..4da16e0 100755 --- a/tools/determinism/compare_build_artifacts.py +++ b/tools/determinism/compare_build_artifacts.py
@@ -17,6 +17,7 @@ import subprocess import sys import time +import zipfile BASE_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -154,6 +155,36 @@ return result +def diff_zips(first_filepath, second_filepath): + with zipfile.ZipFile(first_filepath) as z1, \ + zipfile.ZipFile(second_filepath) as z2: + names1 = z1.namelist() + names2 = z2.namelist() + # This kind of difference is rare, so don't put effort into printing the + # exact difference. + if names1 != names2: + diff = sorted(set(names1).symmetric_difference(names2)) + if diff: + return ' Zip file lists differ:\n' + '\n'.join( + ' ' + f for f in diff) + else: + return ' Zips contain same files, but in different orders.' + + diffs = [] + for info1 in z1.infolist(): + info2 = z2.getinfo(info1.filename) + # Check for the two most common errors. The binary diff will still run + # to check the rest. + if info1.CRC != info2.CRC: + diffs.append(' {}: CRCs differ'.format(info1.filename)) + if info1.date_time != info2.date_time: + diffs.append(' {}: Timestamps differ'.format(info1.filename)) + # Don't be too spammy. + if len(diffs) > 5: + diffs[5:] = [' ...'] + return '\n'.join(diffs) + + def memoize(f): memo = {} def helper(*args): @@ -196,12 +227,18 @@ return '\n' + '\n'.join(' ' + line for line in diff.splitlines()) # else, falls through binary comparison, it must be binary equal too. + ret = None file_len = os.stat(first_filepath).st_size if file_len != os.stat(second_filepath).st_size: - return 'different size: %d != %d' % ( - file_len, os.stat(second_filepath).st_size) + ret = 'different size: %d != %d' % (file_len, + os.stat(second_filepath).st_size) + else: + ret = diff_binary(first_filepath, second_filepath, file_len) - return diff_binary(first_filepath, second_filepath, file_len) + if ret and zipfile.is_zipfile(first_filepath) and zipfile.is_zipfile( + second_filepath): + ret += '\n' + diff_zips(first_filepath, second_filepath) + return ret def get_deps(ninja_path, build_dir, target):
diff --git a/tools/determinism/deterministic_build_whitelist.pyl b/tools/determinism/deterministic_build_whitelist.pyl index 74a5d06..a866e936 100644 --- a/tools/determinism/deterministic_build_whitelist.pyl +++ b/tools/determinism/deterministic_build_whitelist.pyl
@@ -20,9 +20,6 @@ 'apks/VrNfcSimulator.apk', 'browser_tests_apk/browser_tests-debug.apk', 'unit_tests_apk/unit_tests-debug.apk', - - # https://crbug.com/897970 - 'lib.java/chromium_commands.dex.jar', ], # https://crbug.com/330263
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index c6312e1..d714e91 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -13364,6 +13364,15 @@ </summary> </histogram> +<histogram name="ChromeElf.ApplyHookResult" enum="NTSTATUS"> + <owner>pmonette@chromium.org</owner> + <summary> + Records the NTSTATUS result that was returned when attempting to hook + NtMapViewOfSection during chrome_elf.dll initialization. Emitted + asynchronously shortly after startup. + </summary> +</histogram> + <histogram name="ChromeElf.ThirdPartyStatus" enum="ThirdPartyStatus"> <owner>pmonette@chromium.org</owner> <summary> @@ -113745,6 +113754,17 @@ </summary> </histogram> +<histogram + name="ThirdPartyModules.Heartbeat.PrintingWorkaround.BlockingEnabled" + enum="BooleanEnabled"> + <owner>pmonette@chromium.org</owner> + <summary> + Records whether or not Chrome is still blocking third-party DLLs. This is a + bit that turns to false when the in-process printing is invoked. Recorded + every 5 minutes. + </summary> +</histogram> + <histogram name="ThirdPartyModules.Heartbeat.UniqueBlockedModulesCount" units="modules"> <owner>pmonette@chromium.org</owner>
diff --git a/tools/perf/expectations.config b/tools/perf/expectations.config index 4a21adc..64e36823 100644 --- a/tools/perf/expectations.config +++ b/tools/perf/expectations.config
@@ -226,6 +226,7 @@ crbug.com/839411 [ Win ] system_health.common_desktop/browse:social:twitter_infinite_scroll [ Skip ] crbug.com/846022 [ Linux ] system_health.common_desktop/browse:social:twitter_infinite_scroll [ Skip ] crbug.com/903417 [ Mac ] system_health.common_desktop/long_running:tools:gmail-foreground [ Skip ] +crbug.com/903417 [ Win ] system_health.common_desktop/long_running:tools:gmail-foreground [ Skip ] # Benchmark: system_health.common_mobile crbug.com/714650 [ Android ] system_health.common_mobile/browse:news:globo [ Skip ]
diff --git a/ui/file_manager/integration_tests/file_manager/zip_files.js b/ui/file_manager/integration_tests/file_manager/zip_files.js index d7afec5..bcb19608 100644 --- a/ui/file_manager/integration_tests/file_manager/zip_files.js +++ b/ui/file_manager/integration_tests/file_manager/zip_files.js
@@ -159,112 +159,6 @@ }; /** - * Tests encrypted zip file open, and canceling the passphrase dialog. - */ -testcase.zipFileOpenDownloadsEncryptedCancelPassphrase = function() { - let appId; - - const zipArchiverAppId = 'dmboannefpncccogfdikhmhpmdnddgoe'; - const zipArchiverPassphraseDialogUrl = - 'chrome-extension://dmboannefpncccogfdikhmhpmdnddgoe/html/passphrase.html'; - - var cancelPassphraseDialog = function(windowId) { - return sendTestMessage({ - 'name': 'runJsInAppWindow', - 'windowId': windowId, - 'script': - 'document.addEventListener("DOMContentLoaded", function() {document.querySelector("passphrase-dialog").shadowRoot.querySelector("#cancelButton").click();});' - }); - }; - - var waitForAllPassphraseWindowsClosed = function() { - const caller = getCaller(); - - const passphraseWindowCountCommand = { - 'name': 'countAppWindows', - 'appId': zipArchiverAppId - }; - - const getPassphraseWindowIdCommand = { - 'name': 'getAppWindowId', - 'windowUrl': zipArchiverPassphraseDialogUrl - }; - - return repeatUntil(function() { - return sendTestMessage(passphraseWindowCountCommand).then((result) => { - if (result == 0) - return true; - return sendTestMessage(getPassphraseWindowIdCommand) - .then((result) => { - if (result == 'none') - return true; - return cancelPassphraseDialog(result); - }) - .then(function() { - return pending(caller, 'waitForAllPassphraseWindowsClosed'); - }); - }); - }); - }; - - StepsRunner.run([ - // Open Files app on Downloads containing a zip file. - function() { - setupAndWaitUntilReady( - null, RootPath.DOWNLOADS, this.next, [ENTRIES.zipArchiveEncrypted], - []); - }, - // Select the zip file. - function(result) { - appId = result.windowId; - remoteCall.callRemoteTestUtil('selectFile', appId, ['encrypted.zip']) - .then(this.next); - }, - // Press the Enter key. - function(result) { - chrome.test.assertTrue(!!result, 'selectFile failed'); - const key = ['#file-list', 'Enter', false, false, false]; - remoteCall.callRemoteTestUtil('fakeKeyDown', appId, key, this.next); - }, - // Check: the zip file content should be shown (unzip). - function(result) { - chrome.test.assertTrue(!!result, 'fakeKeyDown failed'); - const files = getUnzippedFileListRowEntries(); - remoteCall.waitForFiles(appId, files, {'ignoreLastModifiedTime': true}) - .then(this.next); - }, - // Select the text file in the ZIP file. - function(result) { - remoteCall.callRemoteTestUtil('selectFile', appId, ['text.txt']) - .then(this.next); - }, - // Press the Enter key. - function(result) { - chrome.test.assertTrue(!!result, 'selectFile failed'); - const key = ['#file-list', 'Enter', false, false, false]; - remoteCall.callRemoteTestUtil('fakeKeyDown', appId, key, this.next); - }, - // Wait for the external passphrase dialog window to appear. - function(result) { - chrome.test.assertTrue(!!result, 'fakeKeyDown failed'); - waitForAppWindow(zipArchiverPassphraseDialogUrl).then(this.next); - }, - // Close the dialog by pressing the 'Cancel' button. Repeat for any new - // dialogs that pop up. - function(result) { - waitForAllPassphraseWindowsClosed().then(this.next); - }, - // Check: the zip file content should still be shown. - function(result) { - chrome.test.assertTrue(!!result, 'fakeKeyDown failed'); - const files = getUnzippedFileListRowEntries(); - remoteCall.waitForFiles(appId, files, {'ignoreLastModifiedTime': true}) - .then(this.next); - }, - ]); -}; - -/** * Tests zip file open (aka unzip) from Google Drive. */ testcase.zipFileOpenDrive = function() {
diff --git a/ui/file_manager/integration_tests/test_util.js b/ui/file_manager/integration_tests/test_util.js index 28c69a5..806bb8c 100644 --- a/ui/file_manager/integration_tests/test_util.js +++ b/ui/file_manager/integration_tests/test_util.js
@@ -193,43 +193,6 @@ } /** - * Waits for an app window with the URL |windowUrl|. - * @param {string} windowUrl URL of the app window to wait for. - * @return {Promise} Promise to be fulfilled with the window ID of the - * app window. - */ -function waitForAppWindow(windowUrl) { - const caller = getCaller(); - const command = {'name': 'getAppWindowId', 'windowUrl': windowUrl}; - return repeatUntil(function() { - return sendTestMessage(command).then((result) => { - if (result == 'none') - return pending(caller, 'getAppWindowId ' + windowUrl); - return result; - }); - }); -} - -/** - * Wait for the count of windows for app |appId| to equal |expectedCount|. - * @param{string} appId ID of the app to count windows for. - * @param{number} expectedCount Number of app windows to wait for. - * @return {Promise} Promise to be fulfilled when the number of app windows - * equals |expectedCount|. - */ -function waitForAppWindowCount(appId, expectedCount) { - const caller = getCaller(); - const command = {'name': 'countAppWindows', 'appId': appId}; - return repeatUntil(function() { - return sendTestMessage(command).then((result) => { - if (result != expectedCount) - return pending(caller, 'waitForAppWindowCount ' + appId + ' ' + result); - return true; - }); - }); -} - -/** * Adds the givin entries to the target volume(s). * @param {Array<string>} volumeNames Names of target volumes. * @param {Array<TestEntryInfo>} entries List of entries to be added. @@ -741,17 +704,6 @@ typeText: 'Zip archive' }), - zipArchiveEncrypted: new TestEntryInfo({ - type: EntryType.FILE, - sourceFileName: 'encrypted.zip', - targetPath: 'encrypted.zip', - mimeType: 'application/x-zip', - lastModifiedTime: 'Jan 1, 2014, 1:00 AM', - nameText: 'encrypted.zip', - sizeText: '589 bytes', - typeText: 'Zip archive' - }), - debPackage: new TestEntryInfo({ type: EntryType.FILE, sourceFileName: 'package.deb',