New issue
Advanced search Search tips

Issue 891908 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Replace ToSubclass / ToSubclassOrNull / ToSubclassChecked with To<Subclass> / DynamicTo<Subclass> / CheckedTo<Subclass>

Project Member Reported by dcheng@chromium.org, Oct 3

Issue description

Rationale:
1) Using a traits class to define safe casts lets us use a standard way of checking for whether a downcast is safe: IsA<Subclass>. While most Blink classes expose virtuals like IsSubclass(), that's not universally true--and sometimes the type checking method is unusually named, or is done with an enum type tag, et cetera.

2) This removes some confusion around the "OrNull" variant: it's easy to think that the "OrNull" variant needs to be used when the input could be null: in fact, it's perfectly safe to downcast with To<> if the input is null (even if it's a bit odd).

3) It's not a macro?

Along the way, also update code to use DynamicTo for checking the subclass + and downcasting to it.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Oct 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/58181c2588984a85a2aad35e4a209616cf2fa641

commit 58181c2588984a85a2aad35e4a209616cf2fa641
Author: Daniel Cheng <dcheng@chromium.org>
Date: Wed Oct 03 23:24:15 2018

Implement C++ style dynamic casting operators for Blink

Also switches Document over to use it and audit the current usage of the
downcasting macros. As a result, a number of locations now use
DynamicTo<T> instead of requiring a separate type check and cast.

Redundant DCHECKs have been removed: To<T> already implies a DCHECK() that
the operand is a T.

Bonus: ToTreeScope(Document*) has been removed: it's never needed as
TreeScope is a base class of Document.

Bug: 891908

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: Ia9be66b435086b9c75facc4da0f9269c41e8927f
Reviewed-on: https://chromium-review.googlesource.com/c/1230233
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Hayato Ito <hayato@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596416}
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/source_location.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/v8_abstract_event_handler.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/v8_lazy_event_listener.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/v8_page_popup_controller_binding.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/core/v8/v8_script_runner.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/templates/methods.cpp.tmpl
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_constructor.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_event_target.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/bindings/tests/results/core/v8_test_interface_named_constructor.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/animation/animation.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/animation/document_timeline.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/animation/effect_input.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/css_font_face.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/cssom/style_property_map.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/cssom/style_property_map_read_only.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/font_face.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/font_face_set_document.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/parser/css_parser_context.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/property_registration.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/remote_font_face_source.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/css/style_engine.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/container_node.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/context_lifecycle_observer.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/document.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/document.h
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/element.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/element_visibility_observer.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/events/window_event_context.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/dom/node.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/editing/serializers/markup_formatter.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/editing/serializers/styled_markup_serializer.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/exported/shared_worker_repository_client_impl.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/exported/web_associated_url_loader_impl.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/exported/web_document.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/fetch/fetch_manager.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/fileapi/file_reader.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/csp/content_security_policy.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/deprecation.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/dom_window.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/history.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/hosts_using_features.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/pausable_script_executor.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/performance_monitor.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/performance_monitor_test.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/frame/use_counter.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/fullscreen/fullscreen.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/html/custom/custom_element_upgrade_sorter.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/inspector/dom_editor.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/inspector/inspector_dom_agent.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/inspector/inspector_trace_events.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/inspector/main_thread_debugger.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/inspector/thread_debugger.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/intersection_observer/intersection_observation.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/intersection_observer/intersection_observer.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/intersection_observer/intersection_observer_controller.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/layout/custom/layout_worklet.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/layout/layout_tree_as_text.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/loader/subresource_filter.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/loader/threadable_loader.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/origin_trials/origin_trial_context.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/page/focus_controller.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/page/spatial_navigation.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/page/touch_adjustment.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/script/modulator.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/testing/internals.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/testing/v8/web_core_test_support.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/timing/window_performance.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/workers/dedicated_worker.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/workers/dedicated_worker_test.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/workers/experimental/worker_task_queue.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/workers/shared_worker.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/workers/threaded_messaging_proxy_base.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/workers/threaded_worklet_test.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/xml/document_xslt.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/core/xmlhttprequest/xml_http_request.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/animationworklet/animation_worklet.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/app_banner/before_install_prompt_event.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/audio_output_devices/audio_output_device_client.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/audio_output_devices/audio_output_device_client.h
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/audio_output_devices/audio_output_device_client_impl.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/audio_output_devices/audio_output_device_client_impl.h
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/audio_output_devices/html_media_element_audio_output_device.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/battery/battery_manager.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/battery/navigator_battery.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/bluetooth/bluetooth.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/clipboard/clipboard_promise.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/cookie_store/cookie_store.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/credentialmanager/credential_manager_proxy.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/credentialmanager/credential_manager_proxy.h
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/credentialmanager/credentials_container_test.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/csspaint/paint_worklet.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/encryptedmedia/media_keys_controller.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/encryptedmedia/navigator_request_media_key_system_access.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/eventsource/event_source.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/filesystem/local_file_system.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/filesystem/local_file_system_client.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/geolocation/geolocation.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/indexeddb/idb_factory.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/indexeddb/indexed_db_client.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/indexeddb/inspector_indexed_db_agent.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/mediasession/media_session.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/mediastream/media_devices.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/mediastream/media_stream_track.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/mediastream/user_media_request.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/netinfo/network_information.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/nfc/nfc.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/notifications/notification.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/notifications/notification_manager.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/payments/payment_instruments.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/payments/payment_request.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/peerconnection/rtc_ice_transport.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/peerconnection/rtc_peer_connection.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/permissions/permissions.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/picture_in_picture/document_picture_in_picture.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/presentation/presentation_availability.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/presentation/presentation_connection.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/presentation/presentation_controller.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/presentation/presentation_request.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/push_messaging/push_manager.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/quota/deprecated_storage_quota.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/quota/storage_manager.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/sensor/sensor.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/service_worker/service_worker_container_client.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/speech/speech_grammar.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/speech/speech_grammar_list.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/speech/speech_recognition.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/speech/speech_synthesis.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/wake_lock/wake_lock.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webaudio/audio_context.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webaudio/audio_worklet.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webaudio/base_audio_context.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webdatabase/database_client.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webdatabase/database_context.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webdatabase/database_tracker.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webmidi/midi_access_initializer.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webmidi/midi_input.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webmidi/midi_port.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webmidi/navigator_web_midi.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webshare/navigator_share.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/websockets/inspector_websocket_events.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/webusb/usb.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/xr/xr_device.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/modules/xr/xr_session.cc
[modify] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/platform/wtf/BUILD.gn
[add] https://crrev.com/58181c2588984a85a2aad35e4a209616cf2fa641/third_party/blink/renderer/platform/wtf/casting.h

Project Member

Comment 2 by bugdroid1@chromium.org, Oct 10

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/146802d392d308b084a472f363da971be7956e3c

commit 146802d392d308b084a472f363da971be7956e3c
Author: Daniel Cheng <dcheng@chromium.org>
Date: Wed Oct 10 18:48:36 2018

Switch WorkerOrWorkletGlobalScope to use new downcast helpers.

Bug: 891908
Change-Id: I6e801f7f9b85617e1b5dac6afd08affe36dd96b5
Reviewed-on: https://chromium-review.googlesource.com/c/1272226
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598427}
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/bindings/core/v8/v8_abstract_event_handler.cc
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.cc
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/core/frame/deprecation.cc
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/core/frame/use_counter.cc
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/core/inspector/worker_thread_debugger.cc
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/core/script/modulator.cc
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/core/workers/worker_content_settings_client.cc
[modify] https://crrev.com/146802d392d308b084a472f363da971be7956e3c/third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h

Project Member

Comment 3 by bugdroid1@chromium.org, Oct 10

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9cfd1b1d81bc437f26d5a993a0c02de95522da80

commit 9cfd1b1d81bc437f26d5a993a0c02de95522da80
Author: Daniel Cheng <dcheng@chromium.org>
Date: Wed Oct 10 20:15:28 2018

Cleanup WebPagePopupImpl's usage of ToLocalFrame().

WebPagePopupImpl always has a local main frame associated with its
internal Page, so add a helper to retrieve the main LocalFrame from the
Page.

Also cleans up the various null checks to mostly focus on checking
whether or not page_ is null: if page is non-null, there's no need to
also check that LocalFrameView is non-null, Document is non-null, et c.

Change-Id: I209c3aa343154b68207a1a824f2d3f6be7959e79
Bug: 891908
Reviewed-on: https://chromium-review.googlesource.com/c/1271987
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#598473}
[modify] https://crrev.com/9cfd1b1d81bc437f26d5a993a0c02de95522da80/third_party/blink/renderer/core/exported/web_page_popup_impl.cc
[modify] https://crrev.com/9cfd1b1d81bc437f26d5a993a0c02de95522da80/third_party/blink/renderer/core/exported/web_page_popup_impl.h

Project Member

Comment 4 by bugdroid1@chromium.org, Oct 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/6665830ceaea42819ae2483008971b46f0b76b72

commit 6665830ceaea42819ae2483008971b46f0b76b72
Author: Daniel Cheng <dcheng@chromium.org>
Date: Sat Oct 13 00:11:31 2018

Add ExecutionContext::ShouldInstallV8Extensions() for bindings.

WorkerOrWorkletScriptController currently relies on knowledge of modules
to determine whether or not to install V8 extensions. It currently
avoids an actual DEPS violation by not actually downcasting to
ServiceWorkerGlobalScope.

Rather than skirting the layering boundaries, this CL abstracts the
policy into ExecutionContext itself and has LocalWindowProxy and
WorkerOrWorkletScriptController consult this policy bit.

Since this CL also refactored how v8 extension registration worked, it
uncovered a pre-existing memory leak in browser tests. The fix for that
is to move registration of extensions::SafeBuiltins out of the ctor of
extension::Dispatcher (which is overridden in some tests), and simply
initialize it explicitly when creating a new extension::Dispatcher in the
various ExtensionRendererClient implementations.

Bug: 891908
Change-Id: I1d75f609e172731900b6c8d306d2156bf781dc63
Reviewed-on: https://chromium-review.googlesource.com/c/1278348
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Ken Rockot <rockot@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599430}
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/chrome/renderer/extensions/chrome_extensions_renderer_client.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/extensions/renderer/dispatcher.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/extensions/shell/renderer/shell_extensions_renderer_client.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/bindings/core/v8/script_controller.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/bindings/core/v8/script_controller.h
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/core/dom/document.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/core/dom/document.h
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/core/execution_context/execution_context.h
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.cc
[modify] https://crrev.com/6665830ceaea42819ae2483008971b46f0b76b72/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h

Project Member

Comment 5 by bugdroid1@chromium.org, Oct 13

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a9efca9fab0c0602f4c0bc76152f16afc3387d7c

commit a9efca9fab0c0602f4c0bc76152f16afc3387d7c
Author: Daniel Cheng <dcheng@chromium.org>
Date: Sat Oct 13 04:44:01 2018

Switch WorkerGlobalScope to use new downcast helpers.

Bug: 891908
Change-Id: Ibe82744b16c7655b76dc1dfbf11fb158a0316fc7
Reviewed-on: https://chromium-review.googlesource.com/c/1277827
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599485}
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/bindings/core/v8/scheduled_action.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/css/css_font_face.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/css/css_font_face_src_value.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/css/font_face.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/css/font_face_set_worker.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/exported/web_shared_worker_impl.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/frame/csp/content_security_policy.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/imagebitmap/image_bitmap_factories.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/inspector/inspector_trace_events.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/inspector/worker_inspector_controller.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/loader/threadable_loader.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/loader/worker_fetch_context.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/messaging/message_port.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/script/modulator.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/script/worker_modulator_impl.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/timing/performance_observer.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/workers/dedicated_worker.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/workers/dedicated_worker_object_proxy.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/workers/shared_worker_global_scope.h
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/workers/threaded_messaging_proxy_base.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/workers/worker_global_scope.h
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/workers/worker_module_tree_client.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/core/workers/worker_thread.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/canvas/offscreencanvas2d/offscreen_canvas_rendering_context_2d.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/filesystem/local_file_system.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/filesystem/local_file_system_client.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/indexeddb/indexed_db_client.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/service_worker/service_worker_clients.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/service_worker/service_worker_global_scope_client.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/service_worker/service_worker_window_client.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/websockets/inspector_websocket_events.cc
[modify] https://crrev.com/a9efca9fab0c0602f4c0bc76152f16afc3387d7c/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc

Project Member

Comment 6 by bugdroid1@chromium.org, Oct 17

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/59ffabe05540aca30d614c9080f167b29ad0244b

commit 59ffabe05540aca30d614c9080f167b29ad0244b
Author: Daniel Cheng <dcheng@chromium.org>
Date: Wed Oct 17 13:07:20 2018

Switch DedicatedWorkerGlobalScope to use new downcast helpers.

Bug: 891908
Change-Id: If954e2ea4309578b50d987db8a7ce4db31845057
Reviewed-on: https://chromium-review.googlesource.com/c/1283251
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600370}
[modify] https://crrev.com/59ffabe05540aca30d614c9080f167b29ad0244b/third_party/blink/renderer/core/workers/dedicated_worker_global_scope.h

Project Member

Comment 7 by bugdroid1@chromium.org, Oct 17

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de

commit e28ec8f94283f8e1219b3f4f62da7be6a8cac3de
Author: Daniel Cheng <dcheng@chromium.org>
Date: Wed Oct 17 15:20:33 2018

Switch WorkletGlobalScope to use new downcast helpers.

Bug: 891908
Change-Id: I56c0feb3b4a92232a93271f8097fc56e5703e1b6
Reviewed-on: https://chromium-review.googlesource.com/c/1286292
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600396}
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/inspector/main_thread_debugger.cc
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/loader/modulescript/module_script_loader_test.cc
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/origin_trials/origin_trial_context.cc
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/script/modulator.cc
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/script/worklet_modulator_impl.cc
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/workers/threaded_worklet_object_proxy.cc
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/workers/threaded_worklet_test.cc
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/workers/worklet_global_scope.h
[modify] https://crrev.com/e28ec8f94283f8e1219b3f4f62da7be6a8cac3de/third_party/blink/renderer/core/workers/worklet_module_tree_client.cc

Project Member

Comment 8 by bugdroid1@chromium.org, Oct 17

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6

commit f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6
Author: Daniel Cheng <dcheng@chromium.org>
Date: Wed Oct 17 16:55:53 2018

Switch remaining WorkletGlobalScope subclasses to use new downcast helpers.

Bug: 891908
Change-Id: I16e0cdded27728d419f3889ed087613401f2c183
Reviewed-on: https://chromium-review.googlesource.com/c/1286774
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600431}
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/core/layout/custom/layout_worklet_global_scope.h
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/csspaint/paint_worklet_global_scope.h
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.h
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope_test.cc
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/webaudio/audio_worklet_messaging_proxy.cc
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/webaudio/audio_worklet_object_proxy.cc
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/webaudio/audio_worklet_processor.cc
[modify] https://crrev.com/f77788fb7efa5ea8d3e0b89370bb8d89728e4fe6/third_party/blink/renderer/modules/webaudio/base_audio_context.cc

Project Member

Comment 9 by bugdroid1@chromium.org, Oct 18

Labels: Hotlist-CodeRefactoring
Daniel, I this is probably appropriate to mark as a Blink refactoring effort that would be easy for Igalia to help with, right?

Sign in to add a comment